1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
*
* The version of the OpenAPI document: 1.0.4
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// WhatsAppSandboxSession : A per-user activation session against the shared WhatsApp sandbox number. Transitions `pending → active` when the inbound webhook receives a reply from the matching phone (the reply itself proves ownership).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WhatsAppSandboxSession {
/// Session id. Use this to revoke via DELETE.
#[serde(rename = "id")]
pub id: String,
/// Digits-only E.164 form (no +, spaces, or dashes).
#[serde(rename = "phoneE164")]
pub phone_e164: String,
/// `pending` until the phone replies to the activation template, then `active`. Expired sessions are pruned by TTL and never appear in list responses.
#[serde(rename = "status")]
pub status: Status,
/// UTC timestamp at which the session becomes invalid. Pending sessions get a 24h window; activated sessions get 7 days.
#[serde(rename = "expiresAt")]
pub expires_at: String,
/// When the session transitioned `pending → active`, or null.
#[serde(rename = "activatedAt", skip_serializing_if = "Option::is_none")]
pub activated_at: Option<String>,
#[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
pub created_at: Option<String>,
}
impl WhatsAppSandboxSession {
/// A per-user activation session against the shared WhatsApp sandbox number. Transitions `pending → active` when the inbound webhook receives a reply from the matching phone (the reply itself proves ownership).
pub fn new(
id: String,
phone_e164: String,
status: Status,
expires_at: String,
) -> WhatsAppSandboxSession {
WhatsAppSandboxSession {
id,
phone_e164,
status,
expires_at,
activated_at: None,
created_at: None,
}
}
}
/// `pending` until the phone replies to the activation template, then `active`. Expired sessions are pruned by TTL and never appear in list responses.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "pending")]
Pending,
#[serde(rename = "active")]
Active,
}
impl Default for Status {
fn default() -> Status {
Self::Pending
}
}