/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
*
* The version of the OpenAPI document: 1.104.0
* 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 PurchaseWhatsAppPhoneNumberRequest {
/// 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/whatsapp/phone-numbers/countries.
#[serde(rename = "country", skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
/// One exact number to buy, in E.164, taken from GET /v1/phone-numbers/available. Fails with 409 code PHONE_NUMBER_UNAVAILABLE when it is no longer available.
#[serde(rename = "phoneNumber", skip_serializing_if = "Option::is_none")]
pub phone_number: Option<String>,
/// 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 PurchaseWhatsAppPhoneNumberRequest {
pub fn new(profile_id: String) -> PurchaseWhatsAppPhoneNumberRequest {
PurchaseWhatsAppPhoneNumberRequest {
profile_id,
country: None,
phone_number: None,
purchase_intent_id: None,
allow_multiple: None,
}
}
}