clerk_fapi_rs/models/
client_display_config.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 ClientDisplayConfig {
16    #[serde(rename = "object")]
17    pub object: Object,
18    #[serde(rename = "id")]
19    pub id: String,
20    #[serde(rename = "instance_environment_type")]
21    pub instance_environment_type: InstanceEnvironmentType,
22    #[serde(rename = "application_name")]
23    pub application_name: String,
24    #[serde(rename = "theme")]
25    pub theme: serde_json::Value,
26    #[serde(rename = "preferred_sign_in_strategy")]
27    pub preferred_sign_in_strategy: PreferredSignInStrategy,
28    #[serde(
29        rename = "logo_image_url",
30        default,
31        with = "::serde_with::rust::double_option",
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub logo_image_url: Option<Option<String>>,
35    #[serde(
36        rename = "favicon_image_url",
37        default,
38        with = "::serde_with::rust::double_option",
39        skip_serializing_if = "Option::is_none"
40    )]
41    pub favicon_image_url: Option<Option<String>>,
42    #[serde(rename = "home_url")]
43    pub home_url: String,
44    #[serde(rename = "sign_in_url")]
45    pub sign_in_url: String,
46    #[serde(rename = "sign_up_url")]
47    pub sign_up_url: String,
48    #[serde(rename = "user_profile_url")]
49    pub user_profile_url: String,
50    #[serde(rename = "waitlist_url")]
51    pub waitlist_url: String,
52    #[serde(rename = "after_sign_in_url")]
53    pub after_sign_in_url: String,
54    #[serde(rename = "after_sign_up_url")]
55    pub after_sign_up_url: String,
56    #[serde(rename = "after_sign_out_one_url")]
57    pub after_sign_out_one_url: String,
58    #[serde(rename = "after_sign_out_all_url")]
59    pub after_sign_out_all_url: String,
60    #[serde(rename = "after_switch_session_url")]
61    pub after_switch_session_url: String,
62    #[serde(rename = "after_join_waitlist_url")]
63    pub after_join_waitlist_url: String,
64    #[serde(rename = "organization_profile_url")]
65    pub organization_profile_url: String,
66    #[serde(rename = "create_organization_url")]
67    pub create_organization_url: String,
68    #[serde(rename = "after_leave_organization_url")]
69    pub after_leave_organization_url: String,
70    #[serde(rename = "after_create_organization_url")]
71    pub after_create_organization_url: String,
72    #[serde(rename = "logo_link_url")]
73    pub logo_link_url: String,
74    #[serde(rename = "support_email", deserialize_with = "Option::deserialize")]
75    pub support_email: Option<String>,
76    #[serde(rename = "branded")]
77    pub branded: bool,
78    #[serde(rename = "experimental_force_oauth_first")]
79    pub experimental_force_oauth_first: bool,
80    #[serde(rename = "clerk_js_version", deserialize_with = "Option::deserialize")]
81    pub clerk_js_version: Option<String>,
82    #[serde(rename = "show_devmode_warning")]
83    pub show_devmode_warning: bool,
84    #[serde(
85        rename = "google_one_tap_client_id",
86        deserialize_with = "Option::deserialize"
87    )]
88    pub google_one_tap_client_id: Option<String>,
89    #[serde(rename = "help_url", deserialize_with = "Option::deserialize")]
90    pub help_url: Option<String>,
91    #[serde(
92        rename = "privacy_policy_url",
93        deserialize_with = "Option::deserialize"
94    )]
95    pub privacy_policy_url: Option<String>,
96    #[serde(rename = "terms_url", deserialize_with = "Option::deserialize")]
97    pub terms_url: Option<String>,
98    /// Use `logo_image_url` instead
99    #[serde(rename = "logo_url", deserialize_with = "Option::deserialize")]
100    pub logo_url: Option<String>,
101    /// Use `favicon_image_url` instead
102    #[serde(rename = "favicon_url", deserialize_with = "Option::deserialize")]
103    pub favicon_url: Option<String>,
104    /// Use `logo_image_url` instead
105    #[serde(rename = "logo_image", deserialize_with = "Option::deserialize")]
106    pub logo_image: Option<Box<models::Image>>,
107    /// Use `favicon_image_url` instead
108    #[serde(rename = "favicon_image", deserialize_with = "Option::deserialize")]
109    pub favicon_image: Option<Box<models::Image>>,
110    #[serde(
111        rename = "captcha_public_key",
112        deserialize_with = "Option::deserialize"
113    )]
114    pub captcha_public_key: Option<String>,
115    #[serde(
116        rename = "captcha_widget_type",
117        deserialize_with = "Option::deserialize"
118    )]
119    pub captcha_widget_type: Option<CaptchaWidgetType>,
120    #[serde(
121        rename = "captcha_public_key_invisible",
122        deserialize_with = "Option::deserialize"
123    )]
124    pub captcha_public_key_invisible: Option<String>,
125    #[serde(rename = "captcha_provider", deserialize_with = "Option::deserialize")]
126    pub captcha_provider: Option<CaptchaProvider>,
127    #[serde(rename = "captcha_oauth_bypass")]
128    pub captcha_oauth_bypass: Vec<String>,
129    #[serde(
130        rename = "captcha_heartbeat",
131        default,
132        with = "::serde_with::rust::double_option",
133        skip_serializing_if = "Option::is_none"
134    )]
135    pub captcha_heartbeat: Option<Option<bool>>,
136}
137
138impl ClientDisplayConfig {
139    pub fn new(
140        object: Object,
141        id: String,
142        instance_environment_type: InstanceEnvironmentType,
143        application_name: String,
144        theme: serde_json::Value,
145        preferred_sign_in_strategy: PreferredSignInStrategy,
146        home_url: String,
147        sign_in_url: String,
148        sign_up_url: String,
149        user_profile_url: String,
150        waitlist_url: String,
151        after_sign_in_url: String,
152        after_sign_up_url: String,
153        after_sign_out_one_url: String,
154        after_sign_out_all_url: String,
155        after_switch_session_url: String,
156        after_join_waitlist_url: String,
157        organization_profile_url: String,
158        create_organization_url: String,
159        after_leave_organization_url: String,
160        after_create_organization_url: String,
161        logo_link_url: String,
162        support_email: Option<String>,
163        branded: bool,
164        experimental_force_oauth_first: bool,
165        clerk_js_version: Option<String>,
166        show_devmode_warning: bool,
167        google_one_tap_client_id: Option<String>,
168        help_url: Option<String>,
169        privacy_policy_url: Option<String>,
170        terms_url: Option<String>,
171        logo_url: Option<String>,
172        favicon_url: Option<String>,
173        logo_image: Option<models::Image>,
174        favicon_image: Option<models::Image>,
175        captcha_public_key: Option<String>,
176        captcha_widget_type: Option<CaptchaWidgetType>,
177        captcha_public_key_invisible: Option<String>,
178        captcha_provider: Option<CaptchaProvider>,
179        captcha_oauth_bypass: Vec<String>,
180    ) -> ClientDisplayConfig {
181        ClientDisplayConfig {
182            object,
183            id,
184            instance_environment_type,
185            application_name,
186            theme,
187            preferred_sign_in_strategy,
188            logo_image_url: None,
189            favicon_image_url: None,
190            home_url,
191            sign_in_url,
192            sign_up_url,
193            user_profile_url,
194            waitlist_url,
195            after_sign_in_url,
196            after_sign_up_url,
197            after_sign_out_one_url,
198            after_sign_out_all_url,
199            after_switch_session_url,
200            after_join_waitlist_url,
201            organization_profile_url,
202            create_organization_url,
203            after_leave_organization_url,
204            after_create_organization_url,
205            logo_link_url,
206            support_email,
207            branded,
208            experimental_force_oauth_first,
209            clerk_js_version,
210            show_devmode_warning,
211            google_one_tap_client_id,
212            help_url,
213            privacy_policy_url,
214            terms_url,
215            logo_url,
216            favicon_url,
217            logo_image: logo_image.map(Box::new),
218            favicon_image: favicon_image.map(Box::new),
219            captcha_public_key,
220            captcha_widget_type,
221            captcha_public_key_invisible,
222            captcha_provider,
223            captcha_oauth_bypass,
224            captcha_heartbeat: None,
225        }
226    }
227}
228
229#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
230pub enum Object {
231    #[serde(rename = "display_config")]
232    DisplayConfig,
233}
234
235impl Default for Object {
236    fn default() -> Object {
237        Self::DisplayConfig
238    }
239}
240
241#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
242pub enum InstanceEnvironmentType {
243    #[serde(rename = "production")]
244    Production,
245    #[serde(rename = "development")]
246    Development,
247    #[serde(rename = "staging")]
248    Staging,
249}
250
251impl Default for InstanceEnvironmentType {
252    fn default() -> InstanceEnvironmentType {
253        Self::Production
254    }
255}
256
257#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
258pub enum PreferredSignInStrategy {
259    #[serde(rename = "password")]
260    Password,
261    #[serde(rename = "otp")]
262    Otp,
263}
264
265impl Default for PreferredSignInStrategy {
266    fn default() -> PreferredSignInStrategy {
267        Self::Password
268    }
269}
270
271#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
272pub enum CaptchaWidgetType {
273    #[serde(rename = "smart")]
274    Smart,
275    #[serde(rename = "invisible")]
276    Invisible,
277}
278
279impl Default for CaptchaWidgetType {
280    fn default() -> CaptchaWidgetType {
281        Self::Smart
282    }
283}
284
285#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
286pub enum CaptchaProvider {
287    #[serde(rename = "turnstile")]
288    Turnstile,
289}
290
291impl Default for CaptchaProvider {
292    fn default() -> CaptchaProvider {
293        Self::Turnstile
294    }
295}