clerk_fapi_rs/models/
client_session_base.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 ClientSessionBase {
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}
51
52impl ClientSessionBase {
53    pub fn new(
54        id: String,
55        object: Object,
56        status: Status,
57        expire_at: i64,
58        abandon_at: i64,
59        last_active_at: i64,
60    ) -> ClientSessionBase {
61        ClientSessionBase {
62            id,
63            object,
64            status,
65            expire_at,
66            abandon_at,
67            last_active_at,
68            last_active_token: None,
69            actor: None,
70            tasks: None,
71        }
72    }
73}
74/// String representing the object's type. Objects of the same type share the same value.
75#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
76pub enum Object {
77    #[serde(rename = "session")]
78    Session,
79}
80
81impl Default for Object {
82    fn default() -> Object {
83        Self::Session
84    }
85}
86
87#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
88pub enum Status {
89    #[serde(rename = "active")]
90    Active,
91    #[serde(rename = "revoked")]
92    Revoked,
93    #[serde(rename = "ended")]
94    Ended,
95    #[serde(rename = "expired")]
96    Expired,
97    #[serde(rename = "removed")]
98    Removed,
99    #[serde(rename = "abandoned")]
100    Abandoned,
101    #[serde(rename = "pending")]
102    Pending,
103}
104
105impl Default for Status {
106    fn default() -> Status {
107        Self::Active
108    }
109}