pr_01m47d15m3e54sn21z27rpy5n9/crates/contracts/src/events.rs
Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Rust repos service with shipping; pull requests kept in the model | 1 | //! Events published on the bus. Mirrors `packages/contracts/src/events.ts`. |
| 2 | ||
| 3 | use serde::Serialize; | |
| 4 | ||
| 5 | /// What a publisher supplies; the bus fills in the id and time. | |
| 6 | #[derive(Debug, Serialize)] | |
| 7 | #[serde(rename_all = "camelCase")] | |
| 8 | pub struct NewEvent<T: Serialize> { | |
| 9 | #[serde(rename = "type")] | |
| 10 | pub kind: &'static str, | |
| 11 | /// The service that published it. | |
| 12 | pub source: &'static str, | |
| 13 | /// The repo the event concerns. | |
| 14 | pub repo_id: Option<String>, | |
| 15 | /// The user or agent that caused it, if any. | |
| 16 | pub actor: Option<String>, | |
| 17 | pub data: T, | |
| 18 | } | |
| 19 | ||
| 20 | #[derive(Debug, Serialize)] | |
| 21 | #[serde(rename_all = "camelCase")] | |
| 22 | pub struct RepoCreated { | |
| 23 | pub repo_id: String, | |
| 24 | pub namespace: String, | |
| 25 | pub name: String, | |
| 26 | pub is_private: bool, | |
| 27 | } | |
| 28 | ||
| 29 | #[derive(Debug, Serialize)] | |
| 30 | #[serde(rename_all = "camelCase")] | |
| 31 | pub struct RepoForked { | |
| 32 | pub repo_id: String, | |
| 33 | pub source_repo_id: String, | |
| 34 | pub attempt_id: String, | |
| 35 | } | |
| 36 | ||
| 37 | /// `after` is the commit the ref points to once the push has landed. | |
| 38 | #[derive(Debug, Serialize)] | |
| 39 | #[serde(rename_all = "camelCase")] | |
| 40 | pub struct GitPush { | |
| 41 | pub repo_id: String, | |
| 42 | #[serde(rename = "ref")] | |
| 43 | pub git_ref: String, | |
| 44 | pub after: String, | |
| 45 | } |