抓大鹅B4+B5进行中
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-01 01:02:19 +08:00
parent bcb99e17b5
commit 38b5db553e
563 changed files with 12483 additions and 4421 deletions

View File

@@ -0,0 +1,467 @@
use super::*;
use crate::mapper::*;
impl SpacetimeClient {
pub async fn create_match3d_agent_session(
&self,
input: Match3DAgentSessionCreateRecordInput,
) -> Result<Match3DAgentSessionRecord, SpacetimeClientError> {
let procedure_input = Match3DAgentSessionCreateInput {
session_id: input.session_id,
owner_user_id: input.owner_user_id,
seed_text: input.seed_text,
welcome_message_id: input.welcome_message_id,
welcome_message_text: input.welcome_message_text,
config_json: input.config_json,
created_at_micros: input.created_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().create_match_3_d_agent_session_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_agent_session_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn get_match3d_agent_session(
&self,
session_id: String,
owner_user_id: String,
) -> Result<Match3DAgentSessionRecord, SpacetimeClientError> {
let procedure_input = Match3DAgentSessionGetInput {
session_id,
owner_user_id,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().get_match_3_d_agent_session_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_agent_session_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn submit_match3d_agent_message(
&self,
input: Match3DAgentMessageSubmitRecordInput,
) -> Result<Match3DAgentSessionRecord, SpacetimeClientError> {
let procedure_input = Match3DAgentMessageSubmitInput {
session_id: input.session_id,
owner_user_id: input.owner_user_id,
user_message_id: input.user_message_id,
user_message_text: input.user_message_text,
submitted_at_micros: input.submitted_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().submit_match_3_d_agent_message_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_agent_session_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn finalize_match3d_agent_message(
&self,
input: Match3DAgentMessageFinalizeRecordInput,
) -> Result<Match3DAgentSessionRecord, SpacetimeClientError> {
let procedure_input = Match3DAgentMessageFinalizeInput {
session_id: input.session_id,
owner_user_id: input.owner_user_id,
assistant_message_id: input.assistant_message_id,
assistant_reply_text: input.assistant_reply_text,
config_json: input.config_json,
progress_percent: input.progress_percent,
stage: input.stage,
updated_at_micros: input.updated_at_micros,
error_message: input.error_message,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.finalize_match_3_d_agent_message_turn_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_agent_session_procedure_result);
send_once(&sender, mapped);
});
})
.await
}
pub async fn compile_match3d_draft(
&self,
input: Match3DCompileDraftRecordInput,
) -> Result<Match3DAgentSessionRecord, SpacetimeClientError> {
let procedure_input = Match3DDraftCompileInput {
session_id: input.session_id,
owner_user_id: input.owner_user_id,
profile_id: input.profile_id,
author_display_name: input.author_display_name,
game_name: input.game_name,
summary_text: input.summary_text,
tags_json: input.tags_json,
cover_image_src: input.cover_image_src,
cover_asset_id: input.cover_asset_id,
compiled_at_micros: input.compiled_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().compile_match_3_d_draft_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_agent_session_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn update_match3d_work(
&self,
input: Match3DWorkUpdateRecordInput,
) -> Result<Match3DWorkProfileRecord, SpacetimeClientError> {
let procedure_input = Match3DWorkUpdateInput {
profile_id: input.profile_id,
owner_user_id: input.owner_user_id,
game_name: input.game_name,
theme_text: input.theme_text,
summary_text: input.summary_text,
tags_json: input.tags_json,
cover_image_src: input.cover_image_src,
cover_asset_id: input.cover_asset_id,
clear_count: input.clear_count,
difficulty: input.difficulty,
updated_at_micros: input.updated_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().update_match_3_d_work_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_work_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn publish_match3d_work(
&self,
profile_id: String,
owner_user_id: String,
published_at_micros: i64,
) -> Result<Match3DWorkProfileRecord, SpacetimeClientError> {
let procedure_input = Match3DWorkPublishInput {
profile_id,
owner_user_id,
published_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().publish_match_3_d_work_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_work_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn list_match3d_works(
&self,
owner_user_id: String,
) -> Result<Vec<Match3DWorkProfileRecord>, SpacetimeClientError> {
self.list_match3d_works_with_input(Match3DWorksListInput {
owner_user_id,
published_only: false,
})
.await
}
pub async fn list_match3d_gallery(
&self,
) -> Result<Vec<Match3DWorkProfileRecord>, SpacetimeClientError> {
self.list_match3d_works_with_input(Match3DWorksListInput {
// 中文注释:公开广场读取只依赖 published_onlyowner_user_id 保持非空便于兼容校验。
owner_user_id: "match3d-public-gallery".to_string(),
published_only: true,
})
.await
}
async fn list_match3d_works_with_input(
&self,
procedure_input: Match3DWorksListInput,
) -> Result<Vec<Match3DWorkProfileRecord>, SpacetimeClientError> {
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.list_match_3_d_works_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_works_procedure_result);
send_once(&sender, mapped);
});
})
.await
}
pub async fn get_match3d_work_detail(
&self,
profile_id: String,
owner_user_id: String,
) -> Result<Match3DWorkProfileRecord, SpacetimeClientError> {
let procedure_input = Match3DWorkGetInput {
profile_id,
owner_user_id,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().get_match_3_d_work_detail_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_work_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn delete_match3d_work(
&self,
profile_id: String,
owner_user_id: String,
) -> Result<Vec<Match3DWorkProfileRecord>, SpacetimeClientError> {
let procedure_input = Match3DWorkDeleteInput {
profile_id,
owner_user_id,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().delete_match_3_d_work_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_works_procedure_result);
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn start_match3d_run(
&self,
input: Match3DRunStartRecordInput,
) -> Result<Match3DRunRecord, SpacetimeClientError> {
let owner_user_id = input.owner_user_id.clone();
let procedure_input = Match3DRunStartInput {
run_id: input.run_id,
owner_user_id: input.owner_user_id,
profile_id: input.profile_id,
started_at_ms: input.started_at_ms,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().start_match_3_d_run_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_run_procedure_result)
.map(|mut run| {
run.owner_user_id = owner_user_id;
run
});
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn get_match3d_run(
&self,
run_id: String,
owner_user_id: String,
) -> Result<Match3DRunRecord, SpacetimeClientError> {
let procedure_owner_user_id = owner_user_id.clone();
let procedure_input = Match3DRunGetInput { run_id, owner_user_id };
self.call_after_connect(move |connection, sender| {
connection.procedures().get_match_3_d_run_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_run_procedure_result)
.map(|mut run| {
run.owner_user_id = procedure_owner_user_id;
run
});
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn click_match3d_item(
&self,
input: Match3DRunClickRecordInput,
) -> Result<Match3DClickConfirmationRecord, SpacetimeClientError> {
let owner_user_id = input.owner_user_id.clone();
let client_event_id = input.client_event_id.clone();
let procedure_input = Match3DRunClickInput {
run_id: input.run_id,
owner_user_id: input.owner_user_id,
item_instance_id: input.item_instance_id,
client_snapshot_version: input.client_snapshot_version,
client_event_id: input.client_event_id,
clicked_at_ms: input.clicked_at_ms,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().click_match_3_d_item_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_click_item_procedure_result)
.map(|mut confirmation| {
confirmation.run.owner_user_id = owner_user_id;
if confirmation.accepted {
confirmation.run.last_confirmed_action_id = Some(client_event_id);
}
confirmation
});
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn stop_match3d_run(
&self,
input: Match3DRunStopRecordInput,
) -> Result<Match3DRunRecord, SpacetimeClientError> {
let owner_user_id = input.owner_user_id.clone();
let procedure_input = Match3DRunStopInput {
run_id: input.run_id,
owner_user_id: input.owner_user_id,
stopped_at_ms: input.stopped_at_ms,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().stop_match_3_d_run_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_run_procedure_result)
.map(|mut run| {
run.owner_user_id = owner_user_id;
run
});
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn restart_match3d_run(
&self,
input: Match3DRunRestartRecordInput,
) -> Result<Match3DRunRecord, SpacetimeClientError> {
let owner_user_id = input.owner_user_id.clone();
let procedure_input = Match3DRunRestartInput {
source_run_id: input.source_run_id,
next_run_id: input.next_run_id,
owner_user_id: input.owner_user_id,
restarted_at_ms: input.restarted_at_ms,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().restart_match_3_d_run_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_run_procedure_result)
.map(|mut run| {
run.owner_user_id = owner_user_id;
run
});
send_once(&sender, mapped);
},
);
})
.await
}
pub async fn finish_match3d_time_up(
&self,
input: Match3DRunTimeUpRecordInput,
) -> Result<Match3DRunRecord, SpacetimeClientError> {
let owner_user_id = input.owner_user_id.clone();
let procedure_input = Match3DRunTimeUpInput {
run_id: input.run_id,
owner_user_id: input.owner_user_id,
finished_at_ms: input.finished_at_ms,
};
self.call_after_connect(move |connection, sender| {
connection.procedures().finish_match_3_d_time_up_then(
procedure_input,
move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_match3d_run_procedure_result)
.map(|mut run| {
run.owner_user_id = owner_user_id;
run
});
send_once(&sender, mapped);
},
);
})
.await
}
}