/*
* 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.123.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 UpdateWebhookSettingsRequest {
/// Webhook ID to update. Required unless the deprecated `_id` is sent instead.
#[serde(rename = "webhookId", skip_serializing_if = "Option::is_none")]
pub webhook_id: Option<String>,
/// Alias of webhookId, kept for existing callers
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
pub _id: Option<String>,
/// Webhook name (1-50 characters). Must be non-empty if provided.
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Webhook endpoint URL (must be a valid URL, whitespace trimmed). Must be a valid URL if provided.
#[serde(rename = "url", skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
/// Secret key for HMAC-SHA256 signature verification
#[serde(rename = "secret", skip_serializing_if = "Option::is_none")]
pub secret: Option<String>,
/// Events to subscribe to. Must contain at least one event if provided.
#[serde(rename = "events", skip_serializing_if = "Option::is_none")]
pub events: Option<Vec<Events>>,
/// Enable or disable webhook delivery
#[serde(rename = "isActive", skip_serializing_if = "Option::is_none")]
pub is_active: Option<bool>,
/// Custom headers to include in webhook requests
#[serde(rename = "customHeaders", skip_serializing_if = "Option::is_none")]
pub custom_headers: Option<std::collections::HashMap<String, String>>,
/// Replaces the subscription's denylist. Send an empty array to clear it and receive every event in `events` again. Omitting the field leaves the current denylist untouched. Applies to events emitted after the update; already-queued events can still deliver for up to five minutes after they were enqueued. When the caller is a restricted (zrk_) key, that key's own disabled groups are unioned back in either way, so a restricted key can neither clear nor widen a subscription past its own groups.
#[serde(
rename = "disabledResourceGroups",
skip_serializing_if = "Option::is_none"
)]
pub disabled_resource_groups: Option<Vec<DisabledResourceGroups>>,
/// Replaces the subscription's profile allowlist. Send an empty array to receive every profile again. Omitting the field leaves the current list untouched. Every id must be a profile in your team, otherwise the request fails with 404 `profile_not_found` and nothing changes. Applies to events emitted after the update. Sending the stored list back unchanged is accepted without re-validation, so an endpoint stays editable after a listed profile is deleted.
#[serde(rename = "profileIds", skip_serializing_if = "Option::is_none")]
pub profile_ids: Option<Vec<String>>,
/// Replaces the subscription's account allowlist. Send an empty array to receive every account again. Omitting the field leaves the current list untouched. Every id must be an account in your team, otherwise the request fails with 404 `account_not_found` and nothing changes. Sending the stored list back unchanged is accepted without re-validation.
#[serde(rename = "accountIds", skip_serializing_if = "Option::is_none")]
pub account_ids: Option<Vec<String>>,
}
impl UpdateWebhookSettingsRequest {
pub fn new() -> UpdateWebhookSettingsRequest {
UpdateWebhookSettingsRequest {
webhook_id: None,
_id: None,
name: None,
url: None,
secret: None,
events: None,
is_active: None,
custom_headers: None,
disabled_resource_groups: None,
profile_ids: None,
account_ids: None,
}
}
}
/// Events to subscribe to. Must contain at least one event if provided.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Events {
#[serde(rename = "post.scheduled")]
PostScheduled,
#[serde(rename = "post.published")]
PostPublished,
#[serde(rename = "post.failed")]
PostFailed,
#[serde(rename = "post.partial")]
PostPartial,
#[serde(rename = "post.cancelled")]
PostCancelled,
#[serde(rename = "post.recycled")]
PostRecycled,
#[serde(rename = "post.platform.published")]
PostPlatformPublished,
#[serde(rename = "post.platform.failed")]
PostPlatformFailed,
#[serde(rename = "post.platform.deleted")]
PostPlatformDeleted,
#[serde(rename = "post.tiktok.url_resolved")]
PostTiktokUrlResolved,
#[serde(rename = "post.external.created")]
PostExternalCreated,
#[serde(rename = "post.external.updated")]
PostExternalUpdated,
#[serde(rename = "post.external.deleted")]
PostExternalDeleted,
#[serde(rename = "account.connected")]
AccountConnected,
#[serde(rename = "account.disconnected")]
AccountDisconnected,
#[serde(rename = "account.ads.initial_sync_completed")]
AccountAdsInitialSyncCompleted,
#[serde(rename = "account.ads.sync_failed")]
AccountAdsSyncFailed,
#[serde(rename = "account.ads.sync_recovered")]
AccountAdsSyncRecovered,
#[serde(rename = "analytics.synced")]
AnalyticsSynced,
#[serde(rename = "message.received")]
MessageReceived,
#[serde(rename = "conversation.started")]
ConversationStarted,
#[serde(rename = "conversation.control_changed")]
ConversationControlChanged,
#[serde(rename = "call.received")]
CallReceived,
#[serde(rename = "call.ended")]
CallEnded,
#[serde(rename = "call.failed")]
CallFailed,
#[serde(rename = "call.permission_request")]
CallPermissionRequest,
#[serde(rename = "message.sent")]
MessageSent,
#[serde(rename = "message.edited")]
MessageEdited,
#[serde(rename = "message.deleted")]
MessageDeleted,
#[serde(rename = "message.delivered")]
MessageDelivered,
#[serde(rename = "message.read")]
MessageRead,
#[serde(rename = "message.failed")]
MessageFailed,
#[serde(rename = "reaction.received")]
ReactionReceived,
#[serde(rename = "referral.received")]
ReferralReceived,
#[serde(rename = "comment.received")]
CommentReceived,
#[serde(rename = "review.new")]
ReviewNew,
#[serde(rename = "review.updated")]
ReviewUpdated,
#[serde(rename = "lead.received")]
LeadReceived,
#[serde(rename = "ad.status_changed")]
AdStatusChanged,
#[serde(rename = "whatsapp.template.status_updated")]
WhatsappTemplateStatusUpdated,
#[serde(rename = "whatsapp.template.category_updated")]
WhatsappTemplateCategoryUpdated,
#[serde(rename = "whatsapp.account.name_status_updated")]
WhatsappAccountNameStatusUpdated,
#[serde(rename = "whatsapp.automatic_event")]
WhatsappAutomaticEvent,
#[serde(rename = "whatsapp.number.activated")]
WhatsappNumberActivated,
#[serde(rename = "whatsapp.number.declined")]
WhatsappNumberDeclined,
#[serde(rename = "whatsapp.number.action_required")]
WhatsappNumberActionRequired,
#[serde(rename = "whatsapp.number.verification_required")]
WhatsappNumberVerificationRequired,
#[serde(rename = "whatsapp.number.suspended")]
WhatsappNumberSuspended,
#[serde(rename = "whatsapp.number.reactivated")]
WhatsappNumberReactivated,
#[serde(rename = "whatsapp.number.released")]
WhatsappNumberReleased,
#[serde(rename = "whatsapp.number.kyc_submitted")]
WhatsappNumberKycSubmitted,
#[serde(rename = "phone_number.stock_available")]
PhoneNumberStockAvailable,
#[serde(rename = "verification.approved")]
VerificationApproved,
#[serde(rename = "verification.failed")]
VerificationFailed,
#[serde(rename = "sms.registration.action_required")]
SmsRegistrationActionRequired,
#[serde(rename = "sms.registration.status_updated")]
SmsRegistrationStatusUpdated,
#[serde(rename = "branded_calling.identity.status_updated")]
BrandedCallingIdentityStatusUpdated,
#[serde(rename = "branded_calling.identity.action_required")]
BrandedCallingIdentityActionRequired,
#[serde(rename = "branded_calling.number.status_updated")]
BrandedCallingNumberStatusUpdated,
}
impl Default for Events {
fn default() -> Events {
Self::PostScheduled
}
}
/// Replaces the subscription's denylist. Send an empty array to clear it and receive every event in `events` again. Omitting the field leaves the current denylist untouched. Applies to events emitted after the update; already-queued events can still deliver for up to five minutes after they were enqueued. When the caller is a restricted (zrk_) key, that key's own disabled groups are unioned back in either way, so a restricted key can neither clear nor widen a subscription past its own groups.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum DisabledResourceGroups {
#[serde(rename = "publishing")]
Publishing,
#[serde(rename = "engagement")]
Engagement,
#[serde(rename = "messages")]
Messages,
#[serde(rename = "contacts")]
Contacts,
#[serde(rename = "analytics")]
Analytics,
#[serde(rename = "ads")]
Ads,
#[serde(rename = "telephony")]
Telephony,
#[serde(rename = "accounts")]
Accounts,
#[serde(rename = "billing")]
Billing,
#[serde(rename = "webhooks")]
Webhooks,
}
impl Default for DisabledResourceGroups {
fn default() -> DisabledResourceGroups {
Self::Publishing
}
}