1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use super::*;
|
||||
use crate::mapper::*;
|
||||
use crate::module_bindings::delete_puzzle_work_procedure::delete_puzzle_work;
|
||||
use crate::module_bindings::remix_puzzle_work_procedure::remix_puzzle_work;
|
||||
|
||||
impl SpacetimeClient {
|
||||
pub async fn create_puzzle_agent_session(
|
||||
@@ -340,6 +341,34 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn remix_puzzle_work(
|
||||
&self,
|
||||
input: PuzzleWorkRemixRecordInput,
|
||||
) -> Result<PuzzleAgentSessionRecord, SpacetimeClientError> {
|
||||
let procedure_input = PuzzleWorkRemixInput {
|
||||
source_profile_id: input.source_profile_id,
|
||||
target_owner_user_id: input.target_owner_user_id,
|
||||
target_session_id: input.target_session_id,
|
||||
target_profile_id: input.target_profile_id,
|
||||
target_work_id: input.target_work_id,
|
||||
author_display_name: input.author_display_name,
|
||||
welcome_message_id: input.welcome_message_id,
|
||||
remixed_at_micros: input.remixed_at_micros,
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.remix_puzzle_work_then(procedure_input, move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_puzzle_agent_session_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
});
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn start_puzzle_run(
|
||||
&self,
|
||||
input: PuzzleRunStartRecordInput,
|
||||
|
||||
Reference in New Issue
Block a user