clerk_fapi_rs/models/
client_sign_up.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 ClientSignUp {
16    /// String representing the object's type. Objects of the same type share the same value.
17    #[serde(rename = "object")]
18    pub object: Object,
19    /// Unique identifier for this sign up.
20    #[serde(rename = "id")]
21    pub id: String,
22    #[serde(rename = "status")]
23    pub status: Status,
24    /// List of required fields which need to be supplied to the current sign-up. These fields are mandatory in order for the sign-up to satisfy the attached registration policy and be marked as complete.
25    #[serde(rename = "required_fields")]
26    pub required_fields: Vec<String>,
27    /// List of optional fields which can be supplied to the current sign-up. These fields are not required and their absence does not prevent the sign-up to be marked as complete.
28    #[serde(rename = "optional_fields")]
29    pub optional_fields: Vec<String>,
30    /// List of the missing fields which still need to be supplied to the current sign-up. These fields are mandatory in order for the sign-up to satisfy the attached registration policy and be marked as complete.
31    #[serde(rename = "missing_fields")]
32    pub missing_fields: Vec<String>,
33    /// List of fields which are already supplied to the current sign-up but they need to be verified. Example of such fields are email addresses and phone numbers.
34    #[serde(rename = "unverified_fields")]
35    pub unverified_fields: Vec<String>,
36    /// Group for all available verifications.
37    #[serde(rename = "verifications")]
38    pub verifications: Box<models::ClientSignUpVerifications>,
39    #[serde(rename = "username", deserialize_with = "Option::deserialize")]
40    pub username: Option<String>,
41    #[serde(rename = "email_address", deserialize_with = "Option::deserialize")]
42    pub email_address: Option<String>,
43    #[serde(rename = "phone_number", deserialize_with = "Option::deserialize")]
44    pub phone_number: Option<String>,
45    #[serde(rename = "web3_wallet", deserialize_with = "Option::deserialize")]
46    pub web3_wallet: Option<String>,
47    #[serde(rename = "password_enabled")]
48    pub password_enabled: bool,
49    #[serde(rename = "first_name", deserialize_with = "Option::deserialize")]
50    pub first_name: Option<String>,
51    #[serde(rename = "last_name", deserialize_with = "Option::deserialize")]
52    pub last_name: Option<String>,
53    /// Custom JSON that callers can use to store arbitrary values that make sense in the context of the current sign up.
54    #[serde(rename = "unsafe_metadata", skip_serializing_if = "Option::is_none")]
55    pub unsafe_metadata: Option<std::collections::HashMap<String, serde_json::Value>>,
56    /// Custom JSON that can be used to store arbitrary values which will end up in the user's public metadata. This field can only be populated from the application's BE. At this point, this can be done via invitations.
57    #[serde(rename = "public_metadata", skip_serializing_if = "Option::is_none")]
58    pub public_metadata: Option<std::collections::HashMap<String, serde_json::Value>>,
59    #[serde(rename = "custom_action")]
60    pub custom_action: bool,
61    #[serde(rename = "external_id", deserialize_with = "Option::deserialize")]
62    pub external_id: Option<String>,
63    #[serde(
64        rename = "created_session_id",
65        deserialize_with = "Option::deserialize"
66    )]
67    pub created_session_id: Option<String>,
68    #[serde(rename = "created_user_id", deserialize_with = "Option::deserialize")]
69    pub created_user_id: Option<String>,
70    /// Unix timestamp at which the sign up will be abandoned.
71    #[serde(rename = "abandon_at")]
72    pub abandon_at: i64,
73    /// Unix timestamp at which the user accepted the legal requirements.
74    #[serde(rename = "legal_accepted_at", deserialize_with = "Option::deserialize")]
75    pub legal_accepted_at: Option<i64>,
76}
77
78impl ClientSignUp {
79    pub fn new(
80        object: Object,
81        id: String,
82        status: Status,
83        required_fields: Vec<String>,
84        optional_fields: Vec<String>,
85        missing_fields: Vec<String>,
86        unverified_fields: Vec<String>,
87        verifications: models::ClientSignUpVerifications,
88        username: Option<String>,
89        email_address: Option<String>,
90        phone_number: Option<String>,
91        web3_wallet: Option<String>,
92        password_enabled: bool,
93        first_name: Option<String>,
94        last_name: Option<String>,
95        custom_action: bool,
96        external_id: Option<String>,
97        created_session_id: Option<String>,
98        created_user_id: Option<String>,
99        abandon_at: i64,
100        legal_accepted_at: Option<i64>,
101    ) -> ClientSignUp {
102        ClientSignUp {
103            object,
104            id,
105            status,
106            required_fields,
107            optional_fields,
108            missing_fields,
109            unverified_fields,
110            verifications: Box::new(verifications),
111            username,
112            email_address,
113            phone_number,
114            web3_wallet,
115            password_enabled,
116            first_name,
117            last_name,
118            unsafe_metadata: None,
119            public_metadata: None,
120            custom_action,
121            external_id,
122            created_session_id,
123            created_user_id,
124            abandon_at,
125            legal_accepted_at,
126        }
127    }
128}
129/// String representing the object's type. Objects of the same type share the same value.
130#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
131pub enum Object {
132    #[serde(rename = "sign_up_attempt")]
133    SignUpAttempt,
134}
135
136impl Default for Object {
137    fn default() -> Object {
138        Self::SignUpAttempt
139    }
140}
141
142#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
143pub enum Status {
144    #[serde(rename = "abandoned")]
145    Abandoned,
146    #[serde(rename = "missing_requirements")]
147    MissingRequirements,
148    #[serde(rename = "complete")]
149    Complete,
150}
151
152impl Default for Status {
153    fn default() -> Status {
154        Self::Abandoned
155    }
156}