shrike 0.1.4

AT Protocol library for Rust
Documentation
// Code generated by lexgen. DO NOT EDIT.

#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EmbedGetEmbedExternalViewParams {
    /// AT-URIs of any Atmosphere records that can be resolved and used to construct #externalView views. Example: a site.standard.document and optionally its associated site.standard.publication.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub uris: Vec<String>,
    /// The canonical web URL the embed represents (typically the URL the user pasted into the composer). Used as the returned view's `uri`. May be used for validation in the future.
    pub url: String,
}

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct EmbedGetEmbedExternalViewOutput {
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub associated_records: Vec<serde_json::Value>,
    /// StrongRefs (URI+CID) of the Atmosphere records that backed this view, suitable for embedding into a post's external.associatedRefs.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub associated_refs: Vec<crate::api::com::atproto::RepoStrongRef>,
    /// Hydrated view of the embed. Present only when the resolved records back the requested URL and supply enough information to populate the required `viewExternal` fields. Omitted alongside the rest of the response when no records resolved or validation failed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub view: Option<crate::api::app::bsky::EmbedExternalView>,
    /// Extra fields not defined in the schema.
    #[serde(flatten)]
    pub extra: std::collections::HashMap<String, serde_json::Value>,
}

/// EmbedGetEmbedExternalView — Resolve one or more AT-URIs into the data needed to render an enhanced external embed. Returns `associatedRefs` (strongRefs to embed into a post's external.associatedRefs), the raw `associatedRecords`, and a hydrated `view`. The response is empty (`{}`) when no records were resolvable, or when validation determined the resolved records don't actually back the requested URL; clients should fall back to their own link-card rendering in that case and skip writing strongRefs to the post.
pub async fn embed_get_embed_external_view(
    client: &crate::xrpc::Client,
    params: &EmbedGetEmbedExternalViewParams,
) -> Result<EmbedGetEmbedExternalViewOutput, crate::xrpc::Error> {
    client
        .query("app.bsky.embed.getEmbedExternalView", params)
        .await
}