clerk_rs/models/create_actor_token_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 CreateActorTokenRequest {
13 /// The ID of the user that can use the newly created sign in token.
14 #[serde(rename = "user_id")]
15 pub user_id: String,
16 /// The actor payload. It needs to include a sub property which should contain the ID of the actor. This whole payload will be also included in the JWT session token.
17 #[serde(rename = "actor")]
18 pub actor: serde_json::Value,
19 /// Optional parameter to specify the life duration of the actor token in seconds. By default, the duration is 1 hour.
20 #[serde(rename = "expires_in_seconds", skip_serializing_if = "Option::is_none")]
21 pub expires_in_seconds: Option<i64>,
22 /// The maximum duration that the session which will be created by the generated actor token should last. By default, the duration of a session created via an actor token, lasts 30 minutes.
23 #[serde(rename = "session_max_duration_in_seconds", skip_serializing_if = "Option::is_none")]
24 pub session_max_duration_in_seconds: Option<i64>,
25}
26
27impl CreateActorTokenRequest {
28 pub fn new(user_id: String, actor: serde_json::Value) -> CreateActorTokenRequest {
29 CreateActorTokenRequest {
30 user_id,
31 actor,
32 expires_in_seconds: None,
33 session_max_duration_in_seconds: None,
34 }
35 }
36}