| 8d2caf12 Andy McCall ↶ |
1 |
|
| d23464c0 Andy McCall ↶ |
2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| b64e2537 Andy McCall ↶ |
9 |
use schemars::JsonSchema; |
| d23464c0 Andy McCall ↶ |
10 |
use serde::{Deserialize, Serialize}; |
| 11 |
|
| 12 |
|
| b64e2537 Andy McCall ↶ |
13 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| d23464c0 Andy McCall ↶ |
14 |
pub struct Repository { |
| 15 |
pub owner: String, |
| 16 |
pub name: String, |
| 17 |
pub description: String, |
| 18 |
pub default_bookmark: String, |
| 19 |
pub visibility: Visibility, |
| 20 |
|
| 21 |
pub created_ms: i64, |
| 22 |
pub updated_ms: i64, |
| 23 |
|
| 24 |
pub clone_url: String, |
| 25 |
} |
| 26 |
|
| b64e2537 Andy McCall ↶ |
27 |
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| d23464c0 Andy McCall ↶ |
28 |
#[serde(rename_all = "lowercase")] |
| 29 |
pub enum Visibility { |
| 30 |
Public, |
| 31 |
Internal, |
| 32 |
Private, |
| 33 |
} |
| 34 |
|
| 35 |
impl Visibility { |
| 36 |
pub fn as_str(self) -> &'static str { |
| 37 |
match self { |
| 38 |
Visibility::Public => "public", |
| 39 |
Visibility::Internal => "internal", |
| 40 |
Visibility::Private => "private", |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
pub fn parse(s: &str) -> Option<Visibility> { |
| 45 |
Some(match s { |
| 46 |
"public" => Visibility::Public, |
| 47 |
"internal" => Visibility::Internal, |
| 48 |
"private" => Visibility::Private, |
| 49 |
_ => return None, |
| 50 |
}) |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
|
| b64e2537 Andy McCall ↶ |
55 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| d23464c0 Andy McCall ↶ |
56 |
pub struct Bookmark { |
| 57 |
pub name: String, |
| 58 |
pub heads: Vec<String>, |
| 59 |
|
| 60 |
pub changes: usize, |
| 61 |
pub default: bool, |
| 62 |
} |
| 63 |
|
| 64 |
|
| b64e2537 Andy McCall ↶ |
65 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| d23464c0 Andy McCall ↶ |
66 |
pub struct Tag { |
| 67 |
pub name: String, |
| 68 |
pub heads: Vec<String>, |
| 69 |
pub message: String, |
| 70 |
pub signer: Option<String>, |
| 71 |
} |
| 72 |
|
| 73 |
|
| b64e2537 Andy McCall ↶ |
74 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| d23464c0 Andy McCall ↶ |
75 |
pub struct ChangeSummary { |
| 76 |
pub hash: String, |
| 77 |
pub message: String, |
| 78 |
pub author: Author, |
| 79 |
pub when_ms: u64, |
| 80 |
pub deps: Vec<String>, |
| 81 |
pub head: bool, |
| 82 |
pub signature: Signature, |
| 8933faff Andy McCall ↶ |
83 |
|
| 84 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 85 |
pub via: Option<Via>, |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 90 |
pub struct Via { |
| 91 |
pub name: String, |
| 92 |
pub key: String, |
| 93 |
|
| 94 |
pub scope: String, |
| 95 |
pub expires_ms: Option<u64>, |
| 96 |
|
| 97 |
pub revoked: bool, |
| d23464c0 Andy McCall ↶ |
98 |
} |
| 99 |
|
| 100 |
|
| 101 |
|
| b64e2537 Andy McCall ↶ |
102 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| d23464c0 Andy McCall ↶ |
103 |
pub struct Author { |
| 104 |
pub name: String, |
| 105 |
pub email: String, |
| 106 |
pub key: String, |
| 107 |
|
| 108 |
pub account: Option<String>, |
| 760a7dd3 Andy McCall ↶ |
109 |
|
| 110 |
|
| 111 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 112 |
pub note: Option<String>, |
| 113 |
} |
| 114 |
|
| 115 |
impl Author { |
| 116 |
|
| 117 |
pub const UNLINKED: &'static str = |
| 118 |
"signed by a key not linked to any account; its owner links it under Settings → Keys (/settings/keys)"; |
| 119 |
|
| 120 |
|
| 121 |
pub fn note_for(key: &str, account: &Option<String>) -> Option<String> { |
| 122 |
(!key.is_empty() && account.is_none()).then(|| Self::UNLINKED.to_string()) |
| 123 |
} |
| d23464c0 Andy McCall ↶ |
124 |
} |
| 125 |
|
| 126 |
|
| b64e2537 Andy McCall ↶ |
127 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| d23464c0 Andy McCall ↶ |
128 |
#[serde(tag = "status", rename_all = "lowercase")] |
| 129 |
pub enum Signature { |
| 130 |
Unsigned, |
| 131 |
Valid { key: String, sealed: bool, revoked: bool }, |
| 132 |
Invalid { reason: String }, |
| 133 |
} |
| 134 |
|
| 135 |
|
| b64e2537 Andy McCall ↶ |
136 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| d23464c0 Andy McCall ↶ |
137 |
pub struct Problem { |
| 138 |
pub status: u16, |
| 139 |
pub title: String, |
| 140 |
pub detail: String, |
| 141 |
} |
| 142 |
|
| 143 |
#[cfg(test)] |
| 144 |
mod tests { |
| 145 |
use super::*; |
| 146 |
|
| 147 |
#[test] |
| 148 |
fn visibility_round_trips() { |
| 149 |
for v in [Visibility::Public, Visibility::Internal, Visibility::Private] { |
| 150 |
assert_eq!(Visibility::parse(v.as_str()), Some(v)); |
| 151 |
} |
| 152 |
assert_eq!(Visibility::parse("secret"), None); |
| 153 |
} |
| 154 |
} |
| de505df5 Andy McCall ↶ |
155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| b64e2537 Andy McCall ↶ |
159 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| de505df5 Andy McCall ↶ |
160 |
pub struct Proposal { |
| 161 |
pub number: i64, |
| 162 |
pub title: String, |
| 163 |
pub body: String, |
| 164 |
pub author: String, |
| 165 |
pub state: ProposalState, |
| 166 |
pub target: String, |
| 167 |
pub source: ProposalSource, |
| 168 |
|
| 169 |
pub changes: Vec<ChangeSummary>, |
| 170 |
|
| 171 |
pub projected_heads: Vec<String>, |
| 172 |
pub projected_state: Option<String>, |
| 173 |
pub conflicted: bool, |
| 174 |
pub approvals: Vec<Approval>, |
| 175 |
pub landable: bool, |
| 176 |
pub blockers: Vec<String>, |
| 177 |
pub created_ms: i64, |
| 178 |
pub updated_ms: i64, |
| 179 |
|
| 180 |
pub url: String, |
| 181 |
|
| 182 |
pub repository_url: String, |
| 183 |
|
| 184 |
pub source_url: Option<String>, |
| 0b20f1ec Andy McCall ↶ |
185 |
|
| 186 |
#[serde(default)] |
| 187 |
pub landed: Option<Landed>, |
| 86a69b53 Andy McCall ↶ |
188 |
|
| 189 |
#[serde(default)] |
| 190 |
pub auto_land: Option<String>, |
| cc1cd197 Andy McCall ↶ |
191 |
|
| 192 |
#[serde(default)] |
| 193 |
pub requested_reviewers: Vec<String>, |
| 2291f8cc Andy McCall ↶ |
194 |
#[serde(default)] |
| 195 |
pub labels: Vec<Label>, |
| 0b20f1ec Andy McCall ↶ |
196 |
} |
| 197 |
|
| 198 |
|
| 199 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 200 |
pub struct Landed { |
| 201 |
pub by: String, |
| 202 |
|
| 203 |
pub via: String, |
| 204 |
pub when_ms: i64, |
| de505df5 Andy McCall ↶ |
205 |
} |
| 206 |
|
| b64e2537 Andy McCall ↶ |
207 |
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| de505df5 Andy McCall ↶ |
208 |
#[serde(rename_all = "lowercase")] |
| 209 |
pub enum ProposalState { |
| 210 |
Draft, |
| 211 |
Open, |
| 212 |
Landed, |
| 213 |
Closed, |
| 214 |
} |
| 215 |
|
| 216 |
impl ProposalState { |
| 217 |
pub fn as_str(self) -> &'static str { |
| 218 |
match self { |
| 219 |
ProposalState::Draft => "draft", |
| 220 |
ProposalState::Open => "open", |
| 221 |
ProposalState::Landed => "landed", |
| 222 |
ProposalState::Closed => "closed", |
| 223 |
} |
| 224 |
} |
| 225 |
|
| 226 |
pub fn parse(s: &str) -> Option<ProposalState> { |
| 227 |
Some(match s { |
| 228 |
"draft" => ProposalState::Draft, |
| 229 |
"open" => ProposalState::Open, |
| 230 |
"landed" => ProposalState::Landed, |
| 231 |
"closed" => ProposalState::Closed, |
| 232 |
_ => return None, |
| 233 |
}) |
| 234 |
} |
| 235 |
} |
| 236 |
|
| b64e2537 Andy McCall ↶ |
237 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| de505df5 Andy McCall ↶ |
238 |
#[serde(tag = "kind", rename_all = "lowercase")] |
| 239 |
pub enum ProposalSource { |
| 240 |
|
| 241 |
Bookmark { bookmark: String }, |
| 242 |
|
| 243 |
Fork { owner: String, name: String, bookmark: String }, |
| 244 |
|
| 245 |
Changes { hashes: Vec<String> }, |
| 246 |
} |
| 247 |
|
| 248 |
|
| 249 |
|
| b64e2537 Andy McCall ↶ |
250 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| de505df5 Andy McCall ↶ |
251 |
pub struct Approval { |
| 252 |
pub account: String, |
| 253 |
pub sealed: bool, |
| 254 |
pub key: Option<String>, |
| 255 |
} |
| b64e2537 Andy McCall ↶ |
256 |
|
| 257 |
|
| 258 |
|
| 259 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 260 |
pub struct Issue { |
| 261 |
pub number: i64, |
| 262 |
pub title: String, |
| 263 |
pub body: String, |
| 264 |
pub author: String, |
| 265 |
pub state: String, |
| 266 |
pub reason: String, |
| 267 |
pub labels: Vec<Label>, |
| 268 |
pub assignees: Vec<String>, |
| 269 |
pub milestone: Option<String>, |
| 270 |
pub comments: i64, |
| 271 |
pub locked: bool, |
| 272 |
pub pinned: bool, |
| 273 |
pub created_ms: i64, |
| 274 |
pub updated_ms: i64, |
| 275 |
pub closed_ms: Option<i64>, |
| 276 |
pub url: String, |
| 277 |
} |
| 278 |
|
| 279 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 280 |
pub struct Label { |
| 281 |
pub name: String, |
| 282 |
pub colour: String, |
| 283 |
pub description: String, |
| 284 |
} |
| 285 |
|
| 286 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 287 |
pub struct Milestone { |
| 288 |
pub title: String, |
| 289 |
pub description: String, |
| 290 |
pub due_ms: Option<i64>, |
| 291 |
pub state: String, |
| 292 |
pub open: i64, |
| 293 |
pub closed: i64, |
| 294 |
} |
| 295 |
|
| 5ea4872f Andy McCall ↶ |
296 |
|
| 297 |
|
| b64e2537 Andy McCall ↶ |
298 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 5ea4872f Andy McCall ↶ |
299 |
pub struct NewMilestone { |
| 300 |
pub title: String, |
| 301 |
#[serde(default)] |
| 302 |
pub description: String, |
| 303 |
|
| 304 |
#[serde(default)] |
| 305 |
pub due: Option<String>, |
| 306 |
} |
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 311 |
pub struct MilestoneEdit { |
| 312 |
#[serde(default)] |
| 313 |
pub title: Option<String>, |
| 314 |
#[serde(default)] |
| 315 |
pub description: Option<String>, |
| 316 |
|
| 317 |
#[serde(default)] |
| 318 |
pub due: Option<String>, |
| 319 |
|
| 320 |
#[serde(default)] |
| 321 |
pub state: Option<String>, |
| 322 |
} |
| 323 |
|
| 324 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| b64e2537 Andy McCall ↶ |
325 |
pub struct Comment { |
| 326 |
pub id: i64, |
| 327 |
pub author: String, |
| 328 |
pub body: String, |
| 329 |
pub created_ms: i64, |
| 330 |
|
| 331 |
pub path: Option<String>, |
| 332 |
pub anchor: Option<Atom>, |
| c0fac31d Andy McCall ↶ |
333 |
|
| 334 |
|
| 335 |
#[serde(default)] |
| 336 |
pub line: Option<usize>, |
| b64e2537 Andy McCall ↶ |
337 |
pub resolved: bool, |
| 338 |
} |
| 339 |
|
| 42a0ba4b Andy McCall ↶ |
340 |
|
| 341 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 342 |
pub struct Notification { |
| 343 |
pub id: i64, |
| 344 |
pub at_ms: i64, |
| 345 |
|
| 346 |
pub kind: String, |
| 347 |
pub title: String, |
| 348 |
|
| 349 |
pub url: String, |
| 350 |
pub actor: String, |
| 351 |
pub read: bool, |
| 352 |
} |
| 353 |
|
| 354 |
|
| 355 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 356 |
pub struct Inbox { |
| 357 |
pub unread: i64, |
| 358 |
pub items: Vec<Notification>, |
| 359 |
} |
| 360 |
|
| 3f02e5ea Andy McCall ↶ |
361 |
|
| 362 |
|
| 363 |
|
| b64e2537 Andy McCall ↶ |
364 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 3f02e5ea Andy McCall ↶ |
365 |
pub struct ProposalFile { |
| 366 |
pub path: String, |
| 367 |
|
| 368 |
pub from: Option<String>, |
| 369 |
|
| 370 |
pub kind: String, |
| 371 |
pub added: usize, |
| 372 |
pub removed: usize, |
| 373 |
} |
| 374 |
|
| 375 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| b64e2537 Andy McCall ↶ |
376 |
pub struct Atom { |
| 377 |
pub change: String, |
| 378 |
pub index: u32, |
| 379 |
} |
| 380 |
|
| 381 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 382 |
pub struct Review { |
| 383 |
pub id: i64, |
| 384 |
pub author: String, |
| 385 |
pub verdict: String, |
| 386 |
pub body: String, |
| 387 |
pub sealed: bool, |
| 388 |
pub created_ms: i64, |
| 7d2eb590 Andy McCall ↶ |
389 |
|
| 390 |
|
| 391 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 392 |
pub via: String, |
| b64e2537 Andy McCall ↶ |
393 |
} |
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 398 |
pub struct TreeEntry { |
| 399 |
pub name: String, |
| 400 |
pub path: String, |
| 401 |
pub kind: String, |
| 402 |
pub exec: bool, |
| 403 |
pub size: Option<u64>, |
| 404 |
pub conflicted: bool, |
| 405 |
} |
| 406 |
|
| 407 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 408 |
pub struct BlameLine { |
| 409 |
pub line: usize, |
| 410 |
pub change: String, |
| 411 |
pub index: u32, |
| 412 |
pub author: String, |
| 413 |
pub when_ms: u64, |
| 414 |
pub text: String, |
| 415 |
} |
| 416 |
|
| 417 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 418 |
pub struct FileChange { |
| 419 |
pub path: String, |
| 420 |
pub kind: String, |
| 421 |
pub from: Option<String>, |
| 422 |
pub added: usize, |
| 423 |
pub removed: usize, |
| 424 |
} |
| 425 |
|
| 426 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 427 |
pub struct ChangeDetail { |
| 428 |
pub change: ChangeSummary, |
| 429 |
pub body: String, |
| 430 |
pub dependents: Vec<String>, |
| 431 |
pub in_bookmarks: Vec<String>, |
| 432 |
pub in_tags: Vec<String>, |
| 433 |
pub files: Vec<FileChange>, |
| 434 |
} |
| 435 |
|
| 436 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 437 |
pub struct History { |
| 438 |
pub reference: String, |
| 439 |
pub heads: Vec<String>, |
| 440 |
pub total: usize, |
| 441 |
pub offset: usize, |
| 442 |
pub changes: Vec<ChangeSummary>, |
| 443 |
} |
| 444 |
|
| 445 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 446 |
pub struct Conflict { |
| 447 |
pub bookmark: String, |
| 448 |
pub path: String, |
| 449 |
pub kind: String, |
| 450 |
pub contributors: Vec<String>, |
| 451 |
} |
| 452 |
|
| 453 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 454 |
pub struct Push { |
| 455 |
pub at_ms: i64, |
| 456 |
pub pusher: String, |
| 457 |
pub reference: String, |
| 458 |
pub ok: bool, |
| 459 |
pub reason: String, |
| 460 |
pub old_state: String, |
| 461 |
pub new_state: String, |
| 462 |
pub heads: i64, |
| 463 |
pub changes: i64, |
| 464 |
} |
| 465 |
|
| 466 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 467 |
pub struct Trust { |
| 468 |
pub policy: Option<Policy>, |
| 469 |
pub signed: usize, |
| 470 |
pub sealed: usize, |
| 471 |
pub unsigned: usize, |
| 472 |
pub invalid: Vec<String>, |
| 473 |
pub hub_key: String, |
| 474 |
} |
| 475 |
|
| 476 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 477 |
pub struct Policy { |
| 478 |
pub serial: u64, |
| 479 |
pub expires_ms: u64, |
| 480 |
pub roots: Vec<String>, |
| 481 |
pub root_threshold: u32, |
| 482 |
pub rules: Vec<Rule>, |
| 483 |
} |
| 484 |
|
| 485 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 486 |
pub struct Rule { |
| 487 |
pub pattern: String, |
| 488 |
pub keys: Vec<String>, |
| 489 |
pub threshold: u32, |
| 490 |
pub require: String, |
| 491 |
pub allow_conflicts: bool, |
| 492 |
} |
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 497 |
pub struct Hook { |
| 498 |
pub id: i64, |
| 499 |
pub url: String, |
| 500 |
pub events: String, |
| 501 |
pub active: bool, |
| 502 |
pub created_ms: i64, |
| 503 |
} |
| 504 |
|
| 505 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 506 |
pub struct NewHook { |
| 507 |
pub url: String, |
| 508 |
pub secret: String, |
| 509 |
#[serde(default = "star")] |
| 510 |
pub events: String, |
| 511 |
} |
| 512 |
|
| 513 |
fn star() -> String { |
| 514 |
"*".into() |
| 515 |
} |
| 516 |
|
| 90326c96 Andy McCall ↶ |
517 |
|
| 518 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 519 |
pub struct FlowRun { |
| 520 |
|
| 521 |
pub number: i64, |
| 522 |
pub bookmark: String, |
| 523 |
|
| 524 |
pub state: String, |
| 525 |
|
| 526 |
pub heads: Vec<String>, |
| 527 |
|
| 528 |
pub status: String, |
| 529 |
|
| 530 |
pub trigger: String, |
| 531 |
pub actor: String, |
| 532 |
pub pipeline_hash: String, |
| 533 |
|
| 534 |
pub error: String, |
| 535 |
pub created_ms: i64, |
| 536 |
pub finished_ms: Option<i64>, |
| 537 |
pub url: String, |
| bf3d0754 Andy McCall ↶ |
538 |
|
| 539 |
|
| 540 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 541 |
pub queue_position: Option<i64>, |
| 90326c96 Andy McCall ↶ |
542 |
|
| 543 |
#[serde(default, skip_serializing_if = "Vec::is_empty")] |
| 544 |
pub jobs: Vec<FlowJob>, |
| 545 |
} |
| 546 |
|
| 547 |
|
| 548 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 549 |
pub struct FlowJob { |
| 550 |
pub name: String, |
| 551 |
|
| 552 |
pub status: String, |
| 553 |
pub depends_on: Vec<String>, |
| 554 |
pub runner: String, |
| 555 |
pub exit_code: Option<i64>, |
| 556 |
pub error: String, |
| 557 |
pub started_ms: Option<i64>, |
| 558 |
pub finished_ms: Option<i64>, |
| 559 |
|
| 560 |
pub log_lines: i64, |
| 4d2e44d7 Andy McCall ↶ |
561 |
|
| 562 |
|
| 563 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 564 |
pub waiting: String, |
| 501d8b26 Andy McCall ↶ |
565 |
|
| 566 |
|
| 567 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 568 |
pub placed: String, |
| 90326c96 Andy McCall ↶ |
569 |
} |
| 570 |
|
| 571 |
|
| 572 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 573 |
pub struct FlowLogLine { |
| 574 |
|
| 575 |
pub seq: i64, |
| 576 |
|
| 577 |
pub t: i64, |
| 578 |
|
| 579 |
pub stream: String, |
| 580 |
pub text: String, |
| 581 |
} |
| 582 |
|
| b64e2537 Andy McCall ↶ |
583 |
|
| 584 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 585 |
pub struct Check { |
| 586 |
pub state: String, |
| 587 |
pub name: String, |
| 588 |
pub status: CheckStatus, |
| 589 |
pub summary: String, |
| 590 |
pub url: String, |
| 591 |
pub reporter: String, |
| 592 |
|
| 593 |
pub seal: Option<String>, |
| 594 |
pub started_ms: i64, |
| 595 |
pub finished_ms: Option<i64>, |
| 596 |
} |
| 597 |
|
| 598 |
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 599 |
#[serde(rename_all = "lowercase")] |
| 600 |
pub enum CheckStatus { |
| 601 |
Queued, |
| 602 |
Running, |
| 603 |
Passed, |
| 604 |
Failed, |
| 605 |
Cancelled, |
| 606 |
Skipped, |
| 607 |
} |
| 608 |
|
| 609 |
impl CheckStatus { |
| 610 |
pub fn as_str(self) -> &'static str { |
| 611 |
match self { |
| 612 |
CheckStatus::Queued => "queued", |
| 613 |
CheckStatus::Running => "running", |
| 614 |
CheckStatus::Passed => "passed", |
| 615 |
CheckStatus::Failed => "failed", |
| 616 |
CheckStatus::Cancelled => "cancelled", |
| 617 |
CheckStatus::Skipped => "skipped", |
| 618 |
} |
| 619 |
} |
| 620 |
|
| 621 |
pub fn parse(s: &str) -> Option<CheckStatus> { |
| 622 |
Some(match s { |
| 623 |
"queued" => CheckStatus::Queued, |
| 624 |
"running" => CheckStatus::Running, |
| 625 |
"passed" => CheckStatus::Passed, |
| 626 |
"failed" => CheckStatus::Failed, |
| 627 |
"cancelled" => CheckStatus::Cancelled, |
| 628 |
"skipped" => CheckStatus::Skipped, |
| 629 |
_ => return None, |
| 630 |
}) |
| 631 |
} |
| 632 |
} |
| 633 |
|
| 634 |
|
| 635 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 636 |
pub struct NewCheck { |
| 637 |
pub state: String, |
| 638 |
pub name: String, |
| 639 |
pub status: CheckStatus, |
| 640 |
#[serde(default)] |
| 641 |
pub summary: String, |
| 642 |
#[serde(default)] |
| 643 |
pub url: String, |
| 644 |
|
| 645 |
#[serde(default)] |
| 646 |
pub seal: Option<String>, |
| 647 |
} |
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 652 |
pub struct User { |
| 653 |
pub username: String, |
| 654 |
pub display_name: String, |
| 655 |
pub is_admin: bool, |
| 656 |
pub keys: Vec<String>, |
| 657 |
pub created_ms: i64, |
| 658 |
} |
| 659 |
|
| 660 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 661 |
pub struct Organisation { |
| 662 |
pub name: String, |
| 663 |
pub display_name: String, |
| 664 |
pub description: String, |
| 665 |
pub members: Vec<String>, |
| 666 |
} |
| 667 |
|
| 668 |
|
| 669 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 670 |
pub struct NewRepository { |
| 671 |
pub owner: String, |
| 672 |
pub name: String, |
| 673 |
#[serde(default)] |
| 674 |
pub description: String, |
| 675 |
#[serde(default = "public")] |
| 676 |
pub visibility: Visibility, |
| 677 |
} |
| 678 |
|
| 679 |
fn public() -> Visibility { |
| 680 |
Visibility::Public |
| 681 |
} |
| 682 |
|
| 683 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 684 |
pub struct NewIssue { |
| 685 |
pub title: String, |
| 686 |
#[serde(default)] |
| 687 |
pub body: String, |
| 76f262e1 Andy McCall ↶ |
688 |
|
| 689 |
#[serde(default)] |
| 690 |
pub labels: Vec<String>, |
| 691 |
|
| 692 |
#[serde(default)] |
| 693 |
pub assignees: Vec<String>, |
| 694 |
|
| 695 |
#[serde(default)] |
| 696 |
pub milestone: Option<String>, |
| b64e2537 Andy McCall ↶ |
697 |
} |
| 698 |
|
| 76f262e1 Andy McCall ↶ |
699 |
|
| 700 |
|
| 701 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 702 |
pub struct IssueEdit { |
| 703 |
#[serde(default)] |
| 704 |
pub title: Option<String>, |
| 705 |
#[serde(default)] |
| 706 |
pub body: Option<String>, |
| 707 |
|
| 708 |
#[serde(default)] |
| 709 |
pub labels: Option<Vec<String>>, |
| 710 |
|
| 711 |
#[serde(default)] |
| 712 |
pub assignees: Option<Vec<String>>, |
| 713 |
|
| 714 |
#[serde(default)] |
| 715 |
pub milestone: Option<String>, |
| 716 |
} |
| 717 |
|
| 961c10be Andy McCall ↶ |
718 |
|
| 719 |
|
| 720 |
|
| 721 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 722 |
pub struct RequiredChecks { |
| 723 |
pub names: Vec<String>, |
| 724 |
} |
| 725 |
|
| ef20fdc1 Andy McCall ↶ |
726 |
|
| 727 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 728 |
pub struct Project { |
| 729 |
pub owner: String, |
| 730 |
pub number: i64, |
| 731 |
pub title: String, |
| 732 |
pub description: String, |
| 733 |
pub public: bool, |
| 734 |
pub closed: bool, |
| 735 |
pub updated_ms: i64, |
| 736 |
|
| 737 |
pub url: String, |
| 738 |
} |
| 739 |
|
| 740 |
|
| 741 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 742 |
pub struct ProjectCard { |
| 743 |
pub id: i64, |
| 744 |
|
| 745 |
pub kind: String, |
| 746 |
|
| 747 |
pub reference: String, |
| 748 |
|
| 749 |
pub title: String, |
| 750 |
|
| 751 |
pub state: String, |
| 752 |
} |
| 753 |
|
| 754 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 755 |
pub struct ProjectColumn { |
| 756 |
pub id: i64, |
| 757 |
pub name: String, |
| 758 |
pub cards: Vec<ProjectCard>, |
| 759 |
} |
| 760 |
|
| 761 |
|
| 762 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 763 |
pub struct Board { |
| 764 |
pub project: Project, |
| 765 |
pub columns: Vec<ProjectColumn>, |
| 766 |
} |
| 767 |
|
| 768 |
|
| 769 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 770 |
pub struct NewProject { |
| 771 |
pub title: String, |
| 772 |
#[serde(default)] |
| 773 |
pub description: String, |
| 774 |
#[serde(default)] |
| 775 |
pub private: bool, |
| 776 |
} |
| 777 |
|
| 778 |
|
| 779 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 780 |
pub struct ProjectEdit { |
| b1e92a62 Andy McCall ↶ |
781 |
|
| 782 |
|
| 783 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 784 |
pub owner: Option<String>, |
| ef20fdc1 Andy McCall ↶ |
785 |
#[serde(default)] |
| 786 |
pub title: Option<String>, |
| 787 |
#[serde(default)] |
| 788 |
pub description: Option<String>, |
| 789 |
#[serde(default)] |
| 790 |
pub private: Option<bool>, |
| 791 |
#[serde(default)] |
| 792 |
pub closed: Option<bool>, |
| 793 |
} |
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 798 |
pub struct NewCard { |
| 799 |
#[serde(default)] |
| 800 |
pub column: Option<String>, |
| 801 |
#[serde(default)] |
| 802 |
pub reference: String, |
| 803 |
#[serde(default)] |
| 804 |
pub note: String, |
| 805 |
} |
| 806 |
|
| 807 |
|
| 808 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 809 |
pub struct CardMove { |
| 810 |
pub column: String, |
| 811 |
} |
| 812 |
|
| 76f262e1 Andy McCall ↶ |
813 |
|
| 814 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 815 |
pub struct NewLabel { |
| 816 |
pub name: String, |
| 817 |
|
| 818 |
#[serde(default)] |
| 819 |
pub colour: Option<String>, |
| 820 |
#[serde(default)] |
| 821 |
pub description: String, |
| 822 |
} |
| 823 |
|
| b64e2537 Andy McCall ↶ |
824 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 825 |
pub struct NewComment { |
| 826 |
pub body: String, |
| 3f4b0ea6 Andy McCall ↶ |
827 |
|
| 828 |
|
| 829 |
#[serde(default)] |
| 830 |
pub path: Option<String>, |
| 831 |
#[serde(default)] |
| 832 |
pub line: Option<usize>, |
| b64e2537 Andy McCall ↶ |
833 |
} |
| 834 |
|
| 835 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 836 |
pub struct NewProposal { |
| 837 |
pub title: String, |
| 838 |
#[serde(default)] |
| 839 |
pub body: String, |
| 840 |
pub target: String, |
| 841 |
|
| 842 |
pub source: String, |
| 843 |
#[serde(default)] |
| 844 |
pub draft: bool, |
| cc1cd197 Andy McCall ↶ |
845 |
} |
| 846 |
|
| 847 |
|
| 848 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 849 |
pub struct ReviewRequest { |
| 850 |
pub reviewers: Vec<String>, |
| 7d2eb590 Andy McCall ↶ |
851 |
} |
| 852 |
|
| 853 |
|
| 854 |
|
| 855 |
|
| 856 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 857 |
pub struct AssistantRequest { |
| 858 |
pub assistant: String, |
| b64e2537 Andy McCall ↶ |
859 |
} |
| 860 |
|
| 861 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 862 |
pub struct NewReview { |
| 863 |
pub verdict: String, |
| 864 |
#[serde(default)] |
| 865 |
pub body: String, |
| 866 |
} |
| 867 |
|
| 868 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 869 |
pub struct IssueStateChange { |
| 870 |
|
| 871 |
pub state: String, |
| 872 |
#[serde(default)] |
| 873 |
pub reason: String, |
| 874 |
} |
| 875 |
|
| 876 |
|
| 877 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 878 |
pub struct WebhookEnvelope { |
| 879 |
pub event: String, |
| 880 |
pub delivery: String, |
| 881 |
pub repository: Option<Repository>, |
| 882 |
pub actor: String, |
| 883 |
pub at_ms: i64, |
| 884 |
pub data: serde_json::Value, |
| 885 |
} |
| 886 |
|
| 887 |
|
| 888 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 889 |
pub struct ProposalEvent { |
| 890 |
pub number: i64, |
| 891 |
pub kind: String, |
| 892 |
pub check: Option<Check>, |
| 893 |
} |
| 894 |
|
| 3f4b0ea6 Andy McCall ↶ |
895 |
|
| 896 |
|
| 897 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 898 |
pub struct Release { |
| 899 |
pub tag: String, |
| 900 |
pub title: String, |
| 901 |
pub notes: String, |
| 902 |
pub prerelease: bool, |
| 903 |
pub latest: bool, |
| 904 |
pub author: String, |
| 905 |
pub heads: Vec<String>, |
| 906 |
pub signer: Option<String>, |
| 907 |
pub assets: Vec<ReleaseAsset>, |
| 908 |
pub archives: Vec<String>, |
| 909 |
pub created_ms: i64, |
| 910 |
pub url: String, |
| 911 |
} |
| 912 |
|
| 913 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 914 |
pub struct ReleaseAsset { |
| 915 |
pub name: String, |
| 916 |
pub size: i64, |
| 917 |
|
| 918 |
pub hash: String, |
| 919 |
pub content_type: String, |
| 920 |
pub downloads: i64, |
| 921 |
pub url: String, |
| 10708ab8 Andy McCall ↶ |
922 |
|
| 923 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 924 |
pub built_by: Option<AssetBuild>, |
| 925 |
} |
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 930 |
pub struct AssetBuild { |
| 931 |
pub run: i64, |
| 932 |
pub job: String, |
| 933 |
pub artifact: String, |
| 934 |
pub run_url: String, |
| 935 |
|
| 936 |
pub receipt: Option<String>, |
| 937 |
pub receipt_url: Option<String>, |
| 938 |
pub signer: Option<String>, |
| 3f4b0ea6 Andy McCall ↶ |
939 |
} |
| 940 |
|
| 739a763a Andy McCall ↶ |
941 |
|
| 942 |
|
| 943 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 944 |
pub struct ProposalEdit { |
| 945 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 946 |
pub title: Option<String>, |
| 947 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 948 |
pub body: Option<String>, |
| 2291f8cc Andy McCall ↶ |
949 |
|
| 950 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 951 |
pub labels: Option<Vec<String>>, |
| 71e65fcf Andy McCall ↶ |
952 |
|
| 953 |
|
| 954 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 955 |
pub state: Option<String>, |
| 739a763a Andy McCall ↶ |
956 |
} |
| 957 |
|
| ced6d3af Andy McCall ↶ |
958 |
|
| 959 |
|
| 960 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 961 |
pub struct ReleaseEdit { |
| 962 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 963 |
pub title: Option<String>, |
| 964 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 965 |
pub notes: Option<String>, |
| 966 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 967 |
pub prerelease: Option<bool>, |
| 968 |
} |
| 969 |
|
| 3f4b0ea6 Andy McCall ↶ |
970 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 971 |
pub struct NewRelease { |
| 972 |
pub tag: String, |
| 973 |
pub title: String, |
| 974 |
#[serde(default)] |
| 975 |
pub notes: Option<String>, |
| 976 |
#[serde(default)] |
| 977 |
pub prerelease: bool, |
| 978 |
} |
| 979 |
|
| eb2a3502 Andy McCall ↶ |
980 |
|
| 981 |
|
| 982 |
|
| 983 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 984 |
pub struct Diffusion { |
| 985 |
pub takes_from: Vec<DiffusionPin>, |
| 986 |
pub diffuses_to: Vec<DiffusionPin>, |
| 987 |
} |
| 988 |
|
| 989 |
|
| 990 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 991 |
pub struct DiffusionPin { |
| 992 |
pub upstream: String, |
| 993 |
pub consumer: String, |
| 994 |
|
| 995 |
pub path: String, |
| 996 |
|
| 997 |
pub bookmark: String, |
| 998 |
|
| 999 |
#[serde(default)] |
| 1000 |
pub behind: Option<u64>, |
| 1001 |
|
| 1002 |
pub follow: String, |
| 1003 |
|
| 1004 |
#[serde(default)] |
| 1005 |
pub bump: Option<i64>, |
| 1006 |
|
| 1007 |
#[serde(default)] |
| 1008 |
pub run: Option<i64>, |
| 1009 |
#[serde(default)] |
| 1010 |
pub run_status: Option<String>, |
| 1011 |
|
| 1012 |
pub upstream_state: DiffusionHalf, |
| 1013 |
pub consumer_state: DiffusionHalf, |
| 1014 |
} |
| 1015 |
|
| 1016 |
|
| 1017 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1018 |
pub struct DiffusionHalf { |
| 1019 |
|
| 1020 |
pub tone: String, |
| 1021 |
|
| 1022 |
pub word: String, |
| 1023 |
|
| 1024 |
pub title: String, |
| 1025 |
} |
| 1026 |
|
| b64e2537 Andy McCall ↶ |
1027 |
|
| 1028 |
pub fn schemas() -> Vec<(&'static str, schemars::Schema)> { |
| 1029 |
vec![ |
| 1030 |
("Repository", schemars::schema_for!(Repository)), |
| eb2a3502 Andy McCall ↶ |
1031 |
("Diffusion", schemars::schema_for!(Diffusion)), |
| 1032 |
("DiffusionPin", schemars::schema_for!(DiffusionPin)), |
| 1033 |
("DiffusionHalf", schemars::schema_for!(DiffusionHalf)), |
| b64e2537 Andy McCall ↶ |
1034 |
("Visibility", schemars::schema_for!(Visibility)), |
| 1035 |
("Bookmark", schemars::schema_for!(Bookmark)), |
| 1036 |
("Tag", schemars::schema_for!(Tag)), |
| 1037 |
("ChangeSummary", schemars::schema_for!(ChangeSummary)), |
| 1038 |
("Author", schemars::schema_for!(Author)), |
| 1039 |
("Signature", schemars::schema_for!(Signature)), |
| 1040 |
("Problem", schemars::schema_for!(Problem)), |
| 1041 |
("Proposal", schemars::schema_for!(Proposal)), |
| 1042 |
("ProposalState", schemars::schema_for!(ProposalState)), |
| 1043 |
("ProposalSource", schemars::schema_for!(ProposalSource)), |
| 1044 |
("Approval", schemars::schema_for!(Approval)), |
| 1045 |
("Issue", schemars::schema_for!(Issue)), |
| 1046 |
("Label", schemars::schema_for!(Label)), |
| 1047 |
("Milestone", schemars::schema_for!(Milestone)), |
| 5ea4872f Andy McCall ↶ |
1048 |
("NewMilestone", schemars::schema_for!(NewMilestone)), |
| 1049 |
("MilestoneEdit", schemars::schema_for!(MilestoneEdit)), |
| b64e2537 Andy McCall ↶ |
1050 |
("Comment", schemars::schema_for!(Comment)), |
| 3f02e5ea Andy McCall ↶ |
1051 |
("ProposalFile", schemars::schema_for!(ProposalFile)), |
| 42a0ba4b Andy McCall ↶ |
1052 |
("Notification", schemars::schema_for!(Notification)), |
| 1053 |
("Inbox", schemars::schema_for!(Inbox)), |
| b64e2537 Andy McCall ↶ |
1054 |
("Atom", schemars::schema_for!(Atom)), |
| 1055 |
("Review", schemars::schema_for!(Review)), |
| 1056 |
("TreeEntry", schemars::schema_for!(TreeEntry)), |
| 1057 |
("BlameLine", schemars::schema_for!(BlameLine)), |
| 1058 |
("FileChange", schemars::schema_for!(FileChange)), |
| 1059 |
("ChangeDetail", schemars::schema_for!(ChangeDetail)), |
| 1060 |
("History", schemars::schema_for!(History)), |
| 1061 |
("Conflict", schemars::schema_for!(Conflict)), |
| 1062 |
("Push", schemars::schema_for!(Push)), |
| 1063 |
("Trust", schemars::schema_for!(Trust)), |
| 1064 |
("Policy", schemars::schema_for!(Policy)), |
| 1065 |
("Rule", schemars::schema_for!(Rule)), |
| 1066 |
("Hook", schemars::schema_for!(Hook)), |
| 1067 |
("NewHook", schemars::schema_for!(NewHook)), |
| 1068 |
("Check", schemars::schema_for!(Check)), |
| 1069 |
("CheckStatus", schemars::schema_for!(CheckStatus)), |
| 1070 |
("NewCheck", schemars::schema_for!(NewCheck)), |
| 1071 |
("User", schemars::schema_for!(User)), |
| 1072 |
("Organisation", schemars::schema_for!(Organisation)), |
| 1073 |
("NewRepository", schemars::schema_for!(NewRepository)), |
| 1074 |
("NewIssue", schemars::schema_for!(NewIssue)), |
| 76f262e1 Andy McCall ↶ |
1075 |
("IssueEdit", schemars::schema_for!(IssueEdit)), |
| 2291f8cc Andy McCall ↶ |
1076 |
("ReleaseEdit", schemars::schema_for!(ReleaseEdit)), |
| 1077 |
("ProposalEdit", schemars::schema_for!(ProposalEdit)), |
| 76f262e1 Andy McCall ↶ |
1078 |
("NewLabel", schemars::schema_for!(NewLabel)), |
| 961c10be Andy McCall ↶ |
1079 |
("RequiredChecks", schemars::schema_for!(RequiredChecks)), |
| ef20fdc1 Andy McCall ↶ |
1080 |
("Project", schemars::schema_for!(Project)), |
| 1081 |
("ProjectCard", schemars::schema_for!(ProjectCard)), |
| 1082 |
("ProjectColumn", schemars::schema_for!(ProjectColumn)), |
| 1083 |
("Board", schemars::schema_for!(Board)), |
| 1084 |
("NewProject", schemars::schema_for!(NewProject)), |
| 1085 |
("ProjectEdit", schemars::schema_for!(ProjectEdit)), |
| 1086 |
("NewCard", schemars::schema_for!(NewCard)), |
| 1087 |
("CardMove", schemars::schema_for!(CardMove)), |
| b64e2537 Andy McCall ↶ |
1088 |
("NewComment", schemars::schema_for!(NewComment)), |
| 1089 |
("NewProposal", schemars::schema_for!(NewProposal)), |
| 1090 |
("NewReview", schemars::schema_for!(NewReview)), |
| 1091 |
("IssueStateChange", schemars::schema_for!(IssueStateChange)), |
| 1092 |
("WebhookEnvelope", schemars::schema_for!(WebhookEnvelope)), |
| 1093 |
("ProposalEvent", schemars::schema_for!(ProposalEvent)), |
| 3f4b0ea6 Andy McCall ↶ |
1094 |
("Release", schemars::schema_for!(Release)), |
| bf1ab345 Andy McCall ↶ |
1095 |
("FlowRun", schemars::schema_for!(FlowRun)), |
| 1096 |
("FlowJob", schemars::schema_for!(FlowJob)), |
| 1097 |
("FlowLogLine", schemars::schema_for!(FlowLogLine)), |
| 1098 |
("AssetBuild", schemars::schema_for!(AssetBuild)), |
| 3f4b0ea6 Andy McCall ↶ |
1099 |
("ReleaseAsset", schemars::schema_for!(ReleaseAsset)), |
| 1100 |
("NewRelease", schemars::schema_for!(NewRelease)), |
| b64e2537 Andy McCall ↶ |
1101 |
] |
| 1102 |
} |
| b66e70b7 Andy McCall ↶ |
1103 |
|
| 1104 |
|
| 1105 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1106 |
pub struct Runner { |
| 1107 |
pub id: i64, |
| 1108 |
pub name: String, |
| 1109 |
|
| 1110 |
pub status: String, |
| 1111 |
|
| 1112 |
pub serves: String, |
| 1113 |
pub arch: String, |
| 1114 |
pub os: String, |
| 1115 |
pub version: String, |
| 1116 |
pub labels: Vec<String>, |
| 1117 |
pub max_jobs: i64, |
| 1118 |
pub memory_mib: Option<i64>, |
| 1119 |
pub cpus: Option<i64>, |
| 1120 |
|
| 1121 |
pub key: String, |
| 1122 |
|
| 1123 |
pub source: String, |
| 1124 |
pub last_seen_ms: Option<i64>, |
| 1125 |
|
| 1126 |
pub running: i64, |
| 2fb70d01 Andy McCall ↶ |
1127 |
|
| 1128 |
|
| 1129 |
|
| 1130 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1131 |
pub free_disk_mib: Option<i64>, |
| 1132 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1133 |
pub load_x100: Option<i64>, |
| 1134 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1135 |
pub speed: Option<i64>, |
| 1136 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1137 |
pub speed_class: Option<i64>, |
| 1138 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 1139 |
pub kernel: String, |
| b66e70b7 Andy McCall ↶ |
1140 |
} |
| 1141 |
|
| 1142 |
|
| 1143 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1144 |
pub struct RunnerJob { |
| 1145 |
pub repo: String, |
| 1146 |
pub run: i64, |
| 1147 |
pub job: String, |
| 1148 |
pub status: String, |
| 1149 |
pub started_ms: Option<i64>, |
| 1150 |
pub finished_ms: Option<i64>, |
| 1151 |
} |
| 1152 |
|
| 1153 |
|
| 1154 |
|
| 1155 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1156 |
pub struct QueueItem { |
| 1157 |
pub repo: String, |
| 1158 |
pub run: i64, |
| 1159 |
pub job: String, |
| 1160 |
|
| 1161 |
pub status: String, |
| 1162 |
|
| 1163 |
pub runner: String, |
| 1164 |
} |
| 62ceb2ee Andy McCall ↶ |
1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1171 |
pub struct Assistant { |
| 1172 |
pub name: String, |
| 1173 |
pub endpoint: String, |
| 1174 |
pub api: String, |
| 1175 |
pub model: String, |
| 1176 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 1177 |
pub headers: String, |
| 1178 |
pub enabled: bool, |
| 1179 |
pub budget: i64, |
| 1180 |
pub has_token: bool, |
| 1181 |
|
| 1182 |
|
| 1183 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 1184 |
pub from: String, |
| 1185 |
|
| 1186 |
#[serde(default)] |
| 1187 |
pub off_above: bool, |
| 1188 |
} |
| 1189 |
|
| 1190 |
|
| 1191 |
|
| 1192 |
|
| 1193 |
|
| 1194 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1195 |
pub struct NewAssistant { |
| 1196 |
#[serde(default)] |
| 1197 |
pub name: String, |
| 1198 |
#[serde(default)] |
| 1199 |
pub preset: String, |
| 1200 |
#[serde(default)] |
| 1201 |
pub endpoint: String, |
| 1202 |
#[serde(default)] |
| 1203 |
pub api: String, |
| 1204 |
pub model: String, |
| 1205 |
#[serde(default)] |
| 1206 |
pub token: String, |
| 1207 |
#[serde(default)] |
| 1208 |
pub headers: String, |
| 1209 |
#[serde(default = "yes")] |
| 1210 |
pub enabled: bool, |
| 1211 |
#[serde(default)] |
| 1212 |
pub budget: Option<i64>, |
| 1213 |
} |
| 1214 |
|
| 1215 |
fn yes() -> bool { |
| 1216 |
true |
| 1217 |
} |
| 1218 |
|
| 1219 |
|
| 1220 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1221 |
pub struct AssistantPrompt { |
| 1222 |
pub prompt: String, |
| 1223 |
#[serde(default, skip_serializing_if = "Vec::is_empty")] |
| 1224 |
pub inherited: Vec<(String, String)>, |
| 1225 |
} |
| 617c2840 Andy McCall ↶ |
1226 |
|
| 1227 |
|
| 1228 |
|
| 1229 |
|
| 1230 |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] |
| 1231 |
pub struct CoverageReport { |
| 1232 |
pub id: i64, |
| 1233 |
pub run: i64, |
| 1234 |
pub job: String, |
| 1235 |
pub bookmark: String, |
| 1236 |
|
| 1237 |
pub state: String, |
| 1238 |
|
| 1239 |
pub format: String, |
| 1240 |
pub lines_found: i64, |
| 1241 |
pub lines_hit: i64, |
| 1242 |
pub percent: Option<f64>, |
| 1243 |
pub functions_found: i64, |
| 1244 |
pub functions_hit: i64, |
| 1245 |
pub branches_found: i64, |
| 1246 |
pub branches_hit: i64, |
| 1247 |
pub files: i64, |
| 1248 |
|
| 1249 |
pub dropped: i64, |
| 1250 |
pub created_ms: i64, |
| 1251 |
|
| 1252 |
pub url: String, |
| 40dd3f86 Andy McCall ↶ |
1253 |
|
| 1254 |
|
| 1255 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1256 |
pub uploaded_by: Option<String>, |
| 617c2840 Andy McCall ↶ |
1257 |
} |
| 1258 |
|
| 1259 |
|
| 1260 |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] |
| 1261 |
pub struct CoverageFile { |
| 1262 |
pub path: String, |
| 1263 |
pub lines_found: i64, |
| 1264 |
pub lines_hit: i64, |
| 1265 |
pub percent: Option<f64>, |
| 1266 |
pub functions_found: i64, |
| 1267 |
pub functions_hit: i64, |
| 1268 |
pub branches_found: i64, |
| 1269 |
pub branches_hit: i64, |
| 1270 |
} |
| 1271 |
|
| 1272 |
|
| 1273 |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] |
| 1274 |
pub struct CoverageDetail { |
| 1275 |
pub report: CoverageReport, |
| 1276 |
pub files: Vec<CoverageFile>, |
| 1277 |
} |
| 1278 |
|
| 1279 |
|
| 1280 |
|
| 1281 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1282 |
pub struct TestReport { |
| 1283 |
pub id: i64, |
| 1284 |
pub run: i64, |
| 1285 |
pub job: String, |
| 1286 |
pub bookmark: String, |
| 1287 |
pub state: String, |
| 1288 |
pub tests: i64, |
| 1289 |
pub passed: i64, |
| 1290 |
pub failed: i64, |
| 1291 |
pub errors: i64, |
| 1292 |
pub skipped: i64, |
| 1293 |
|
| 1294 |
pub time_ms: i64, |
| 1295 |
pub created_ms: i64, |
| 1296 |
pub url: String, |
| 1297 |
} |
| 1298 |
|
| 1299 |
|
| 1300 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1301 |
pub struct TestCase { |
| 1302 |
pub suite: String, |
| 1303 |
pub classname: String, |
| 1304 |
pub name: String, |
| 1305 |
|
| 1306 |
pub status: String, |
| 1307 |
pub time_ms: i64, |
| 1308 |
pub message: String, |
| 1309 |
|
| 1310 |
pub output: String, |
| 1311 |
} |
| 1312 |
|
| 1313 |
|
| 1314 |
|
| 1315 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1316 |
pub struct TestReportDetail { |
| 1317 |
pub report: TestReport, |
| 1318 |
pub cases: Vec<TestCase>, |
| 1319 |
} |