clerk_rs/models/
invitation.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 Invitation {
13	#[serde(rename = "object")]
14	pub object: Object,
15	#[serde(rename = "id")]
16	pub id: String,
17	#[serde(rename = "email_address")]
18	pub email_address: String,
19	#[serde(rename = "public_metadata", skip_serializing_if = "Option::is_none")]
20	pub public_metadata: Option<serde_json::Value>,
21	#[serde(rename = "revoked", skip_serializing_if = "Option::is_none")]
22	pub revoked: Option<bool>,
23	#[serde(rename = "status")]
24	pub status: Status,
25	#[serde(
26		rename = "url",
27		default,
28		with = "::serde_with::rust::double_option",
29		skip_serializing_if = "Option::is_none"
30	)]
31	pub url: Option<Option<String>>,
32	/// Unix timestamp of creation.
33	#[serde(rename = "created_at")]
34	pub created_at: i64,
35	/// Unix timestamp of last update.
36	#[serde(rename = "updated_at")]
37	pub updated_at: i64,
38}
39
40impl Invitation {
41	pub fn new(object: Object, id: String, email_address: String, status: Status, created_at: i64, updated_at: i64) -> Invitation {
42		Invitation {
43			object,
44			id,
45			email_address,
46			public_metadata: None,
47			revoked: None,
48			status,
49			url: None,
50			created_at,
51			updated_at,
52		}
53	}
54}
55
56///
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
58pub enum Object {
59	#[serde(rename = "invitation")]
60	Invitation,
61}
62
63impl Default for Object {
64	fn default() -> Object {
65		Self::Invitation
66	}
67}
68///
69#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
70pub enum Status {
71	#[serde(rename = "pending")]
72	Pending,
73	#[serde(rename = "accepted")]
74	Accepted,
75	#[serde(rename = "revoked")]
76	Revoked,
77}
78
79impl Default for Status {
80	fn default() -> Status {
81		Self::Pending
82	}
83}