/*
* 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.504.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 OAuthApp {
/// Pass it as `oauthAppId` on GET /v1/connect/{platform} to connect through this app.
#[serde(rename = "id")]
pub id: String,
/// The platform the app belongs to, as in GET /v1/connect/{platform}.
#[serde(rename = "platform")]
pub platform: String,
#[serde(rename = "label")]
pub label: String,
/// The client ID (or app ID) of your app on the platform. The secret is never returned.
#[serde(rename = "clientId")]
pub client_id: String,
/// The permission areas every connect through this app requests. Pick only what your app is approved for on the platform.
#[serde(rename = "scopeAreas")]
pub scope_areas: Vec<ScopeAreas>,
/// `ok`: the platform accepted the keys at the last check. `unchecked`: the check could not reach a verdict (see lastError). `invalid`: the platform rejected the keys; connects and token refreshes through this app will fail until the secret is rotated.
#[serde(rename = "status")]
pub status: Status,
#[serde(
rename = "lastCheckedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub last_checked_at: Option<Option<String>>,
#[serde(
rename = "lastError",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub last_error: Option<Option<String>>,
/// Connected accounts currently running on this app.
#[serde(rename = "accountCount")]
pub account_count: i32,
/// The OAuth redirect URI to allow in your app's settings on the platform.
#[serde(rename = "redirectUri")]
pub redirect_uri: String,
#[serde(rename = "webhook", skip_serializing_if = "Option::is_none")]
pub webhook: Option<Box<models::OAuthAppWebhook>>,
/// TikTok only: set this as the webhook callback URL in your TikTok developer app. TikTok uses it to report when a video finishes publishing; Zernio also checks the publish status itself, so posting works without it. Null on other platforms.
#[serde(
rename = "sharedWebhookUrl",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub shared_webhook_url: Option<Option<String>>,
/// Slack only: whether the signing secret of your Slack app is saved. Without it Zernio refuses every event sent to `slackEvents.requestUrl`.
#[serde(
rename = "hasSlackSigningSecret",
skip_serializing_if = "Option::is_none"
)]
pub has_slack_signing_secret: Option<bool>,
#[serde(rename = "slackEvents", skip_serializing_if = "Option::is_none")]
pub slack_events: Option<Box<models::OAuthAppSlackEvents>>,
#[serde(rename = "createdAt")]
pub created_at: String,
}
impl OAuthApp {
pub fn new(
id: String,
platform: String,
label: String,
client_id: String,
scope_areas: Vec<ScopeAreas>,
status: Status,
account_count: i32,
redirect_uri: String,
created_at: String,
) -> OAuthApp {
OAuthApp {
id,
platform,
label,
client_id,
scope_areas,
status,
last_checked_at: None,
last_error: None,
account_count,
redirect_uri,
webhook: None,
shared_webhook_url: None,
has_slack_signing_secret: None,
slack_events: None,
created_at,
}
}
}
/// The permission areas every connect through this app requests. Pick only what your app is approved for on the platform.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ScopeAreas {
#[serde(rename = "posting")]
Posting,
#[serde(rename = "analytics")]
Analytics,
#[serde(rename = "comments")]
Comments,
#[serde(rename = "messaging")]
Messaging,
}
impl Default for ScopeAreas {
fn default() -> ScopeAreas {
Self::Posting
}
}
/// `ok`: the platform accepted the keys at the last check. `unchecked`: the check could not reach a verdict (see lastError). `invalid`: the platform rejected the keys; connects and token refreshes through this app will fail until the secret is rotated.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "ok")]
Ok,
#[serde(rename = "unchecked")]
Unchecked,
#[serde(rename = "invalid")]
Invalid,
}
impl Default for Status {
fn default() -> Status {
Self::Ok
}
}