This commit is contained in:
2026-04-27 22:50:18 +08:00
parent ded6f6ee2a
commit b6c6640548
77 changed files with 5240 additions and 833 deletions

View File

@@ -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
}
}