keybase-protocol 0.1.1

Provides the Keybase types defined in the Keybase AVDL Protocol files for Rust.
Documentation
// Namespace: "chat.1"
// Protocol: "unfurl"
#![allow(dead_code)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Serialize, Deserialize};
use serde_repr::{Deserialize_repr, Serialize_repr};use super::*;

use super::common::*;
#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum UnfurlType {
  Generic_0,
  Youtube_1,
  Giphy_2,
  Maps_3, // only from scrape, gets converted to generic in packager
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlVideo {
  #[serde(default)]
  pub url: Option<String>,
  #[serde(default)]
  pub mimeType: Option<String>,
  pub height: Option<i32>,
  pub width: Option<i32>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlGenericRaw {
  #[serde(default)]
  pub title: Option<String>,
  #[serde(default)]
  pub url: Option<String>,
  #[serde(default)]
  pub siteName: Option<String>,
  pub faviconUrl: Option<String>,
  pub imageUrl: Option<String>,
  pub video: Option<UnfurlVideo>,
  pub publishTime: Option<i32>,
  pub description: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlYoutubeRaw {
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlGiphyRaw {
  pub imageUrl: Option<String>,
  pub video: Option<UnfurlVideo>,
  pub faviconUrl: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlMapsRaw {
  #[serde(default)]
  pub title: Option<String>,
  #[serde(default)]
  pub url: Option<String>,
  #[serde(default)]
  pub siteName: Option<String>,
  #[serde(default)]
  pub imageUrl: Option<String>,
  pub historyImageUrl: Option<String>,
  #[serde(default)]
  pub description: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
#[serde(untagged)]
pub enum UnfurlRaw {
  Generic {generic: UnfurlGenericRaw},
  Youtube {youtube: UnfurlYoutubeRaw},
  Giphy {giphy: UnfurlGiphyRaw},
  Maps {maps: UnfurlMapsRaw},
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlGeneric {
  #[serde(default)]
  pub title: Option<String>,
  #[serde(default)]
  pub url: Option<String>,
  #[serde(default)]
  pub siteName: Option<String>,
  pub favicon: Option<Asset>,
  pub image: Option<Asset>,
  pub publishTime: Option<i32>,
  pub description: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlYoutube {
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlGiphy {
  pub favicon: Option<Asset>,
  pub image: Option<Asset>,
  pub video: Option<Asset>,
}

#[derive(Serialize, Deserialize, Debug)]
#[serde(untagged)]
pub enum Unfurl {
  Generic {generic: UnfurlGeneric},
  Youtube {youtube: UnfurlYoutube},
  Giphy {giphy: UnfurlGiphy},
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlResult {
  pub unfurl: Option<Unfurl>,
  #[serde(default)]
  pub url: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlImageDisplay {
  #[serde(default)]
  pub url: Option<String>,
  pub height: Option<i32>,
  pub width: Option<i32>,
  #[serde(default)]
  pub isVideo: Option<bool>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlGenericDisplay {
  #[serde(default)]
  pub title: Option<String>,
  #[serde(default)]
  pub url: Option<String>,
  #[serde(default)]
  pub siteName: Option<String>,
  pub favicon: Option<UnfurlImageDisplay>,
  pub media: Option<UnfurlImageDisplay>,
  pub publishTime: Option<i32>,
  pub description: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlYoutubeDisplay {
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlGiphyDisplay {
  pub favicon: Option<UnfurlImageDisplay>,
  pub image: Option<UnfurlImageDisplay>,
  pub video: Option<UnfurlImageDisplay>,
}

#[derive(Serialize, Deserialize, Debug)]
#[serde(untagged)]
pub enum UnfurlDisplay {
  Generic {generic: UnfurlGenericDisplay},
  Youtube {youtube: UnfurlYoutubeDisplay},
  Giphy {giphy: UnfurlGiphyDisplay},
}

#[derive(Serialize_repr, Deserialize_repr, Debug, Hash, PartialEq, Eq)]
#[repr(u8)]
pub enum UnfurlMode {
  Always_0,
  Never_1,
  Whitelisted_2,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlSettings {
  pub mode: Option<UnfurlMode>,
  pub whitelist: Option<std::collections::HashMap<String, bool>>,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct UnfurlSettingsDisplay {
  pub mode: Option<UnfurlMode>,
  #[serde(default)]
  pub whitelist: Option<Vec<String>>,
}