1
This commit is contained in:
@@ -462,4 +462,32 @@ impl SpacetimeClient {
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn submit_puzzle_leaderboard_entry(
|
||||
&self,
|
||||
input: PuzzleLeaderboardSubmitRecordInput,
|
||||
) -> Result<PuzzleRunRecord, SpacetimeClientError> {
|
||||
let procedure_input = PuzzleLeaderboardSubmitInput {
|
||||
run_id: input.run_id,
|
||||
owner_user_id: input.owner_user_id,
|
||||
profile_id: input.profile_id,
|
||||
grid_size: input.grid_size,
|
||||
elapsed_ms: input.elapsed_ms,
|
||||
nickname: input.nickname,
|
||||
submitted_at_micros: input.submitted_at_micros,
|
||||
};
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection.procedures().submit_puzzle_leaderboard_entry_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
|
||||
.and_then(map_puzzle_run_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
})
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user