1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// This file is generated by atrium-codegen. DO NOT EDIT.
//!Definitions for the `com.atproto.sync.subscribeRepos` namespace.
pub const NSID: &str = "com.atproto.sync.subscribeRepos";
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Parameters {
    ///The last known event seq number to backfill from.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cursor: Option<i64>,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "error", content = "message")]
pub enum Error {
    FutureCursor(Option<String>),
    ///If the consumer of the stream can not keep up with events, and a backlog gets too large, the server will drop the connection.
    ConsumerTooSlow(Option<String>),
}
impl std::fmt::Display for Error {
    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Error::FutureCursor(msg) => {
                write!(_f, "FutureCursor")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
            Error::ConsumerTooSlow(msg) => {
                write!(_f, "ConsumerTooSlow")?;
                if let Some(msg) = msg {
                    write!(_f, ": {msg}")?;
                }
            }
        }
        Ok(())
    }
}
///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.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Commit {
    pub blobs: Vec<crate::types::CidLink>,
    ///CAR file containing relevant blocks, as a diff since the previous repo state.
    #[serde(with = "serde_bytes")]
    pub blocks: Vec<u8>,
    ///Repo commit object CID.
    pub commit: crate::types::CidLink,
    pub ops: Vec<RepoOp>,
    ///DEPRECATED -- unused. WARNING -- nullable and optional; stick with optional to ensure golang interoperability.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub prev: Option<crate::types::CidLink>,
    ///DEPRECATED -- unused
    pub rebase: bool,
    ///The repo this event comes from.
    pub repo: crate::types::string::Did,
    ///The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event.
    pub rev: String,
    ///The stream sequence number of this message.
    pub seq: i64,
    ///The rev of the last emitted commit from this repo (if any).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub since: Option<String>,
    ///Timestamp of when this message was originally broadcast.
    pub time: crate::types::string::Datetime,
    ///Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data.
    pub too_big: bool,
}
///Represents an update of the account's handle, or transition to/from invalid state. NOTE: Will be deprecated in favor of #identity.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Handle {
    pub did: crate::types::string::Did,
    pub handle: crate::types::string::Handle,
    pub seq: i64,
    pub time: crate::types::string::Datetime,
}
///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.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Identity {
    pub did: crate::types::string::Did,
    pub seq: i64,
    pub time: crate::types::string::Datetime,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Info {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
    pub name: String,
}
///Represents an account moving from one PDS instance to another. NOTE: not implemented; account migration uses #identity instead
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Migrate {
    pub did: crate::types::string::Did,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub migrate_to: Option<String>,
    pub seq: i64,
    pub time: crate::types::string::Datetime,
}
///A repo operation, ie a mutation of a single record.
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct RepoOp {
    pub action: String,
    ///For creates and updates, the new record CID. For deletions, null.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub cid: Option<crate::types::CidLink>,
    pub path: String,
}
///Indicates that an account has been deleted. NOTE: may be deprecated in favor of #identity or a future #account event
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct Tombstone {
    pub did: crate::types::string::Did,
    pub seq: i64,
    pub time: crate::types::string::Datetime,
}
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(tag = "$type")]
pub enum Message {
    #[serde(rename = "com.atproto.sync.subscribeRepos#commit")]
    Commit(Box<Commit>),
    #[serde(rename = "com.atproto.sync.subscribeRepos#identity")]
    Identity(Box<Identity>),
    #[serde(rename = "com.atproto.sync.subscribeRepos#handle")]
    Handle(Box<Handle>),
    #[serde(rename = "com.atproto.sync.subscribeRepos#migrate")]
    Migrate(Box<Migrate>),
    #[serde(rename = "com.atproto.sync.subscribeRepos#tombstone")]
    Tombstone(Box<Tombstone>),
    #[serde(rename = "com.atproto.sync.subscribeRepos#info")]
    Info(Box<Info>),
}