roblox_api/api/presence/
v1.rs1use serde::{Deserialize, Serialize};
2
3use crate::endpoint;
4
5pub const URL: &str = "https://presence.roblox.com/v1";
6
7#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
8#[serde(rename_all = "camelCase")]
9pub struct UserPresence {
10 #[serde(rename = "userId")]
11 pub id: u64,
12 #[serde(rename = "userPresenceType")]
13 pub kind: u8,
14 #[serde(rename = "lastLocation")]
15 pub status: String,
16
17 pub place_id: Option<u64>,
18 pub root_place_id: Option<u64>,
19 pub universe_id: Option<u64>,
20 #[serde(rename = "gameId")]
21 pub job_id: Option<String>,
22}
23
24endpoint! {
25 presence(ids: &[u64]) -> Vec<UserPresence> {
26 POST "{URL}/presence/users";
27 types {
28 Request<'a> {
29 users("userIds"): &'a [u64],
30 }
31 Response {
32 presences("userPresences"): Vec<UserPresence>,
33 }
34 }
35 body_serialize { Request { users: ids } }
36 map |r: Response| r.presences
37 }
38}