diff --git a/atrium-api/src/app/bsky.rs b/atrium-api/src/app/bsky.rs index be4b4372..afbfc4e2 100644 --- a/atrium-api/src/app/bsky.rs +++ b/atrium-api/src/app/bsky.rs @@ -8,3 +8,4 @@ pub mod labeler; pub mod notification; pub mod richtext; pub mod unspecced; +pub mod video; diff --git a/atrium-api/src/app/bsky/actor/defs.rs b/atrium-api/src/app/bsky/actor/defs.rs index 878e3c86..c3c83b4a 100644 --- a/atrium-api/src/app/bsky/actor/defs.rs +++ b/atrium-api/src/app/bsky/actor/defs.rs @@ -19,6 +19,9 @@ pub type BskyAppProgressGuide = crate::types::Object; pub struct BskyAppStatePrefData { #[serde(skip_serializing_if = "Option::is_none")] pub active_progress_guide: Option, + ///Storage for NUXs the user has encountered. + #[serde(skip_serializing_if = "Option::is_none")] + pub nuxs: Option>, ///An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user. #[serde(skip_serializing_if = "Option::is_none")] pub queued_nudges: Option>, @@ -116,6 +119,20 @@ pub struct MutedWordsPrefData { pub items: Vec, } pub type MutedWordsPref = crate::types::Object; +///A new user experiences (NUX) storage object +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct NuxData { + pub completed: bool, + ///Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters. + #[serde(skip_serializing_if = "Option::is_none")] + pub data: Option, + ///The date and time at which the NUX will expire and should be considered completed. + #[serde(skip_serializing_if = "Option::is_none")] + pub expires_at: Option, + pub id: String, +} +pub type Nux = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct PersonalDetailsPrefData { diff --git a/atrium-api/src/app/bsky/embed.rs b/atrium-api/src/app/bsky/embed.rs index 8f2da61e..15d26873 100644 --- a/atrium-api/src/app/bsky/embed.rs +++ b/atrium-api/src/app/bsky/embed.rs @@ -1,6 +1,8 @@ // This file is generated by atrium-codegen. DO NOT EDIT. //!Definitions for the `app.bsky.embed` namespace. +pub mod defs; pub mod external; pub mod images; pub mod record; pub mod record_with_media; +pub mod video; diff --git a/atrium-api/src/app/bsky/embed/defs.rs b/atrium-api/src/app/bsky/embed/defs.rs new file mode 100644 index 00000000..d822173c --- /dev/null +++ b/atrium-api/src/app/bsky/embed/defs.rs @@ -0,0 +1,10 @@ +// This file is generated by atrium-codegen. DO NOT EDIT. +//!Definitions for the `app.bsky.embed.defs` namespace. +///width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct AspectRatioData { + pub height: core::num::NonZeroU64, + pub width: core::num::NonZeroU64, +} +pub type AspectRatio = crate::types::Object; diff --git a/atrium-api/src/app/bsky/embed/images.rs b/atrium-api/src/app/bsky/embed/images.rs index 52aefc49..012168aa 100644 --- a/atrium-api/src/app/bsky/embed/images.rs +++ b/atrium-api/src/app/bsky/embed/images.rs @@ -7,21 +7,13 @@ pub struct MainData { pub images: Vec, } pub type Main = crate::types::Object; -///width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit. -#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] -#[serde(rename_all = "camelCase")] -pub struct AspectRatioData { - pub height: core::num::NonZeroU64, - pub width: core::num::NonZeroU64, -} -pub type AspectRatio = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct ImageData { ///Alt text description of the image, for accessibility. pub alt: String, #[serde(skip_serializing_if = "Option::is_none")] - pub aspect_ratio: Option, + pub aspect_ratio: Option, pub image: crate::types::BlobRef, } pub type Image = crate::types::Object; @@ -37,7 +29,7 @@ pub struct ViewImageData { ///Alt text description of the image, for accessibility. pub alt: String, #[serde(skip_serializing_if = "Option::is_none")] - pub aspect_ratio: Option, + pub aspect_ratio: Option, ///Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. pub fullsize: String, ///Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. diff --git a/atrium-api/src/app/bsky/embed/record.rs b/atrium-api/src/app/bsky/embed/record.rs index d06f15a5..dd2e57d6 100644 --- a/atrium-api/src/app/bsky/embed/record.rs +++ b/atrium-api/src/app/bsky/embed/record.rs @@ -23,6 +23,13 @@ pub struct ViewBlockedData { pub type ViewBlocked = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] +pub struct ViewDetachedData { + pub detached: bool, + pub uri: String, +} +pub type ViewDetached = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] pub struct ViewNotFoundData { pub not_found: bool, pub uri: String, @@ -41,6 +48,8 @@ pub struct ViewRecordData { #[serde(skip_serializing_if = "Option::is_none")] pub like_count: Option, #[serde(skip_serializing_if = "Option::is_none")] + pub quote_count: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub reply_count: Option, #[serde(skip_serializing_if = "Option::is_none")] pub repost_count: Option, @@ -54,6 +63,8 @@ pub type ViewRecord = crate::types::Object; pub enum ViewRecordEmbedsItem { #[serde(rename = "app.bsky.embed.images#view")] AppBskyEmbedImagesView(Box), + #[serde(rename = "app.bsky.embed.video#view")] + AppBskyEmbedVideoView(Box), #[serde(rename = "app.bsky.embed.external#view")] AppBskyEmbedExternalView(Box), #[serde(rename = "app.bsky.embed.record#view")] @@ -72,6 +83,8 @@ pub enum ViewRecordRefs { ViewNotFound(Box), #[serde(rename = "app.bsky.embed.record#viewBlocked")] ViewBlocked(Box), + #[serde(rename = "app.bsky.embed.record#viewDetached")] + ViewDetached(Box), #[serde(rename = "app.bsky.feed.defs#generatorView")] AppBskyFeedDefsGeneratorView(Box), #[serde(rename = "app.bsky.graph.defs#listView")] diff --git a/atrium-api/src/app/bsky/embed/record_with_media.rs b/atrium-api/src/app/bsky/embed/record_with_media.rs index 8f363b68..9f85fb8c 100644 --- a/atrium-api/src/app/bsky/embed/record_with_media.rs +++ b/atrium-api/src/app/bsky/embed/record_with_media.rs @@ -20,6 +20,8 @@ pub type View = crate::types::Object; pub enum MainMediaRefs { #[serde(rename = "app.bsky.embed.images")] AppBskyEmbedImagesMain(Box), + #[serde(rename = "app.bsky.embed.video")] + AppBskyEmbedVideoMain(Box), #[serde(rename = "app.bsky.embed.external")] AppBskyEmbedExternalMain(Box), } @@ -28,6 +30,8 @@ pub enum MainMediaRefs { pub enum ViewMediaRefs { #[serde(rename = "app.bsky.embed.images#view")] AppBskyEmbedImagesView(Box), + #[serde(rename = "app.bsky.embed.video#view")] + AppBskyEmbedVideoView(Box), #[serde(rename = "app.bsky.embed.external#view")] AppBskyEmbedExternalView(Box), } diff --git a/atrium-api/src/app/bsky/embed/video.rs b/atrium-api/src/app/bsky/embed/video.rs new file mode 100644 index 00000000..48378a4c --- /dev/null +++ b/atrium-api/src/app/bsky/embed/video.rs @@ -0,0 +1,36 @@ +// This file is generated by atrium-codegen. DO NOT EDIT. +//!Definitions for the `app.bsky.embed.video` namespace. +//!A video embedded in a Bluesky record (eg, a post). +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct MainData { + ///Alt text description of the video, for accessibility. + #[serde(skip_serializing_if = "Option::is_none")] + pub alt: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub aspect_ratio: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub captions: Option>, + pub video: crate::types::BlobRef, +} +pub type Main = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct CaptionData { + pub file: crate::types::BlobRef, + pub lang: crate::types::string::Language, +} +pub type Caption = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct ViewData { + #[serde(skip_serializing_if = "Option::is_none")] + pub alt: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub aspect_ratio: Option, + pub cid: crate::types::string::Cid, + pub playlist: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub thumbnail: Option, +} +pub type View = crate::types::Object; diff --git a/atrium-api/src/app/bsky/feed.rs b/atrium-api/src/app/bsky/feed.rs index 826357db..4f999393 100644 --- a/atrium-api/src/app/bsky/feed.rs +++ b/atrium-api/src/app/bsky/feed.rs @@ -14,11 +14,13 @@ pub mod get_likes; pub mod get_list_feed; pub mod get_post_thread; pub mod get_posts; +pub mod get_quotes; pub mod get_reposted_by; pub mod get_suggested_feeds; pub mod get_timeline; pub mod like; pub mod post; +pub mod postgate; pub mod repost; pub mod search_posts; pub mod send_interactions; @@ -42,6 +44,12 @@ impl crate::types::Collection for Post { type Record = post::Record; } #[derive(Debug)] +pub struct Postgate; +impl crate::types::Collection for Postgate { + const NSID: &'static str = "app.bsky.feed.postgate"; + type Record = postgate::Record; +} +#[derive(Debug)] pub struct Repost; impl crate::types::Collection for Repost { const NSID: &'static str = "app.bsky.feed.repost"; diff --git a/atrium-api/src/app/bsky/feed/defs.rs b/atrium-api/src/app/bsky/feed/defs.rs index 1ba3055d..496dd896 100644 --- a/atrium-api/src/app/bsky/feed/defs.rs +++ b/atrium-api/src/app/bsky/feed/defs.rs @@ -112,6 +112,8 @@ pub struct PostViewData { pub labels: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub like_count: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub quote_count: Option, pub record: crate::types::Unknown, #[serde(skip_serializing_if = "Option::is_none")] pub reply_count: Option, @@ -189,6 +191,8 @@ pub type ThreadgateView = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct ViewerStateData { + #[serde(skip_serializing_if = "Option::is_none")] + pub embedding_disabled: Option, #[serde(skip_serializing_if = "Option::is_none")] pub like: Option, #[serde(skip_serializing_if = "Option::is_none")] @@ -210,6 +214,8 @@ pub enum FeedViewPostReasonRefs { pub enum PostViewEmbedRefs { #[serde(rename = "app.bsky.embed.images#view")] AppBskyEmbedImagesView(Box), + #[serde(rename = "app.bsky.embed.video#view")] + AppBskyEmbedVideoView(Box), #[serde(rename = "app.bsky.embed.external#view")] AppBskyEmbedExternalView(Box), #[serde(rename = "app.bsky.embed.record#view")] diff --git a/atrium-api/src/app/bsky/feed/get_post_thread.rs b/atrium-api/src/app/bsky/feed/get_post_thread.rs index 5cd466f0..4eb7b409 100644 --- a/atrium-api/src/app/bsky/feed/get_post_thread.rs +++ b/atrium-api/src/app/bsky/feed/get_post_thread.rs @@ -18,6 +18,8 @@ pub type Parameters = crate::types::Object; #[serde(rename_all = "camelCase")] pub struct OutputData { pub thread: crate::types::Union, + #[serde(skip_serializing_if = "Option::is_none")] + pub threadgate: Option, } pub type Output = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] diff --git a/atrium-api/src/app/bsky/feed/get_quotes.rs b/atrium-api/src/app/bsky/feed/get_quotes.rs new file mode 100644 index 00000000..ff9025ad --- /dev/null +++ b/atrium-api/src/app/bsky/feed/get_quotes.rs @@ -0,0 +1,36 @@ +// This file is generated by atrium-codegen. DO NOT EDIT. +//!Definitions for the `app.bsky.feed.getQuotes` namespace. +pub const NSID: &str = "app.bsky.feed.getQuotes"; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct ParametersData { + ///If supplied, filters to quotes of specific version (by CID) of the post record. + #[serde(skip_serializing_if = "Option::is_none")] + pub cid: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub cursor: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option>, + ///Reference (AT-URI) of post record + pub uri: String, +} +pub type Parameters = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct OutputData { + #[serde(skip_serializing_if = "Option::is_none")] + pub cid: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub cursor: Option, + pub posts: Vec, + pub uri: String, +} +pub type Output = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(tag = "error", content = "message")] +pub enum Error {} +impl std::fmt::Display for Error { + fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result { + Ok(()) + } +} diff --git a/atrium-api/src/app/bsky/feed/post.rs b/atrium-api/src/app/bsky/feed/post.rs index 602ecb1f..e1316537 100644 --- a/atrium-api/src/app/bsky/feed/post.rs +++ b/atrium-api/src/app/bsky/feed/post.rs @@ -58,6 +58,8 @@ pub type TextSlice = crate::types::Object; pub enum RecordEmbedRefs { #[serde(rename = "app.bsky.embed.images")] AppBskyEmbedImagesMain(Box), + #[serde(rename = "app.bsky.embed.video")] + AppBskyEmbedVideoMain(Box), #[serde(rename = "app.bsky.embed.external")] AppBskyEmbedExternalMain(Box), #[serde(rename = "app.bsky.embed.record")] diff --git a/atrium-api/src/app/bsky/feed/postgate.rs b/atrium-api/src/app/bsky/feed/postgate.rs new file mode 100644 index 00000000..5377f470 --- /dev/null +++ b/atrium-api/src/app/bsky/feed/postgate.rs @@ -0,0 +1,26 @@ +// This file is generated by atrium-codegen. DO NOT EDIT. +//!Definitions for the `app.bsky.feed.postgate` namespace. +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct RecordData { + pub created_at: crate::types::string::Datetime, + ///List of AT-URIs embedding this post that the author has detached from. + #[serde(skip_serializing_if = "Option::is_none")] + pub detached_embedding_uris: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub embedding_rules: Option>>, + ///Reference (AT-URI) to the post record. + pub post: String, +} +pub type Record = crate::types::Object; +///Disables embedding of this post. +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct DisableRuleData {} +pub type DisableRule = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(tag = "$type")] +pub enum RecordEmbeddingRulesItem { + #[serde(rename = "app.bsky.feed.postgate#disableRule")] + DisableRule(Box), +} diff --git a/atrium-api/src/app/bsky/feed/threadgate.rs b/atrium-api/src/app/bsky/feed/threadgate.rs index c5f9f554..02e06813 100644 --- a/atrium-api/src/app/bsky/feed/threadgate.rs +++ b/atrium-api/src/app/bsky/feed/threadgate.rs @@ -6,6 +6,9 @@ pub struct RecordData { #[serde(skip_serializing_if = "Option::is_none")] pub allow: Option>>, pub created_at: crate::types::string::Datetime, + ///List of hidden reply URIs. + #[serde(skip_serializing_if = "Option::is_none")] + pub hidden_replies: Option>, ///Reference (AT-URI) to the post record. pub post: String, } diff --git a/atrium-api/src/app/bsky/video.rs b/atrium-api/src/app/bsky/video.rs new file mode 100644 index 00000000..e381489a --- /dev/null +++ b/atrium-api/src/app/bsky/video.rs @@ -0,0 +1,6 @@ +// This file is generated by atrium-codegen. DO NOT EDIT. +//!Definitions for the `app.bsky.video` namespace. +pub mod defs; +pub mod get_job_status; +pub mod get_upload_limits; +pub mod upload_video; diff --git a/atrium-api/src/app/bsky/video/defs.rs b/atrium-api/src/app/bsky/video/defs.rs new file mode 100644 index 00000000..eca86336 --- /dev/null +++ b/atrium-api/src/app/bsky/video/defs.rs @@ -0,0 +1,20 @@ +// This file is generated by atrium-codegen. DO NOT EDIT. +//!Definitions for the `app.bsky.video.defs` namespace. +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct JobStatusData { + #[serde(skip_serializing_if = "Option::is_none")] + pub blob: Option, + pub did: crate::types::string::Did, + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + pub job_id: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, + ///Progress within the current processing state. + #[serde(skip_serializing_if = "Option::is_none")] + pub progress: Option>, + ///The state of the video processing job. All values not listed as a known value indicate that the job is in process. + pub state: String, +} +pub type JobStatus = crate::types::Object; diff --git a/atrium-api/src/app/bsky/video/get_job_status.rs b/atrium-api/src/app/bsky/video/get_job_status.rs new file mode 100644 index 00000000..68a92ab1 --- /dev/null +++ b/atrium-api/src/app/bsky/video/get_job_status.rs @@ -0,0 +1,23 @@ +// This file is generated by atrium-codegen. DO NOT EDIT. +//!Definitions for the `app.bsky.video.getJobStatus` namespace. +pub const NSID: &str = "app.bsky.video.getJobStatus"; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct ParametersData { + pub job_id: String, +} +pub type Parameters = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct OutputData { + pub job_status: crate::app::bsky::video::defs::JobStatus, +} +pub type Output = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(tag = "error", content = "message")] +pub enum Error {} +impl std::fmt::Display for Error { + fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result { + Ok(()) + } +} diff --git a/atrium-api/src/app/bsky/video/get_upload_limits.rs b/atrium-api/src/app/bsky/video/get_upload_limits.rs new file mode 100644 index 00000000..d19843b1 --- /dev/null +++ b/atrium-api/src/app/bsky/video/get_upload_limits.rs @@ -0,0 +1,25 @@ +// This file is generated by atrium-codegen. DO NOT EDIT. +//!Definitions for the `app.bsky.video.getUploadLimits` namespace. +pub const NSID: &str = "app.bsky.video.getUploadLimits"; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct OutputData { + pub can_upload: bool, + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub remaining_daily_bytes: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub remaining_daily_videos: Option, +} +pub type Output = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(tag = "error", content = "message")] +pub enum Error {} +impl std::fmt::Display for Error { + fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result { + Ok(()) + } +} diff --git a/atrium-api/src/app/bsky/video/upload_video.rs b/atrium-api/src/app/bsky/video/upload_video.rs new file mode 100644 index 00000000..c364afac --- /dev/null +++ b/atrium-api/src/app/bsky/video/upload_video.rs @@ -0,0 +1,17 @@ +// This file is generated by atrium-codegen. DO NOT EDIT. +//!Definitions for the `app.bsky.video.uploadVideo` namespace. +pub const NSID: &str = "app.bsky.video.uploadVideo"; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct OutputData { + pub job_status: crate::app::bsky::video::defs::JobStatus, +} +pub type Output = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(tag = "error", content = "message")] +pub enum Error {} +impl std::fmt::Display for Error { + fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result { + Ok(()) + } +} diff --git a/atrium-api/src/client.rs b/atrium-api/src/client.rs index 97d156d5..01b9a8b2 100644 --- a/atrium-api/src/client.rs +++ b/atrium-api/src/client.rs @@ -50,6 +50,7 @@ pub mod app { pub labeler: labeler::Service, pub notification: notification::Service, pub unspecced: unspecced::Service, + pub video: video::Service, pub(crate) _phantom: core::marker::PhantomData, } pub mod actor { @@ -106,6 +107,15 @@ pub mod app { pub(crate) _phantom: core::marker::PhantomData, } } + pub mod video { + pub struct Service + where + T: atrium_xrpc::XrpcClient + Send + Sync, + { + pub(crate) xrpc: std::sync::Arc, + pub(crate) _phantom: core::marker::PhantomData, + } + } } } pub mod chat { @@ -361,6 +371,7 @@ where std::sync::Arc::clone(&xrpc), ), unspecced: app::bsky::unspecced::Service::new(std::sync::Arc::clone(&xrpc)), + video: app::bsky::video::Service::new(std::sync::Arc::clone(&xrpc)), _phantom: core::marker::PhantomData, } } @@ -656,7 +667,7 @@ where _ => Err(atrium_xrpc::Error::UnexpectedResponseType), } } - ///Get a list of posts liked by an actor. Does not require auth. + ///Get a list of posts liked by an actor. Requires auth, actor must be the requesting account. pub async fn get_actor_likes( &self, params: crate::app::bsky::feed::get_actor_likes::Parameters, @@ -956,6 +967,36 @@ where _ => Err(atrium_xrpc::Error::UnexpectedResponseType), } } + ///Get a list of quotes for a given post. + pub async fn get_quotes( + &self, + params: crate::app::bsky::feed::get_quotes::Parameters, + ) -> atrium_xrpc::Result< + crate::app::bsky::feed::get_quotes::Output, + crate::app::bsky::feed::get_quotes::Error, + > { + let response = self + .xrpc + .send_xrpc::< + _, + (), + _, + _, + >( + &atrium_xrpc::XrpcRequest { + method: http::Method::GET, + nsid: crate::app::bsky::feed::get_quotes::NSID.into(), + parameters: Some(params), + input: None, + encoding: None, + }, + ) + .await?; + match response { + atrium_xrpc::OutputDataOrBytes::Data(data) => Ok(data), + _ => Err(atrium_xrpc::Error::UnexpectedResponseType), + } + } ///Get a list of reposts for a given post. pub async fn get_reposted_by( &self, @@ -2072,6 +2113,108 @@ where } } } +#[cfg(feature = "namespace-appbsky")] +impl app::bsky::video::Service +where + T: atrium_xrpc::XrpcClient + Send + Sync, +{ + #[allow(unused_variables)] + pub(crate) fn new(xrpc: std::sync::Arc) -> Self { + Self { + xrpc, + _phantom: core::marker::PhantomData, + } + } + ///Get status details for a video processing job. + pub async fn get_job_status( + &self, + params: crate::app::bsky::video::get_job_status::Parameters, + ) -> atrium_xrpc::Result< + crate::app::bsky::video::get_job_status::Output, + crate::app::bsky::video::get_job_status::Error, + > { + let response = self + .xrpc + .send_xrpc::< + _, + (), + _, + _, + >( + &atrium_xrpc::XrpcRequest { + method: http::Method::GET, + nsid: crate::app::bsky::video::get_job_status::NSID.into(), + parameters: Some(params), + input: None, + encoding: None, + }, + ) + .await?; + match response { + atrium_xrpc::OutputDataOrBytes::Data(data) => Ok(data), + _ => Err(atrium_xrpc::Error::UnexpectedResponseType), + } + } + ///Get video upload limits for the authenticated user. + pub async fn get_upload_limits( + &self, + ) -> atrium_xrpc::Result< + crate::app::bsky::video::get_upload_limits::Output, + crate::app::bsky::video::get_upload_limits::Error, + > { + let response = self + .xrpc + .send_xrpc::< + (), + (), + _, + _, + >( + &atrium_xrpc::XrpcRequest { + method: http::Method::GET, + nsid: crate::app::bsky::video::get_upload_limits::NSID.into(), + parameters: None, + input: None, + encoding: None, + }, + ) + .await?; + match response { + atrium_xrpc::OutputDataOrBytes::Data(data) => Ok(data), + _ => Err(atrium_xrpc::Error::UnexpectedResponseType), + } + } + ///Upload a video to be processed then stored on the PDS. + pub async fn upload_video( + &self, + input: Vec, + ) -> atrium_xrpc::Result< + crate::app::bsky::video::upload_video::Output, + crate::app::bsky::video::upload_video::Error, + > { + let response = self + .xrpc + .send_xrpc::< + (), + Vec, + _, + _, + >( + &atrium_xrpc::XrpcRequest { + method: http::Method::POST, + nsid: crate::app::bsky::video::upload_video::NSID.into(), + parameters: None, + input: Some(atrium_xrpc::InputDataOrBytes::Bytes(input)), + encoding: Some(String::from("video/mp4")), + }, + ) + .await?; + match response { + atrium_xrpc::OutputDataOrBytes::Data(data) => Ok(data), + _ => Err(atrium_xrpc::Error::UnexpectedResponseType), + } + } +} impl chat::Service where T: atrium_xrpc::XrpcClient + Send + Sync, @@ -3388,13 +3531,16 @@ where pub async fn apply_writes( &self, input: crate::com::atproto::repo::apply_writes::Input, - ) -> atrium_xrpc::Result<(), crate::com::atproto::repo::apply_writes::Error> { + ) -> atrium_xrpc::Result< + crate::com::atproto::repo::apply_writes::Output, + crate::com::atproto::repo::apply_writes::Error, + > { let response = self .xrpc .send_xrpc::< (), _, - (), + _, _, >( &atrium_xrpc::XrpcRequest { @@ -3407,7 +3553,7 @@ where ) .await?; match response { - atrium_xrpc::OutputDataOrBytes::Bytes(_) => Ok(()), + atrium_xrpc::OutputDataOrBytes::Data(data) => Ok(data), _ => Err(atrium_xrpc::Error::UnexpectedResponseType), } } @@ -3445,13 +3591,16 @@ where pub async fn delete_record( &self, input: crate::com::atproto::repo::delete_record::Input, - ) -> atrium_xrpc::Result<(), crate::com::atproto::repo::delete_record::Error> { + ) -> atrium_xrpc::Result< + crate::com::atproto::repo::delete_record::Output, + crate::com::atproto::repo::delete_record::Error, + > { let response = self .xrpc .send_xrpc::< (), _, - (), + _, _, >( &atrium_xrpc::XrpcRequest { @@ -3464,7 +3613,7 @@ where ) .await?; match response { - atrium_xrpc::OutputDataOrBytes::Bytes(_) => Ok(()), + atrium_xrpc::OutputDataOrBytes::Data(data) => Ok(data), _ => Err(atrium_xrpc::Error::UnexpectedResponseType), } } diff --git a/atrium-api/src/com/atproto/repo.rs b/atrium-api/src/com/atproto/repo.rs index 8e1cf3a0..08985da6 100644 --- a/atrium-api/src/com/atproto/repo.rs +++ b/atrium-api/src/com/atproto/repo.rs @@ -2,6 +2,7 @@ //!Definitions for the `com.atproto.repo` namespace. pub mod apply_writes; pub mod create_record; +pub mod defs; pub mod delete_record; pub mod describe_repo; pub mod get_record; diff --git a/atrium-api/src/com/atproto/repo/apply_writes.rs b/atrium-api/src/com/atproto/repo/apply_writes.rs index 811ecb36..7394dd51 100644 --- a/atrium-api/src/com/atproto/repo/apply_writes.rs +++ b/atrium-api/src/com/atproto/repo/apply_writes.rs @@ -9,13 +9,22 @@ pub struct InputData { ///If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations. #[serde(skip_serializing_if = "Option::is_none")] pub swap_commit: Option, - ///Can be set to 'false' to skip Lexicon schema validation of record data, for all operations. + ///Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons. #[serde(skip_serializing_if = "Option::is_none")] pub validate: Option, pub writes: Vec, } pub type Input = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct OutputData { + #[serde(skip_serializing_if = "Option::is_none")] + pub commit: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub results: Option>, +} +pub type Output = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(tag = "error", content = "message")] pub enum Error { ///Indicates that the 'swapCommit' parameter did not match current commit. @@ -44,6 +53,15 @@ pub struct CreateData { pub value: crate::types::Unknown, } pub type Create = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct CreateResultData { + pub cid: crate::types::string::Cid, + pub uri: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub validation_status: Option, +} +pub type CreateResult = crate::types::Object; ///Operation which deletes an existing record. #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] @@ -52,6 +70,10 @@ pub struct DeleteData { pub rkey: String, } pub type Delete = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct DeleteResultData {} +pub type DeleteResult = crate::types::Object; ///Operation which updates an existing record. #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] @@ -62,6 +84,15 @@ pub struct UpdateData { } pub type Update = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct UpdateResultData { + pub cid: crate::types::string::Cid, + pub uri: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub validation_status: Option, +} +pub type UpdateResult = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(tag = "$type")] pub enum InputWritesItem { #[serde(rename = "com.atproto.repo.applyWrites#create")] @@ -71,3 +102,13 @@ pub enum InputWritesItem { #[serde(rename = "com.atproto.repo.applyWrites#delete")] Delete(Box), } +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(tag = "$type")] +pub enum OutputResultsItem { + #[serde(rename = "com.atproto.repo.applyWrites#createResult")] + CreateResult(Box), + #[serde(rename = "com.atproto.repo.applyWrites#updateResult")] + UpdateResult(Box), + #[serde(rename = "com.atproto.repo.applyWrites#deleteResult")] + DeleteResult(Box), +} diff --git a/atrium-api/src/com/atproto/repo/create_record.rs b/atrium-api/src/com/atproto/repo/create_record.rs index 7b1c16d6..362efd1c 100644 --- a/atrium-api/src/com/atproto/repo/create_record.rs +++ b/atrium-api/src/com/atproto/repo/create_record.rs @@ -16,7 +16,7 @@ pub struct InputData { ///Compare and swap with the previous commit by CID. #[serde(skip_serializing_if = "Option::is_none")] pub swap_commit: Option, - ///Can be set to 'false' to skip Lexicon schema validation of record data. + ///Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. #[serde(skip_serializing_if = "Option::is_none")] pub validate: Option, } @@ -25,7 +25,11 @@ pub type Input = crate::types::Object; #[serde(rename_all = "camelCase")] pub struct OutputData { pub cid: crate::types::string::Cid, + #[serde(skip_serializing_if = "Option::is_none")] + pub commit: Option, pub uri: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub validation_status: Option, } pub type Output = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] diff --git a/atrium-api/src/com/atproto/repo/defs.rs b/atrium-api/src/com/atproto/repo/defs.rs new file mode 100644 index 00000000..5b27a8af --- /dev/null +++ b/atrium-api/src/com/atproto/repo/defs.rs @@ -0,0 +1,9 @@ +// This file is generated by atrium-codegen. DO NOT EDIT. +//!Definitions for the `com.atproto.repo.defs` namespace. +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct CommitMetaData { + pub cid: crate::types::string::Cid, + pub rev: String, +} +pub type CommitMeta = crate::types::Object; diff --git a/atrium-api/src/com/atproto/repo/delete_record.rs b/atrium-api/src/com/atproto/repo/delete_record.rs index 9b65ae30..c9846903 100644 --- a/atrium-api/src/com/atproto/repo/delete_record.rs +++ b/atrium-api/src/com/atproto/repo/delete_record.rs @@ -19,6 +19,13 @@ pub struct InputData { } pub type Input = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct OutputData { + #[serde(skip_serializing_if = "Option::is_none")] + pub commit: Option, +} +pub type Output = crate::types::Object; +#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(tag = "error", content = "message")] pub enum Error { InvalidSwap(Option), diff --git a/atrium-api/src/com/atproto/repo/put_record.rs b/atrium-api/src/com/atproto/repo/put_record.rs index 6b439f4d..cd5a7011 100644 --- a/atrium-api/src/com/atproto/repo/put_record.rs +++ b/atrium-api/src/com/atproto/repo/put_record.rs @@ -18,7 +18,7 @@ pub struct InputData { ///Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation #[serde(skip_serializing_if = "Option::is_none")] pub swap_record: Option, - ///Can be set to 'false' to skip Lexicon schema validation of record data. + ///Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons. #[serde(skip_serializing_if = "Option::is_none")] pub validate: Option, } @@ -27,7 +27,11 @@ pub type Input = crate::types::Object; #[serde(rename_all = "camelCase")] pub struct OutputData { pub cid: crate::types::string::Cid, + #[serde(skip_serializing_if = "Option::is_none")] + pub commit: Option, pub uri: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub validation_status: Option, } pub type Output = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] diff --git a/atrium-api/src/record.rs b/atrium-api/src/record.rs index ec471cec..7ccec6f8 100644 --- a/atrium-api/src/record.rs +++ b/atrium-api/src/record.rs @@ -21,6 +21,10 @@ pub enum KnownRecord { AppBskyFeedPost(Box), #[cfg_attr(docsrs, doc(cfg(feature = "namespace-appbsky")))] #[cfg(feature = "namespace-appbsky")] + #[serde(rename = "app.bsky.feed.postgate")] + AppBskyFeedPostgate(Box), + #[cfg_attr(docsrs, doc(cfg(feature = "namespace-appbsky")))] + #[cfg(feature = "namespace-appbsky")] #[serde(rename = "app.bsky.feed.repost")] AppBskyFeedRepost(Box), #[cfg_attr(docsrs, doc(cfg(feature = "namespace-appbsky")))] @@ -118,6 +122,20 @@ impl From for KnownRecord { } #[cfg_attr(docsrs, doc(cfg(feature = "namespace-appbsky")))] #[cfg(feature = "namespace-appbsky")] +impl From for KnownRecord { + fn from(record: crate::app::bsky::feed::postgate::Record) -> Self { + KnownRecord::AppBskyFeedPostgate(Box::new(record)) + } +} +#[cfg_attr(docsrs, doc(cfg(feature = "namespace-appbsky")))] +#[cfg(feature = "namespace-appbsky")] +impl From for KnownRecord { + fn from(record_data: crate::app::bsky::feed::postgate::RecordData) -> Self { + KnownRecord::AppBskyFeedPostgate(Box::new(record_data.into())) + } +} +#[cfg_attr(docsrs, doc(cfg(feature = "namespace-appbsky")))] +#[cfg(feature = "namespace-appbsky")] impl From for KnownRecord { fn from(record: crate::app::bsky::feed::repost::Record) -> Self { KnownRecord::AppBskyFeedRepost(Box::new(record)) diff --git a/atrium-api/src/tools/ozone/communication/create_template.rs b/atrium-api/src/tools/ozone/communication/create_template.rs index 50ab264e..c0bbe979 100644 --- a/atrium-api/src/tools/ozone/communication/create_template.rs +++ b/atrium-api/src/tools/ozone/communication/create_template.rs @@ -9,6 +9,9 @@ pub struct InputData { ///DID of the user who is creating the template. #[serde(skip_serializing_if = "Option::is_none")] pub created_by: Option, + ///Message language. + #[serde(skip_serializing_if = "Option::is_none")] + pub lang: Option, ///Name of the template. pub name: String, ///Subject of the message, used in emails. @@ -18,9 +21,19 @@ pub type Input = crate::types::Object; pub type Output = crate::tools::ozone::communication::defs::TemplateView; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(tag = "error", content = "message")] -pub enum Error {} +pub enum Error { + DuplicateTemplateName(Option), +} impl std::fmt::Display for Error { fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Error::DuplicateTemplateName(msg) => { + write!(_f, "DuplicateTemplateName")?; + if let Some(msg) = msg { + write!(_f, ": {msg}")?; + } + } + } Ok(()) } } diff --git a/atrium-api/src/tools/ozone/communication/defs.rs b/atrium-api/src/tools/ozone/communication/defs.rs index 4957ac7a..1d084804 100644 --- a/atrium-api/src/tools/ozone/communication/defs.rs +++ b/atrium-api/src/tools/ozone/communication/defs.rs @@ -8,6 +8,9 @@ pub struct TemplateViewData { pub created_at: crate::types::string::Datetime, pub disabled: bool, pub id: String, + ///Message language. + #[serde(skip_serializing_if = "Option::is_none")] + pub lang: Option, ///DID of the user who last updated the template. pub last_updated_by: crate::types::string::Did, ///Name of the template. diff --git a/atrium-api/src/tools/ozone/communication/update_template.rs b/atrium-api/src/tools/ozone/communication/update_template.rs index 7dac6036..b25abac5 100644 --- a/atrium-api/src/tools/ozone/communication/update_template.rs +++ b/atrium-api/src/tools/ozone/communication/update_template.rs @@ -11,6 +11,9 @@ pub struct InputData { pub disabled: Option, ///ID of the template to be updated. pub id: String, + ///Message language. + #[serde(skip_serializing_if = "Option::is_none")] + pub lang: Option, ///Name of the template. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option, @@ -25,9 +28,19 @@ pub type Input = crate::types::Object; pub type Output = crate::tools::ozone::communication::defs::TemplateView; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(tag = "error", content = "message")] -pub enum Error {} +pub enum Error { + DuplicateTemplateName(Option), +} impl std::fmt::Display for Error { fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Error::DuplicateTemplateName(msg) => { + write!(_f, "DuplicateTemplateName")?; + if let Some(msg) = msg { + write!(_f, ": {msg}")?; + } + } + } Ok(()) } } diff --git a/atrium-api/src/tools/ozone/moderation/defs.rs b/atrium-api/src/tools/ozone/moderation/defs.rs index eb96762c..0adfeaf7 100644 --- a/atrium-api/src/tools/ozone/moderation/defs.rs +++ b/atrium-api/src/tools/ozone/moderation/defs.rs @@ -143,6 +143,9 @@ pub type ModEventTag = crate::types::Object; #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct ModEventTakedownData { + ///If true, all other reports on content authored by this account will be resolved (acknowledged). + #[serde(skip_serializing_if = "Option::is_none")] + pub acknowledge_account_subjects: Option, #[serde(skip_serializing_if = "Option::is_none")] pub comment: Option, ///Indicates how long the takedown should be in effect before automatically expiring. diff --git a/atrium-api/src/tools/ozone/moderation/emit_event.rs b/atrium-api/src/tools/ozone/moderation/emit_event.rs index 0633f011..301ce7ae 100644 --- a/atrium-api/src/tools/ozone/moderation/emit_event.rs +++ b/atrium-api/src/tools/ozone/moderation/emit_event.rs @@ -77,6 +77,10 @@ pub enum InputEventRefs { ToolsOzoneModerationDefsModEventReverseTakedown( Box, ), + #[serde(rename = "tools.ozone.moderation.defs#modEventResolveAppeal")] + ToolsOzoneModerationDefsModEventResolveAppeal( + Box, + ), #[serde(rename = "tools.ozone.moderation.defs#modEventEmail")] ToolsOzoneModerationDefsModEventEmail( Box, diff --git a/atrium-api/src/tools/ozone/moderation/query_statuses.rs b/atrium-api/src/tools/ozone/moderation/query_statuses.rs index 1ffc065b..42694dbf 100644 --- a/atrium-api/src/tools/ozone/moderation/query_statuses.rs +++ b/atrium-api/src/tools/ozone/moderation/query_statuses.rs @@ -16,6 +16,9 @@ pub struct ParametersData { pub exclude_tags: Option>, #[serde(skip_serializing_if = "Option::is_none")] pub ignore_subjects: Option>, + ///All subjects belonging to the account specified in the 'subject' param will be returned. + #[serde(skip_serializing_if = "Option::is_none")] + pub include_all_user_records: Option, ///By default, we don't include muted subjects in the results. Set this to true to include them. #[serde(skip_serializing_if = "Option::is_none")] pub include_muted: Option, @@ -46,6 +49,7 @@ pub struct ParametersData { pub sort_direction: Option, #[serde(skip_serializing_if = "Option::is_none")] pub sort_field: Option, + ///The subject to get the status for. #[serde(skip_serializing_if = "Option::is_none")] pub subject: Option, #[serde(skip_serializing_if = "Option::is_none")] diff --git a/bsky-sdk/src/moderation/tests.rs b/bsky-sdk/src/moderation/tests.rs index 4babf73d..df9218c4 100644 --- a/bsky-sdk/src/moderation/tests.rs +++ b/bsky-sdk/src/moderation/tests.rs @@ -77,6 +77,7 @@ fn post_view(author: &ProfileViewBasic, text: &str, labels: Option>) indexed_at: Datetime::now(), labels, like_count: None, + quote_count: None, record: atrium_api::app::bsky::feed::post::Record::from( atrium_api::app::bsky::feed::post::RecordData { created_at: Datetime::now(), diff --git a/bsky-sdk/src/moderation/tests/quoteposts.rs b/bsky-sdk/src/moderation/tests/quoteposts.rs index e7b7c6cb..6e507f82 100644 --- a/bsky-sdk/src/moderation/tests/quoteposts.rs +++ b/bsky-sdk/src/moderation/tests/quoteposts.rs @@ -28,6 +28,7 @@ fn embed_record_view( indexed_at: Datetime::now(), labels, like_count: None, + quote_count: None, reply_count: None, repost_count: None, uri: format!("at://{}/app.bsky.feed.post/fake", author.did.as_ref()), diff --git a/bsky-sdk/src/record.rs b/bsky-sdk/src/record.rs index 2e79396a..dd7a59e7 100644 --- a/bsky-sdk/src/record.rs +++ b/bsky-sdk/src/record.rs @@ -5,7 +5,9 @@ use crate::error::{Error, Result}; use crate::BskyAgent; use async_trait::async_trait; use atrium_api::agent::store::SessionStore; -use atrium_api::com::atproto::repo::{create_record, get_record, list_records, put_record}; +use atrium_api::com::atproto::repo::{ + create_record, delete_record, get_record, list_records, put_record, +}; use atrium_api::types::{Collection, LimitedNonZeroU8, TryIntoUnknown}; use atrium_api::xrpc::XrpcClient; @@ -24,7 +26,7 @@ where async fn get(agent: &BskyAgent, rkey: String) -> Result; async fn put(self, agent: &BskyAgent, rkey: String) -> Result; async fn create(self, agent: &BskyAgent) -> Result; - async fn delete(agent: &BskyAgent, rkey: String) -> Result<()>; + async fn delete(agent: &BskyAgent, rkey: String) -> Result; } macro_rules! record_impl { @@ -124,7 +126,10 @@ macro_rules! record_impl { ) .await?) } - async fn delete(agent: &BskyAgent, rkey: String) -> Result<()> { + async fn delete( + agent: &BskyAgent, + rkey: String, + ) -> Result { let session = agent.get_session().await.ok_or(Error::NotLoggedIn)?; Ok(agent .api @@ -172,7 +177,10 @@ macro_rules! record_impl { async fn create(self, agent: &BskyAgent) -> Result { <$record>::from(self).create(agent).await } - async fn delete(agent: &BskyAgent, rkey: String) -> Result<()> { + async fn delete( + agent: &BskyAgent, + rkey: String, + ) -> Result { <$record>::delete(agent, rkey).await } } @@ -199,6 +207,11 @@ record_impl!( atrium_api::app::bsky::feed::post::Record, atrium_api::app::bsky::feed::post::RecordData ); +record_impl!( + atrium_api::app::bsky::feed::Postgate, + atrium_api::app::bsky::feed::postgate::Record, + atrium_api::app::bsky::feed::postgate::RecordData +); record_impl!( atrium_api::app::bsky::feed::Repost, atrium_api::app::bsky::feed::repost::Record, @@ -273,22 +286,24 @@ mod tests { Response>, Box, > { - match request.uri().path() { + let body = match request.uri().path() { "/xrpc/com.atproto.repo.createRecord" => { - let output = create_record::Output::from(create_record::OutputData { + serde_json::to_vec(&create_record::OutputData { cid: FAKE_CID.parse().expect("invalid cid"), + commit: None, uri: String::from("at://did:fake:handle.test/app.bsky.feed.post/somerkey"), - }); - Ok(Response::builder() - .header(Header::ContentType, "application/json") - .status(200) - .body(serde_json::to_vec(&output)?)?) + validation_status: None, + })? } "/xrpc/com.atproto.repo.deleteRecord" => { - Ok(Response::builder().status(200).body(Vec::new())?) + serde_json::to_vec(&delete_record::OutputData { commit: None })? } _ => unreachable!(), - } + }; + Ok(Response::builder() + .header(Header::ContentType, "application/json") + .status(200) + .body(body)?) } } @@ -346,7 +361,9 @@ mod tests { output, create_record::OutputData { cid: FAKE_CID.parse().expect("invalid cid"), + commit: None, uri: String::from("at://did:fake:handle.test/app.bsky.feed.post/somerkey"), + validation_status: None, } .into() ); @@ -380,7 +397,9 @@ mod tests { output, create_record::OutputData { cid: FAKE_CID.parse().expect("invalid cid"), + commit: None, uri: String::from("at://did:fake:handle.test/app.bsky.feed.post/somerkey"), + validation_status: None, } .into() ); @@ -406,7 +425,9 @@ mod tests { output, create_record::OutputData { cid: FAKE_CID.parse().expect("invalid cid"), + commit: None, uri: String::from("at://did:fake:handle.test/app.bsky.feed.post/somerkey"), + validation_status: None, } .into() ); diff --git a/bsky-sdk/src/record/agent.rs b/bsky-sdk/src/record/agent.rs index 2f8a4506..5199681e 100644 --- a/bsky-sdk/src/record/agent.rs +++ b/bsky-sdk/src/record/agent.rs @@ -2,7 +2,7 @@ use super::Record; use crate::error::{Error, Result}; use crate::BskyAgent; use atrium_api::agent::store::SessionStore; -use atrium_api::com::atproto::repo::create_record; +use atrium_api::com::atproto::repo::{create_record, delete_record}; use atrium_api::record::KnownRecord; use atrium_api::types::string::RecordKey; use atrium_api::xrpc::XrpcClient; @@ -39,6 +39,7 @@ where KnownRecord::AppBskyFeedGenerator(record) => record.data.create(self).await, KnownRecord::AppBskyFeedLike(record) => record.data.create(self).await, KnownRecord::AppBskyFeedPost(record) => record.data.create(self).await, + KnownRecord::AppBskyFeedPostgate(record) => record.data.create(self).await, KnownRecord::AppBskyFeedRepost(record) => record.data.create(self).await, KnownRecord::AppBskyFeedThreadgate(record) => record.data.create(self).await, KnownRecord::AppBskyGraphBlock(record) => record.data.create(self).await, @@ -69,7 +70,7 @@ where /// Ok(()) /// } /// ``` - pub async fn delete_record(&self, at_uri: impl AsRef) -> Result<()> { + pub async fn delete_record(&self, at_uri: impl AsRef) -> Result { let parts = at_uri .as_ref() .strip_prefix("at://")