clerk_rs/models/
organization_settings.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 OrganizationSettings {
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 = "enabled")]
17	pub enabled: bool,
18	#[serde(rename = "max_allowed_memberships")]
19	pub max_allowed_memberships: i64,
20	#[serde(rename = "max_allowed_roles", skip_serializing_if = "Option::is_none")]
21	pub max_allowed_roles: Option<i64>,
22	#[serde(rename = "max_allowed_permissions", skip_serializing_if = "Option::is_none")]
23	pub max_allowed_permissions: Option<i64>,
24	/// The role key that a user will be assigned after creating an organization.
25	#[serde(rename = "creator_role")]
26	pub creator_role: String,
27	/// The default for whether an admin can delete an organization with the Frontend API.
28	#[serde(rename = "admin_delete_enabled")]
29	pub admin_delete_enabled: bool,
30	#[serde(rename = "domains_enabled")]
31	pub domains_enabled: bool,
32	#[serde(rename = "domains_enrollment_modes")]
33	pub domains_enrollment_modes: Vec<DomainsEnrollmentModes>,
34	/// The role key that it will be used in order to create an organization invitation or suggestion.
35	#[serde(rename = "domains_default_role")]
36	pub domains_default_role: String,
37}
38
39impl OrganizationSettings {
40	pub fn new(
41		object: Object,
42		enabled: bool,
43		max_allowed_memberships: i64,
44		creator_role: String,
45		admin_delete_enabled: bool,
46		domains_enabled: bool,
47		domains_enrollment_modes: Vec<DomainsEnrollmentModes>,
48		domains_default_role: String,
49	) -> OrganizationSettings {
50		OrganizationSettings {
51			object,
52			enabled,
53			max_allowed_memberships,
54			max_allowed_roles: None,
55			max_allowed_permissions: None,
56			creator_role,
57			admin_delete_enabled,
58			domains_enabled,
59			domains_enrollment_modes,
60			domains_default_role,
61		}
62	}
63}
64
65/// String representing the object's type. Objects of the same type share the same value.
66#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
67pub enum Object {
68	#[serde(rename = "organization_settings")]
69	OrganizationSettings,
70}
71
72impl Default for Object {
73	fn default() -> Object {
74		Self::OrganizationSettings
75	}
76}
77///
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
79pub enum DomainsEnrollmentModes {
80	#[serde(rename = "manual_invitation")]
81	ManualInvitation,
82	#[serde(rename = "automatic_invitation")]
83	AutomaticInvitation,
84	#[serde(rename = "automatic_suggestion")]
85	AutomaticSuggestion,
86}
87
88impl Default for DomainsEnrollmentModes {
89	fn default() -> DomainsEnrollmentModes {
90		Self::ManualInvitation
91	}
92}