summaryrefslogtreecommitdiffstats
path: root/adenosine-pds/src/models.rs
diff options
context:
space:
mode:
Diffstat (limited to 'adenosine-pds/src/models.rs')
-rw-r--r--adenosine-pds/src/models.rs136
1 files changed, 136 insertions, 0 deletions
diff --git a/adenosine-pds/src/models.rs b/adenosine-pds/src/models.rs
index f172819..116ac53 100644
--- a/adenosine-pds/src/models.rs
+++ b/adenosine-pds/src/models.rs
@@ -1,3 +1,7 @@
+use serde_json::Value;
+
+// =========== com.atproto types (manually entered)
+
#[allow(non_snake_case)]
#[derive(Debug, serde::Deserialize, serde::Serialize, PartialEq, Eq)]
pub struct AccountRequest {
@@ -49,3 +53,135 @@ pub struct RepoBatchWrite {
pub rkey: Option<String>,
pub value: serde_json::Value,
}
+
+// =========== app.bsky types (manually entered)
+
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct Subject {
+ pub uri: String,
+ pub cid: String,
+}
+
+/// Generic over Re-post and Like
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct RefRecord {
+ pub subject: Subject,
+ pub createdAt: String,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct FollowSubject {
+ pub did: String,
+ // pub declarationCid: String,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct FollowRecord {
+ pub subject: FollowSubject,
+ pub createdAt: String,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct ProfileRecord {
+ pub displayName: String,
+ pub description: Option<String>,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct Profile {
+ pub did: String,
+ pub handle: String,
+ pub displayName: Option<String>,
+ pub description: Option<String>,
+ pub followersCount: u64,
+ pub followsCount: u64,
+ pub postsCount: u64,
+ pub myState: serde_json::Value,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct GenericFeed {
+ pub feed: Vec<FeedItem>,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct User {
+ pub did: String,
+ pub handle: String,
+ pub displayName: Option<String>,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct FeedItem {
+ pub uri: String,
+ pub cid: String,
+ pub author: User,
+ pub repostedBy: Option<User>,
+ pub record: Value,
+ //pub embed?: RecordEmbed | ExternalEmbed | UnknownEmbed,
+ pub embed: Option<Value>,
+ pub replyCount: u64,
+ pub repostCount: u64,
+ pub likeCount: u64,
+ pub indexedAt: String,
+ pub myState: Option<Value>,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct Post {
+ pub text: String,
+ pub createdAt: Option<String>,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct PostThread {
+ pub thread: ThreadItem,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct ThreadItem {
+ pub uri: String,
+ pub cid: String,
+ pub author: User,
+ pub record: Value,
+ //pub embed?: RecordEmbed | ExternalEmbed | UnknownEmbed,
+ pub embed: Option<Value>,
+ pub parent: Box<ThreadItem>,
+ pub replyCount: u64,
+ pub replies: Option<Vec<ThreadItem>>,
+ pub likeCount: u64,
+ pub repostCount: u64,
+ pub indexedAt: String,
+ pub myState: Option<Value>,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct FollowTarget {
+ // TODO: nested follow list?
+ pub subject: Subject,
+ pub did: String,
+ pub handle: String,
+ pub displayName: Option<String>,
+ pub createdAt: Option<String>,
+ pub indexedAt: String,
+}
+
+#[allow(non_snake_case)]
+#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, PartialEq, Eq)]
+pub struct Follow {
+ // TODO: nested follow list?
+ pub subject: Subject,
+ pub follows: FollowTarget,
+}