clerk_fapi_rs/models/
client_active_session.rs

1/*
2 * Clerk Frontend API
3 *
4 * The Clerk REST Frontend API, meant to be accessed from a browser or native environment.  This is a Form Based API and all the data must be sent and formatted according to the `application/x-www-form-urlencoded` content type.  ### Versions  When the API changes in a way that isn't compatible with older versions, a new version is released. Each version is identified by its release date, e.g. `2021-02-05`. For more information, please see [Clerk API Versions](https://clerk.com/docs/backend-requests/versioning/overview).  ### Using the Try It Console  The `Try It` feature of the docs only works for **Development Instances** when using the `DevBrowser` security scheme. To use it, first generate a dev instance token from the `/v1/dev_browser` endpoint.  Please see https://clerk.com/docs for more information.
5 *
6 * The version of the OpenAPI document: v1
7 * Contact: support@clerk.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct ClientActiveSession {
16    #[serde(rename = "id")]
17    pub id: String,
18    /// String representing the object's type. Objects of the same type share the same value.
19    #[serde(rename = "object")]
20    pub object: Object,
21    #[serde(rename = "status")]
22    pub status: Status,
23    #[serde(rename = "expire_at")]
24    pub expire_at: i64,
25    #[serde(rename = "abandon_at")]
26    pub abandon_at: i64,
27    #[serde(rename = "last_active_at")]
28    pub last_active_at: i64,
29    #[serde(
30        rename = "last_active_token",
31        default,
32        with = "::serde_with::rust::double_option",
33        skip_serializing_if = "Option::is_none"
34    )]
35    pub last_active_token: Option<Option<Box<models::Token>>>,
36    #[serde(
37        rename = "actor",
38        default,
39        with = "::serde_with::rust::double_option",
40        skip_serializing_if = "Option::is_none"
41    )]
42    pub actor: Option<Option<std::collections::HashMap<String, serde_json::Value>>>,
43    #[serde(
44        rename = "tasks",
45        default,
46        with = "::serde_with::rust::double_option",
47        skip_serializing_if = "Option::is_none"
48    )]
49    pub tasks: Option<Option<Vec<models::ClientSessionTask>>>,
50    #[serde(rename = "latest_activity", skip_serializing_if = "Option::is_none")]
51    pub latest_activity: Option<Box<models::ClientSessionActivity>>,
52}
53
54impl ClientActiveSession {
55    pub fn new(
56        id: String,
57        object: Object,
58        status: Status,
59        expire_at: i64,
60        abandon_at: i64,
61        last_active_at: i64,
62    ) -> ClientActiveSession {
63        ClientActiveSession {
64            id,
65            object,
66            status,
67            expire_at,
68            abandon_at,
69            last_active_at,
70            last_active_token: None,
71            actor: None,
72            tasks: None,
73            latest_activity: None,
74        }
75    }
76}
77/// String representing the object's type. Objects of the same type share the same value.
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
79pub enum Object {
80    #[serde(rename = "session")]
81    Session,
82}
83
84impl Default for Object {
85    fn default() -> Object {
86        Self::Session
87    }
88}
89
90#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
91pub enum Status {
92    #[serde(rename = "active")]
93    Active,
94    #[serde(rename = "revoked")]
95    Revoked,
96    #[serde(rename = "ended")]
97    Ended,
98    #[serde(rename = "expired")]
99    Expired,
100    #[serde(rename = "removed")]
101    Removed,
102    #[serde(rename = "abandoned")]
103    Abandoned,
104    #[serde(rename = "pending")]
105    Pending,
106}
107
108impl Default for Status {
109    fn default() -> Status {
110        Self::Active
111    }
112}