clerk_rs/models/
session.rs

1/*
2 * Clerk Backend API
3 *
4 * The Clerk REST Backend API, meant to be accessed by backend servers. 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
11#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12pub struct Session {
13	/// String representing the object's type. Objects of the same type share the same value.
14	#[serde(rename = "object")]
15	pub object: Object,
16	#[serde(rename = "id")]
17	pub id: String,
18	#[serde(rename = "user_id")]
19	pub user_id: String,
20	#[serde(rename = "client_id")]
21	pub client_id: String,
22	#[serde(rename = "actor", skip_serializing_if = "Option::is_none")]
23	pub actor: Option<serde_json::Value>,
24	#[serde(rename = "status")]
25	pub status: Status,
26	#[serde(rename = "last_active_organization_id", skip_serializing_if = "Option::is_none")]
27	pub last_active_organization_id: Option<String>,
28	#[serde(rename = "last_active_at")]
29	pub last_active_at: i64,
30	#[serde(rename = "expire_at")]
31	pub expire_at: i64,
32	#[serde(rename = "abandon_at")]
33	pub abandon_at: i64,
34	/// Unix timestamp of last update.
35	#[serde(rename = "updated_at")]
36	pub updated_at: i64,
37	/// Unix timestamp of creation.
38	#[serde(rename = "created_at")]
39	pub created_at: i64,
40}
41
42impl Session {
43	pub fn new(
44		object: Object,
45		id: String,
46		user_id: String,
47		client_id: String,
48		status: Status,
49		last_active_at: i64,
50		expire_at: i64,
51		abandon_at: i64,
52		updated_at: i64,
53		created_at: i64,
54	) -> Session {
55		Session {
56			object,
57			id,
58			user_id,
59			client_id,
60			actor: None,
61			status,
62			last_active_organization_id: None,
63			last_active_at,
64			expire_at,
65			abandon_at,
66			updated_at,
67			created_at,
68		}
69	}
70}
71
72/// String representing the object's type. Objects of the same type share the same value.
73#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
74pub enum Object {
75	#[serde(rename = "session")]
76	Session,
77}
78
79impl Default for Object {
80	fn default() -> Object {
81		Self::Session
82	}
83}
84///
85#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
86pub enum Status {
87	#[serde(rename = "active")]
88	Active,
89	#[serde(rename = "revoked")]
90	Revoked,
91	#[serde(rename = "ended")]
92	Ended,
93	#[serde(rename = "expired")]
94	Expired,
95	#[serde(rename = "removed")]
96	Removed,
97	#[serde(rename = "abandoned")]
98	Abandoned,
99	#[serde(rename = "replaced")]
100	Replaced,
101}
102
103impl Default for Status {
104	fn default() -> Status {
105		Self::Active
106	}
107}