Skip to main content

proto_blue_api/generated/com/atproto/sync/
subscribeRepos.rs

1// Generated by atproto-codegen. Do not edit.
2//! Lexicon: com.atproto.sync.subscribeRepos
3
4use serde::{Deserialize, Serialize};
5
6/// Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub struct Account {
10    pub active: bool,
11    pub did: String,
12    pub seq: i64,
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub status: Option<String>,
15    pub time: String,
16}
17
18/// Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature.
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(rename_all = "camelCase")]
21pub struct Commit {
22    pub blobs: Vec<String>,
23    pub blocks: Vec<u8>,
24    pub commit: String,
25    pub ops: Vec<RepoOp>,
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub prev_data: Option<String>,
28    pub rebase: bool,
29    pub repo: String,
30    pub rev: String,
31    pub seq: i64,
32    pub since: Option<String>,
33    pub time: String,
34    pub too_big: bool,
35}
36
37/// Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache.
38#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(rename_all = "camelCase")]
40pub struct Identity {
41    pub did: String,
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub handle: Option<String>,
44    pub seq: i64,
45    pub time: String,
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(rename_all = "camelCase")]
50pub struct Info {
51    #[serde(skip_serializing_if = "Option::is_none")]
52    pub message: Option<String>,
53    pub name: String,
54}
55
56/// Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay.
57/// XRPC Subscription: com.atproto.sync.subscribeRepos
58#[derive(Debug, Clone, Serialize, Deserialize)]
59#[serde(rename_all = "camelCase")]
60pub struct Params {
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub cursor: Option<i64>,
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(tag = "$type")]
67pub enum Message {
68    #[serde(rename = "com.atproto.sync.subscribeRepos#commit")]
69    SyncSubscribeReposCommit(Box<Commit>),
70    #[serde(rename = "com.atproto.sync.subscribeRepos#sync")]
71    SyncSubscribeReposSync(Box<Sync>),
72    #[serde(rename = "com.atproto.sync.subscribeRepos#identity")]
73    SyncSubscribeReposIdentity(Box<Identity>),
74    #[serde(rename = "com.atproto.sync.subscribeRepos#account")]
75    SyncSubscribeReposAccount(Box<Account>),
76    #[serde(rename = "com.atproto.sync.subscribeRepos#info")]
77    SyncSubscribeReposInfo(Box<Info>),
78    #[serde(other)]
79    Other,
80}
81
82/// A repo operation, ie a mutation of a single record.
83#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(rename_all = "camelCase")]
85pub struct RepoOp {
86    pub action: String,
87    pub cid: Option<String>,
88    pub path: String,
89    #[serde(skip_serializing_if = "Option::is_none")]
90    pub prev: Option<String>,
91}
92
93/// Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository.
94#[derive(Debug, Clone, Serialize, Deserialize)]
95#[serde(rename_all = "camelCase")]
96pub struct Sync {
97    pub blocks: Vec<u8>,
98    pub did: String,
99    pub rev: String,
100    pub seq: i64,
101    pub time: String,
102}