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
/*
* 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};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PurchasePhoneNumberRequest {
/// Profile to associate the number with
#[serde(rename = "profileId")]
pub profile_id: String,
/// ISO 3166-1 alpha-2 country for the number (default US). International numbers require usage-based billing. Tier 3/4 countries return 202 { status: \"kyc_required\", kycUrl } — the customer must complete KYC at that URL before the number is ordered. See GET /v1/phone-numbers/countries.
#[serde(rename = "country", skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
/// A phone number is the unit; WhatsApp is one optional feature. Pass false to buy a STANDALONE number (Calls/SMS only): provisioning skips the Meta pre-verify/OTP steps and the number activates immediately. Omitted defaults to the WhatsApp provisioning path. WhatsApp can be connected to a standalone number later from the connect flow.
#[serde(rename = "connectWhatsapp", skip_serializing_if = "Option::is_none")]
pub connect_whatsapp: Option<bool>,
/// SMS capability is per-number, not per-country. Pass true to provision from the SMS-capable inventory pool so the number can actually text (see also GET /v1/phone-numbers/available with sms=true, and smsAvailable on GET /v1/phone-numbers/countries).
#[serde(rename = "wantsSms", skip_serializing_if = "Option::is_none")]
pub wants_sms: Option<bool>,
/// Optional idempotency key. Send the same value when retrying a purchase: if a number was already bought under this key, the API returns { status: \"already_purchased\", numberId, phoneNumber } instead of provisioning a second number. Generate a fresh key for each genuinely new purchase.
#[serde(rename = "purchaseIntentId", skip_serializing_if = "Option::is_none")]
pub purchase_intent_id: Option<String>,
/// Any second purchase within 10 minutes of a previous one is rejected with 409 code PURCHASE_VELOCITY as duplicate protection. Pass true to confirm the additional purchase is intentional (e.g. bulk provisioning).
#[serde(rename = "allowMultiple", skip_serializing_if = "Option::is_none")]
pub allow_multiple: Option<bool>,
}
impl PurchasePhoneNumberRequest {
pub fn new(profile_id: String) -> PurchasePhoneNumberRequest {
PurchasePhoneNumberRequest {
profile_id,
country: None,
connect_whatsapp: None,
wants_sms: None,
purchase_intent_id: None,
allow_multiple: None,
}
}
}