1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::model::Title;
use serde::{Deserialize, Serialize};

#[derive(Default, Clone, Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GetQuery {
    pub ids: String,
    pub with_game_ids: bool,
}

pub type GetRequest = crate::model::Request<GetQuery>;

impl GetRequest {
    pub fn new(user_ids: Vec<String>, with_game_ids: bool) -> Self {
        Self {
            path: "/api/users/status".to_string(),
            query: Some(GetQuery {
                ids: user_ids.join(","),
                with_game_ids,
            }),
            ..Default::default()
        }
    }
}

#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct User {
    pub id: String,
    pub name: String,
    pub title: Option<Title>,
    pub online: Option<bool>,
    pub playing: Option<bool>,
    pub streaming: Option<bool>,
    pub patron: Option<bool>,
}