modio/types/
auth.rs

1use serde_derive::Deserialize;
2use url::Url;
3
4use super::{utils, Timestamp};
5
6/// See the [Access Token Object](https://docs.mod.io/restapiref/#access-token-object) docs for more
7/// information.
8#[derive(Deserialize)]
9#[non_exhaustive]
10pub struct AccessToken {
11    #[serde(rename = "access_token")]
12    pub value: String,
13    #[serde(rename = "date_expires")]
14    pub expired_at: Option<Timestamp>,
15}
16
17/// See the [Terms Object](https://docs.mod.io/restapiref/#terms-object) docs for more information.
18#[derive(Debug, Deserialize)]
19#[non_exhaustive]
20pub struct Terms {
21    pub plaintext: String,
22    pub html: String,
23    pub links: Links,
24}
25
26/// Part of [`Terms`]
27///
28/// See the [Terms Object](https://docs.mod.io/restapiref/#terms-object) docs for more information.
29#[derive(Debug, Deserialize)]
30#[non_exhaustive]
31pub struct Links {
32    pub website: Link,
33    pub terms: Link,
34    pub privacy: Link,
35    pub manage: Link,
36}
37
38/// Part of [`Terms`]
39///
40/// See the [Terms Object](https://docs.mod.io/restapiref/#terms-object) docs for more information.
41#[derive(Debug, Deserialize)]
42#[non_exhaustive]
43pub struct Link {
44    pub text: String,
45    #[serde(with = "utils::url")]
46    pub url: Url,
47    pub required: bool,
48}