clerk_rs/models/
create_invitation_request.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 CreateInvitationRequest {
13	/// The email address the invitation will be sent to
14	#[serde(rename = "email_address")]
15	pub email_address: String,
16	/// Metadata that will be attached to the newly created invitation. The value of this property should be a well-formed JSON object. Once the user accepts the invitation and signs up, these metadata will end up in the user's public metadata.
17	#[serde(rename = "public_metadata", skip_serializing_if = "Option::is_none")]
18	pub public_metadata: Option<serde_json::Value>,
19	/// Optional URL which specifies where to redirect the user once they click the invitation link. This is only required if you have implemented a [custom flow](https://clerk.com/docs/authentication/invitations#custom-flow) and you're not using Clerk Hosted Pages or Clerk Components.
20	#[serde(rename = "redirect_url", skip_serializing_if = "Option::is_none")]
21	pub redirect_url: Option<String>,
22	/// Optional flag which denotes whether an email invitation should be sent to the given email address. Defaults to true.
23	#[serde(
24		rename = "notify",
25		default,
26		with = "::serde_with::rust::double_option",
27		skip_serializing_if = "Option::is_none"
28	)]
29	pub notify: Option<Option<bool>>,
30	/// Whether an invitation should be created if there is already an existing invitation for this email address, or it's claimed by another user.
31	#[serde(
32		rename = "ignore_existing",
33		default,
34		with = "::serde_with::rust::double_option",
35		skip_serializing_if = "Option::is_none"
36	)]
37	pub ignore_existing: Option<Option<bool>>,
38}
39
40impl CreateInvitationRequest {
41	pub fn new(email_address: String) -> CreateInvitationRequest {
42		CreateInvitationRequest {
43			email_address,
44			public_metadata: None,
45			redirect_url: None,
46			notify: None,
47			ignore_existing: None,
48		}
49	}
50}