Skip to content

Commit

Permalink
feat: Update API, based on the latest lexicon schemas (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
sugyan authored Feb 9, 2024
1 parent d1c19a4 commit 1cc104f
Show file tree
Hide file tree
Showing 23 changed files with 505 additions and 71 deletions.
8 changes: 8 additions & 0 deletions atrium-api/src/app/bsky/actor/defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ pub struct FeedViewPref {
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct InterestsPref {
///A list of tags which describe the account owner's interests gathered during onboarding.
pub tags: Vec<String>,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct PersonalDetailsPref {
///The birth date of account owner.
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -148,4 +154,6 @@ pub enum PreferencesItem {
FeedViewPref(Box<FeedViewPref>),
#[serde(rename = "app.bsky.actor.defs#threadViewPref")]
ThreadViewPref(Box<ThreadViewPref>),
#[serde(rename = "app.bsky.actor.defs#interestsPref")]
InterestsPref(Box<InterestsPref>),
}
1 change: 1 addition & 0 deletions atrium-api/src/app/bsky/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub mod get_list_blocks;
pub mod get_list_mutes;
pub mod get_lists;
pub mod get_mutes;
pub mod get_relationships;
pub mod get_suggested_follows_by_actor;
pub mod list;
pub mod listblock;
Expand Down
19 changes: 19 additions & 0 deletions atrium-api/src/app/bsky/graph/defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,22 @@ pub struct ListViewerState {
}
///A list of actors to apply an aggregate moderation action (mute/block) on.
pub struct Modlist;
///indicates that a handle or DID could not be resolved
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct NotFoundActor {
pub actor: String,
pub not_found: bool,
}
///lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object)
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Relationship {
pub did: String,
///if the actor is followed by this DID, contains the AT-URI of the follow record
#[serde(skip_serializing_if = "Option::is_none")]
pub followed_by: Option<String>,
///if the actor follows this DID, this is the AT-URI of the follow record
#[serde(skip_serializing_if = "Option::is_none")]
pub following: Option<String>,
}
30 changes: 30 additions & 0 deletions atrium-api/src/app/bsky/graph/get_relationships.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
//!Definitions for the `app.bsky.graph.getRelationships` namespace.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {
pub actor: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub others: Option<Vec<String>>,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Output {
#[serde(skip_serializing_if = "Option::is_none")]
pub actor: Option<String>,
pub relationships: Vec<OutputRelationshipsItem>,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {
///the primary actor at-identifier could not be resolved
ActorNotFound(Option<String>),
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "$type")]
pub enum OutputRelationshipsItem {
#[serde(rename = "app.bsky.graph.defs#relationship")]
AppBskyGraphDefsRelationship(Box<crate::app::bsky::graph::defs::Relationship>),
#[serde(rename = "app.bsky.graph.defs#notFoundActor")]
AppBskyGraphDefsNotFoundActor(Box<crate::app::bsky::graph::defs::NotFoundActor>),
}
3 changes: 1 addition & 2 deletions atrium-api/src/app/bsky/unspecced.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
//!Definitions for the `app.bsky.unspecced` namespace.
pub mod defs;
pub mod get_popular;
pub mod get_popular_feed_generators;
pub mod get_timeline_skeleton;
pub mod get_tagged_suggestions;
pub mod search_actors_skeleton;
pub mod search_posts_skeleton;
22 changes: 0 additions & 22 deletions atrium-api/src/app/bsky/unspecced/get_popular.rs

This file was deleted.

20 changes: 20 additions & 0 deletions atrium-api/src/app/bsky/unspecced/get_tagged_suggestions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// This file is generated by atrium-codegen. DO NOT EDIT.
//!Definitions for the `app.bsky.unspecced.getTaggedSuggestions` namespace.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Output {
pub suggestions: Vec<Suggestion>,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Suggestion {
pub subject: String,
pub subject_type: String,
pub tag: String,
}
Loading

0 comments on commit 1cc104f

Please sign in to comment.