Skip to content

Commit

Permalink
feat(bsky-sdk): Add record operations (#200)
Browse files Browse the repository at this point in the history
* sdk: Add Record trait and implementations

* Add create_record/delete_record to BskyAgent
  • Loading branch information
sugyan authored Jul 19, 2024
1 parent 017124a commit 9060655
Show file tree
Hide file tree
Showing 5 changed files with 680 additions and 2 deletions.
4 changes: 4 additions & 0 deletions bsky-sdk/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ use thiserror::Error;
/// Error type for this crate.
#[derive(Error, Debug)]
pub enum Error {
#[error("not logged in")]
NotLoggedIn,
#[error("invalid AT URI")]
InvalidAtUri,
#[error("xrpc response error: {0}")]
Xrpc(Box<GenericXrpcError>),
#[error("loading config error: {0}")]
Expand Down
3 changes: 3 additions & 0 deletions bsky-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod agent;
mod error;
pub mod moderation;
pub mod preference;
pub mod record;
#[cfg_attr(docsrs, doc(cfg(feature = "rich-text")))]
#[cfg(feature = "rich-text")]
pub mod rich_text;
Expand All @@ -19,6 +20,8 @@ mod tests {
use atrium_api::xrpc::types::Header;
use atrium_api::xrpc::{HttpClient, XrpcClient};

pub const FAKE_CID: &str = "bafyreiclp443lavogvhj3d2ob2cxbfuscni2k5jk7bebjzg7khl3esabwq";

pub struct MockClient;

#[async_trait]
Expand Down
3 changes: 1 addition & 2 deletions bsky-sdk/src/moderation/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ use crate::moderation::decision::{DecisionContext, ModerationDecision};
use crate::moderation::types::*;
use crate::moderation::util::interpret_label_value_definition;
use crate::moderation::Moderator;
use crate::tests::FAKE_CID;
use atrium_api::app::bsky::actor::defs::{ProfileViewBasic, ProfileViewBasicData};
use atrium_api::app::bsky::feed::defs::{PostView, PostViewData};
use atrium_api::com::atproto::label::defs::{Label, LabelData, LabelValueDefinitionData};
use atrium_api::records::{KnownRecord, Record};
use atrium_api::types::string::Datetime;
use std::collections::HashMap;

const FAKE_CID: &str = "bafyreiclp443lavogvhj3d2ob2cxbfuscni2k5jk7bebjzg7khl3esabwq";

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum ResultFlag {
Filter,
Expand Down
Loading

0 comments on commit 9060655

Please sign in to comment.