Noreposts Feed
at main 71 lines 1.6 kB view raw
1use chrono::{DateTime, Utc}; 2use serde::{Deserialize, Serialize}; 3 4#[derive(Debug, Deserialize)] 5pub struct FeedSkeletonParams { 6 pub feed: String, 7 pub limit: Option<i32>, 8 pub cursor: Option<String>, 9} 10 11#[derive(Debug, Serialize)] 12pub struct FeedSkeletonResponse { 13 pub cursor: Option<String>, 14 pub feed: Vec<SkeletonFeedPost>, 15} 16 17#[derive(Debug, Serialize)] 18pub struct SkeletonFeedPost { 19 pub post: String, 20} 21 22#[derive(Debug, Serialize)] 23pub struct DidDocument { 24 #[serde(rename = "@context")] 25 pub context: Vec<String>, 26 pub id: String, 27 pub service: Vec<ServiceEndpoint>, 28} 29 30#[derive(Debug, Serialize)] 31pub struct ServiceEndpoint { 32 pub id: String, 33 #[serde(rename = "type")] 34 pub service_type: String, 35 #[serde(rename = "serviceEndpoint")] 36 pub service_endpoint: String, 37} 38 39#[derive(Debug, Clone)] 40pub struct Post { 41 pub uri: String, 42 pub cid: String, 43 pub author_did: String, 44 pub text: String, 45 pub created_at: DateTime<Utc>, 46 pub indexed_at: DateTime<Utc>, 47} 48 49#[derive(Debug, Clone)] 50pub struct Follow { 51 pub uri: String, 52 pub follower_did: String, 53 pub target_did: String, 54 pub created_at: DateTime<Utc>, 55 pub indexed_at: DateTime<Utc>, 56} 57 58// JWT Claims 59#[derive(Debug, Serialize, Deserialize)] 60pub struct JwtClaims { 61 pub iss: String, // issuer (user DID) 62 pub aud: String, // audience (feed generator DID) 63 pub exp: i64, // expiration time 64} 65 66// ATProto Error Response 67#[derive(Debug, Serialize)] 68pub struct ErrorResponse { 69 pub error: String, 70 pub message: String, 71}