| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
use schemars::JsonSchema; |
| 10 |
use serde::{Deserialize, Serialize}; |
| 11 |
|
| 12 |
|
| 13 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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 |
|
| 27 |
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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 |
|
| 55 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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 |
|
| 65 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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 |
|
| 74 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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, |
| 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, |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 103 |
pub struct Author { |
| 104 |
pub name: String, |
| 105 |
pub email: String, |
| 106 |
pub key: String, |
| 107 |
|
| 108 |
pub account: Option<String>, |
| 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 |
} |
| 124 |
} |
| 125 |
|
| 126 |
|
| 127 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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 |
|
| 136 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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 |
} |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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>, |
| 185 |
|
| 186 |
#[serde(default)] |
| 187 |
pub landed: Option<Landed>, |
| 188 |
|
| 189 |
#[serde(default)] |
| 190 |
pub auto_land: Option<String>, |
| 191 |
|
| 192 |
#[serde(default)] |
| 193 |
pub requested_reviewers: Vec<String>, |
| 194 |
#[serde(default)] |
| 195 |
pub labels: Vec<Label>, |
| 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, |
| 205 |
} |
| 206 |
|
| 207 |
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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 |
|
| 237 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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 |
|
| 250 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 251 |
pub struct Approval { |
| 252 |
pub account: String, |
| 253 |
pub sealed: bool, |
| 254 |
pub key: Option<String>, |
| 255 |
} |
| 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 |
|
| 296 |
|
| 297 |
|
| 298 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 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)] |
| 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>, |
| 333 |
|
| 334 |
|
| 335 |
#[serde(default)] |
| 336 |
pub line: Option<usize>, |
| 337 |
pub resolved: bool, |
| 338 |
} |
| 339 |
|
| 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 |
#[serde(default)] |
| 354 |
pub repository: Option<String>, |
| 355 |
|
| 356 |
#[serde(default)] |
| 357 |
pub reason: String, |
| 358 |
|
| 359 |
|
| 360 |
#[serde(default)] |
| 361 |
pub thread: String, |
| 362 |
|
| 363 |
#[serde(default)] |
| 364 |
pub label: Option<String>, |
| 365 |
} |
| 366 |
|
| 367 |
|
| 368 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 369 |
pub struct Inbox { |
| 370 |
pub unread: i64, |
| 371 |
pub items: Vec<Notification>, |
| 372 |
} |
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 378 |
pub struct ProposalFile { |
| 379 |
pub path: String, |
| 380 |
|
| 381 |
pub from: Option<String>, |
| 382 |
|
| 383 |
pub kind: String, |
| 384 |
pub added: usize, |
| 385 |
pub removed: usize, |
| 386 |
} |
| 387 |
|
| 388 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 389 |
pub struct Atom { |
| 390 |
pub change: String, |
| 391 |
pub index: u32, |
| 392 |
} |
| 393 |
|
| 394 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 395 |
pub struct Review { |
| 396 |
pub id: i64, |
| 397 |
pub author: String, |
| 398 |
pub verdict: String, |
| 399 |
pub body: String, |
| 400 |
pub sealed: bool, |
| 401 |
pub created_ms: i64, |
| 402 |
|
| 403 |
|
| 404 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 405 |
pub via: String, |
| 406 |
} |
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 411 |
pub struct TreeEntry { |
| 412 |
pub name: String, |
| 413 |
pub path: String, |
| 414 |
pub kind: String, |
| 415 |
pub exec: bool, |
| 416 |
pub size: Option<u64>, |
| 417 |
pub conflicted: bool, |
| 418 |
} |
| 419 |
|
| 420 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 421 |
pub struct BlameLine { |
| 422 |
pub line: usize, |
| 423 |
pub change: String, |
| 424 |
pub index: u32, |
| 425 |
pub author: String, |
| 426 |
pub when_ms: u64, |
| 427 |
pub text: String, |
| 428 |
} |
| 429 |
|
| 430 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 431 |
pub struct FileChange { |
| 432 |
pub path: String, |
| 433 |
pub kind: String, |
| 434 |
pub from: Option<String>, |
| 435 |
pub added: usize, |
| 436 |
pub removed: usize, |
| 437 |
} |
| 438 |
|
| 439 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 440 |
pub struct ChangeDetail { |
| 441 |
pub change: ChangeSummary, |
| 442 |
pub body: String, |
| 443 |
pub dependents: Vec<String>, |
| 444 |
pub in_bookmarks: Vec<String>, |
| 445 |
pub in_tags: Vec<String>, |
| 446 |
pub files: Vec<FileChange>, |
| 447 |
} |
| 448 |
|
| 449 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 450 |
pub struct History { |
| 451 |
pub reference: String, |
| 452 |
pub heads: Vec<String>, |
| 453 |
pub total: usize, |
| 454 |
pub offset: usize, |
| 455 |
pub changes: Vec<ChangeSummary>, |
| 456 |
} |
| 457 |
|
| 458 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 459 |
pub struct Conflict { |
| 460 |
pub bookmark: String, |
| 461 |
pub path: String, |
| 462 |
pub kind: String, |
| 463 |
pub contributors: Vec<String>, |
| 464 |
} |
| 465 |
|
| 466 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 467 |
pub struct Push { |
| 468 |
pub at_ms: i64, |
| 469 |
pub pusher: String, |
| 470 |
pub reference: String, |
| 471 |
pub ok: bool, |
| 472 |
pub reason: String, |
| 473 |
pub old_state: String, |
| 474 |
pub new_state: String, |
| 475 |
pub heads: i64, |
| 476 |
pub changes: i64, |
| 477 |
} |
| 478 |
|
| 479 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 480 |
pub struct Trust { |
| 481 |
pub policy: Option<Policy>, |
| 482 |
pub signed: usize, |
| 483 |
pub sealed: usize, |
| 484 |
pub unsigned: usize, |
| 485 |
pub invalid: Vec<String>, |
| 486 |
pub hub_key: String, |
| 487 |
} |
| 488 |
|
| 489 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 490 |
pub struct Policy { |
| 491 |
pub serial: u64, |
| 492 |
pub expires_ms: u64, |
| 493 |
pub roots: Vec<String>, |
| 494 |
pub root_threshold: u32, |
| 495 |
pub rules: Vec<Rule>, |
| 496 |
} |
| 497 |
|
| 498 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 499 |
pub struct Rule { |
| 500 |
pub pattern: String, |
| 501 |
pub keys: Vec<String>, |
| 502 |
pub threshold: u32, |
| 503 |
pub require: String, |
| 504 |
pub allow_conflicts: bool, |
| 505 |
} |
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 510 |
pub struct Hook { |
| 511 |
pub id: i64, |
| 512 |
pub url: String, |
| 513 |
pub events: String, |
| 514 |
pub active: bool, |
| 515 |
pub created_ms: i64, |
| 516 |
} |
| 517 |
|
| 518 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 519 |
pub struct NewHook { |
| 520 |
pub url: String, |
| 521 |
pub secret: String, |
| 522 |
#[serde(default = "star")] |
| 523 |
pub events: String, |
| 524 |
} |
| 525 |
|
| 526 |
fn star() -> String { |
| 527 |
"*".into() |
| 528 |
} |
| 529 |
|
| 530 |
|
| 531 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 532 |
pub struct FlowRun { |
| 533 |
|
| 534 |
pub number: i64, |
| 535 |
pub bookmark: String, |
| 536 |
|
| 537 |
pub state: String, |
| 538 |
|
| 539 |
pub heads: Vec<String>, |
| 540 |
|
| 541 |
pub status: String, |
| 542 |
|
| 543 |
pub trigger: String, |
| 544 |
pub actor: String, |
| 545 |
pub pipeline_hash: String, |
| 546 |
|
| 547 |
pub error: String, |
| 548 |
pub created_ms: i64, |
| 549 |
pub finished_ms: Option<i64>, |
| 550 |
pub url: String, |
| 551 |
|
| 552 |
|
| 553 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 554 |
pub queue_position: Option<i64>, |
| 555 |
|
| 556 |
#[serde(default, skip_serializing_if = "Vec::is_empty")] |
| 557 |
pub jobs: Vec<FlowJob>, |
| 558 |
} |
| 559 |
|
| 560 |
|
| 561 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 562 |
pub struct FlowJob { |
| 563 |
pub name: String, |
| 564 |
|
| 565 |
pub status: String, |
| 566 |
pub depends_on: Vec<String>, |
| 567 |
pub runner: String, |
| 568 |
pub exit_code: Option<i64>, |
| 569 |
pub error: String, |
| 570 |
pub started_ms: Option<i64>, |
| 571 |
pub finished_ms: Option<i64>, |
| 572 |
|
| 573 |
pub log_lines: i64, |
| 574 |
|
| 575 |
|
| 576 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 577 |
pub waiting: String, |
| 578 |
|
| 579 |
|
| 580 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 581 |
pub placed: String, |
| 582 |
} |
| 583 |
|
| 584 |
|
| 585 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 586 |
pub struct FlowLogLine { |
| 587 |
|
| 588 |
pub seq: i64, |
| 589 |
|
| 590 |
pub t: i64, |
| 591 |
|
| 592 |
pub stream: String, |
| 593 |
pub text: String, |
| 594 |
} |
| 595 |
|
| 596 |
|
| 597 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 598 |
pub struct Check { |
| 599 |
pub state: String, |
| 600 |
pub name: String, |
| 601 |
pub status: CheckStatus, |
| 602 |
pub summary: String, |
| 603 |
pub url: String, |
| 604 |
pub reporter: String, |
| 605 |
|
| 606 |
pub seal: Option<String>, |
| 607 |
pub started_ms: i64, |
| 608 |
pub finished_ms: Option<i64>, |
| 609 |
} |
| 610 |
|
| 611 |
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 612 |
#[serde(rename_all = "lowercase")] |
| 613 |
pub enum CheckStatus { |
| 614 |
Queued, |
| 615 |
Running, |
| 616 |
Passed, |
| 617 |
Failed, |
| 618 |
Cancelled, |
| 619 |
Skipped, |
| 620 |
} |
| 621 |
|
| 622 |
impl CheckStatus { |
| 623 |
pub fn as_str(self) -> &'static str { |
| 624 |
match self { |
| 625 |
CheckStatus::Queued => "queued", |
| 626 |
CheckStatus::Running => "running", |
| 627 |
CheckStatus::Passed => "passed", |
| 628 |
CheckStatus::Failed => "failed", |
| 629 |
CheckStatus::Cancelled => "cancelled", |
| 630 |
CheckStatus::Skipped => "skipped", |
| 631 |
} |
| 632 |
} |
| 633 |
|
| 634 |
pub fn parse(s: &str) -> Option<CheckStatus> { |
| 635 |
Some(match s { |
| 636 |
"queued" => CheckStatus::Queued, |
| 637 |
"running" => CheckStatus::Running, |
| 638 |
"passed" => CheckStatus::Passed, |
| 639 |
"failed" => CheckStatus::Failed, |
| 640 |
"cancelled" => CheckStatus::Cancelled, |
| 641 |
"skipped" => CheckStatus::Skipped, |
| 642 |
_ => return None, |
| 643 |
}) |
| 644 |
} |
| 645 |
} |
| 646 |
|
| 647 |
|
| 648 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 649 |
pub struct NewCheck { |
| 650 |
pub state: String, |
| 651 |
pub name: String, |
| 652 |
pub status: CheckStatus, |
| 653 |
#[serde(default)] |
| 654 |
pub summary: String, |
| 655 |
#[serde(default)] |
| 656 |
pub url: String, |
| 657 |
|
| 658 |
#[serde(default)] |
| 659 |
pub seal: Option<String>, |
| 660 |
} |
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 665 |
pub struct User { |
| 666 |
pub username: String, |
| 667 |
pub display_name: String, |
| 668 |
pub is_admin: bool, |
| 669 |
pub keys: Vec<String>, |
| 670 |
pub created_ms: i64, |
| 671 |
} |
| 672 |
|
| 673 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 674 |
pub struct Organisation { |
| 675 |
pub name: String, |
| 676 |
pub display_name: String, |
| 677 |
pub description: String, |
| 678 |
pub members: Vec<String>, |
| 679 |
} |
| 680 |
|
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 685 |
pub struct UserProposals { |
| 686 |
pub review: Vec<ProposalBrief>, |
| 687 |
pub authored: Vec<ProposalBrief>, |
| 688 |
} |
| 689 |
|
| 690 |
|
| 691 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 692 |
pub struct ProposalBrief { |
| 693 |
|
| 694 |
pub repository: String, |
| 695 |
pub number: i64, |
| 696 |
pub title: String, |
| 697 |
pub author: String, |
| 698 |
pub state: ProposalState, |
| 699 |
pub conflicted: bool, |
| 700 |
pub updated_ms: i64, |
| 701 |
|
| 702 |
pub url: String, |
| 703 |
} |
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 708 |
pub struct UserOrg { |
| 709 |
pub name: String, |
| 710 |
pub display_name: String, |
| 711 |
pub role: String, |
| 712 |
} |
| 713 |
|
| 714 |
|
| 715 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 716 |
pub struct NewRepository { |
| 717 |
pub owner: String, |
| 718 |
pub name: String, |
| 719 |
#[serde(default)] |
| 720 |
pub description: String, |
| 721 |
#[serde(default = "public")] |
| 722 |
pub visibility: Visibility, |
| 723 |
} |
| 724 |
|
| 725 |
fn public() -> Visibility { |
| 726 |
Visibility::Public |
| 727 |
} |
| 728 |
|
| 729 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 730 |
pub struct NewIssue { |
| 731 |
pub title: String, |
| 732 |
#[serde(default)] |
| 733 |
pub body: String, |
| 734 |
|
| 735 |
#[serde(default)] |
| 736 |
pub labels: Vec<String>, |
| 737 |
|
| 738 |
#[serde(default)] |
| 739 |
pub assignees: Vec<String>, |
| 740 |
|
| 741 |
#[serde(default)] |
| 742 |
pub milestone: Option<String>, |
| 743 |
} |
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 748 |
pub struct IssueEdit { |
| 749 |
#[serde(default)] |
| 750 |
pub title: Option<String>, |
| 751 |
#[serde(default)] |
| 752 |
pub body: Option<String>, |
| 753 |
|
| 754 |
#[serde(default)] |
| 755 |
pub labels: Option<Vec<String>>, |
| 756 |
|
| 757 |
#[serde(default)] |
| 758 |
pub assignees: Option<Vec<String>>, |
| 759 |
|
| 760 |
#[serde(default)] |
| 761 |
pub milestone: Option<String>, |
| 762 |
} |
| 763 |
|
| 764 |
|
| 765 |
|
| 766 |
|
| 767 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 768 |
pub struct RequiredChecks { |
| 769 |
pub names: Vec<String>, |
| 770 |
} |
| 771 |
|
| 772 |
|
| 773 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 774 |
pub struct Project { |
| 775 |
pub owner: String, |
| 776 |
pub number: i64, |
| 777 |
pub title: String, |
| 778 |
pub description: String, |
| 779 |
pub public: bool, |
| 780 |
pub closed: bool, |
| 781 |
pub updated_ms: i64, |
| 782 |
|
| 783 |
pub url: String, |
| 784 |
} |
| 785 |
|
| 786 |
|
| 787 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 788 |
pub struct ProjectCard { |
| 789 |
pub id: i64, |
| 790 |
|
| 791 |
pub kind: String, |
| 792 |
|
| 793 |
pub reference: String, |
| 794 |
|
| 795 |
pub title: String, |
| 796 |
|
| 797 |
pub state: String, |
| 798 |
|
| 799 |
#[serde(default)] |
| 800 |
pub labels: Vec<String>, |
| 801 |
|
| 802 |
#[serde(default)] |
| 803 |
pub assignees: Vec<String>, |
| 804 |
|
| 805 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 806 |
pub archived_ms: Option<i64>, |
| 807 |
} |
| 808 |
|
| 809 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 810 |
pub struct ProjectColumn { |
| 811 |
pub id: i64, |
| 812 |
pub name: String, |
| 813 |
pub cards: Vec<ProjectCard>, |
| 814 |
} |
| 815 |
|
| 816 |
|
| 817 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 818 |
pub struct Board { |
| 819 |
pub project: Project, |
| 820 |
pub columns: Vec<ProjectColumn>, |
| 821 |
} |
| 822 |
|
| 823 |
|
| 824 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 825 |
pub struct NewProject { |
| 826 |
pub title: String, |
| 827 |
#[serde(default)] |
| 828 |
pub description: String, |
| 829 |
#[serde(default)] |
| 830 |
pub private: bool, |
| 831 |
} |
| 832 |
|
| 833 |
|
| 834 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 835 |
pub struct ProjectEdit { |
| 836 |
|
| 837 |
|
| 838 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 839 |
pub owner: Option<String>, |
| 840 |
#[serde(default)] |
| 841 |
pub title: Option<String>, |
| 842 |
#[serde(default)] |
| 843 |
pub description: Option<String>, |
| 844 |
#[serde(default)] |
| 845 |
pub private: Option<bool>, |
| 846 |
#[serde(default)] |
| 847 |
pub closed: Option<bool>, |
| 848 |
} |
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 853 |
pub struct NewCard { |
| 854 |
#[serde(default)] |
| 855 |
pub column: Option<String>, |
| 856 |
#[serde(default)] |
| 857 |
pub reference: String, |
| 858 |
#[serde(default)] |
| 859 |
pub note: String, |
| 860 |
} |
| 861 |
|
| 862 |
|
| 863 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 864 |
pub struct CardMove { |
| 865 |
pub column: String, |
| 866 |
} |
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 874 |
pub struct CardsMove { |
| 875 |
pub from: String, |
| 876 |
pub column: String, |
| 877 |
#[serde(default)] |
| 878 |
pub except: Vec<String>, |
| 879 |
#[serde(default)] |
| 880 |
pub state: Vec<String>, |
| 881 |
#[serde(default)] |
| 882 |
pub dry_run: bool, |
| 883 |
} |
| 884 |
|
| 885 |
|
| 886 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 887 |
pub struct CardsMoved { |
| 888 |
pub moved: Vec<ProjectCard>, |
| 889 |
pub kept: Vec<ProjectCard>, |
| 890 |
pub dry_run: bool, |
| 891 |
} |
| 892 |
|
| 893 |
|
| 894 |
|
| 895 |
|
| 896 |
|
| 897 |
|
| 898 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 899 |
pub struct CardsArchive { |
| 900 |
pub from: String, |
| 901 |
#[serde(default)] |
| 902 |
pub older_days: Option<i64>, |
| 903 |
#[serde(default)] |
| 904 |
pub except: Vec<String>, |
| 905 |
#[serde(default)] |
| 906 |
pub state: Vec<String>, |
| 907 |
#[serde(default)] |
| 908 |
pub dry_run: bool, |
| 909 |
} |
| 910 |
|
| 911 |
|
| 912 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 913 |
pub struct CardsArchived { |
| 914 |
pub archived: Vec<ProjectCard>, |
| 915 |
pub kept: Vec<ProjectCard>, |
| 916 |
pub dry_run: bool, |
| 917 |
} |
| 918 |
|
| 919 |
|
| 920 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 921 |
pub struct NewLabel { |
| 922 |
pub name: String, |
| 923 |
|
| 924 |
#[serde(default)] |
| 925 |
pub colour: Option<String>, |
| 926 |
#[serde(default)] |
| 927 |
pub description: String, |
| 928 |
} |
| 929 |
|
| 930 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 931 |
pub struct NewComment { |
| 932 |
pub body: String, |
| 933 |
|
| 934 |
|
| 935 |
#[serde(default)] |
| 936 |
pub path: Option<String>, |
| 937 |
#[serde(default)] |
| 938 |
pub line: Option<usize>, |
| 939 |
} |
| 940 |
|
| 941 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 942 |
pub struct NewProposal { |
| 943 |
pub title: String, |
| 944 |
#[serde(default)] |
| 945 |
pub body: String, |
| 946 |
pub target: String, |
| 947 |
|
| 948 |
pub source: String, |
| 949 |
#[serde(default)] |
| 950 |
pub draft: bool, |
| 951 |
} |
| 952 |
|
| 953 |
|
| 954 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 955 |
pub struct ReviewRequest { |
| 956 |
pub reviewers: Vec<String>, |
| 957 |
} |
| 958 |
|
| 959 |
|
| 960 |
|
| 961 |
|
| 962 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 963 |
pub struct AssistantRequest { |
| 964 |
pub assistant: String, |
| 965 |
} |
| 966 |
|
| 967 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 968 |
pub struct NewReview { |
| 969 |
pub verdict: String, |
| 970 |
#[serde(default)] |
| 971 |
pub body: String, |
| 972 |
} |
| 973 |
|
| 974 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 975 |
pub struct IssueStateChange { |
| 976 |
|
| 977 |
pub state: String, |
| 978 |
#[serde(default)] |
| 979 |
pub reason: String, |
| 980 |
} |
| 981 |
|
| 982 |
|
| 983 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 984 |
pub struct WebhookEnvelope { |
| 985 |
pub event: String, |
| 986 |
pub delivery: String, |
| 987 |
pub repository: Option<Repository>, |
| 988 |
pub actor: String, |
| 989 |
pub at_ms: i64, |
| 990 |
pub data: serde_json::Value, |
| 991 |
} |
| 992 |
|
| 993 |
|
| 994 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 995 |
pub struct ProposalEvent { |
| 996 |
pub number: i64, |
| 997 |
pub kind: String, |
| 998 |
pub check: Option<Check>, |
| 999 |
} |
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1004 |
pub struct Release { |
| 1005 |
pub tag: String, |
| 1006 |
pub title: String, |
| 1007 |
pub notes: String, |
| 1008 |
pub prerelease: bool, |
| 1009 |
pub latest: bool, |
| 1010 |
pub author: String, |
| 1011 |
pub heads: Vec<String>, |
| 1012 |
pub signer: Option<String>, |
| 1013 |
pub assets: Vec<ReleaseAsset>, |
| 1014 |
pub archives: Vec<String>, |
| 1015 |
pub created_ms: i64, |
| 1016 |
pub url: String, |
| 1017 |
} |
| 1018 |
|
| 1019 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1020 |
pub struct ReleaseAsset { |
| 1021 |
pub name: String, |
| 1022 |
pub size: i64, |
| 1023 |
|
| 1024 |
pub hash: String, |
| 1025 |
pub content_type: String, |
| 1026 |
pub downloads: i64, |
| 1027 |
pub url: String, |
| 1028 |
|
| 1029 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1030 |
pub built_by: Option<AssetBuild>, |
| 1031 |
} |
| 1032 |
|
| 1033 |
|
| 1034 |
|
| 1035 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1036 |
pub struct AssetBuild { |
| 1037 |
pub run: i64, |
| 1038 |
pub job: String, |
| 1039 |
pub artifact: String, |
| 1040 |
pub run_url: String, |
| 1041 |
|
| 1042 |
pub receipt: Option<String>, |
| 1043 |
pub receipt_url: Option<String>, |
| 1044 |
pub signer: Option<String>, |
| 1045 |
} |
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1050 |
pub struct ProposalEdit { |
| 1051 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1052 |
pub title: Option<String>, |
| 1053 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1054 |
pub body: Option<String>, |
| 1055 |
|
| 1056 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1057 |
pub labels: Option<Vec<String>>, |
| 1058 |
|
| 1059 |
|
| 1060 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1061 |
pub state: Option<String>, |
| 1062 |
} |
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1067 |
pub struct ReleaseEdit { |
| 1068 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1069 |
pub title: Option<String>, |
| 1070 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1071 |
pub notes: Option<String>, |
| 1072 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1073 |
pub prerelease: Option<bool>, |
| 1074 |
} |
| 1075 |
|
| 1076 |
|
| 1077 |
|
| 1078 |
|
| 1079 |
|
| 1080 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1081 |
pub struct Drop { |
| 1082 |
|
| 1083 |
pub id: String, |
| 1084 |
pub owner: String, |
| 1085 |
pub title: String, |
| 1086 |
pub description: String, |
| 1087 |
|
| 1088 |
|
| 1089 |
pub visibility: String, |
| 1090 |
|
| 1091 |
pub url: String, |
| 1092 |
|
| 1093 |
pub clone_url: String, |
| 1094 |
pub created_ms: i64, |
| 1095 |
pub updated_ms: i64, |
| 1096 |
pub files: Vec<DropFile>, |
| 1097 |
} |
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1102 |
pub struct DropFile { |
| 1103 |
pub name: String, |
| 1104 |
pub size: u64, |
| 1105 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1106 |
pub content: Option<String>, |
| 1107 |
|
| 1108 |
pub raw_url: String, |
| 1109 |
} |
| 1110 |
|
| 1111 |
|
| 1112 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1113 |
pub struct NewDrop { |
| 1114 |
#[serde(default)] |
| 1115 |
pub title: String, |
| 1116 |
#[serde(default)] |
| 1117 |
pub description: String, |
| 1118 |
|
| 1119 |
#[serde(default)] |
| 1120 |
pub secret: bool, |
| 1121 |
pub files: Vec<NewDropFile>, |
| 1122 |
} |
| 1123 |
|
| 1124 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1125 |
pub struct NewDropFile { |
| 1126 |
pub name: String, |
| 1127 |
pub content: String, |
| 1128 |
} |
| 1129 |
|
| 1130 |
|
| 1131 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1132 |
pub struct DropEdit { |
| 1133 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1134 |
pub title: Option<String>, |
| 1135 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1136 |
pub description: Option<String>, |
| 1137 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1138 |
pub secret: Option<bool>, |
| 1139 |
|
| 1140 |
#[serde(default)] |
| 1141 |
pub files: Vec<DropFileEdit>, |
| 1142 |
|
| 1143 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1144 |
pub message: Option<String>, |
| 1145 |
} |
| 1146 |
|
| 1147 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1148 |
pub struct DropFileEdit { |
| 1149 |
pub name: String, |
| 1150 |
#[serde(default)] |
| 1151 |
pub content: Option<String>, |
| 1152 |
} |
| 1153 |
|
| 1154 |
|
| 1155 |
|
| 1156 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1157 |
pub struct NewTag { |
| 1158 |
pub name: String, |
| 1159 |
#[serde(default)] |
| 1160 |
pub target: Option<String>, |
| 1161 |
#[serde(default)] |
| 1162 |
pub message: Option<String>, |
| 1163 |
} |
| 1164 |
|
| 1165 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1166 |
pub struct NewRelease { |
| 1167 |
pub tag: String, |
| 1168 |
pub title: String, |
| 1169 |
#[serde(default)] |
| 1170 |
pub notes: Option<String>, |
| 1171 |
#[serde(default)] |
| 1172 |
pub prerelease: bool, |
| 1173 |
} |
| 1174 |
|
| 1175 |
|
| 1176 |
|
| 1177 |
|
| 1178 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1179 |
pub struct Diffusion { |
| 1180 |
pub takes_from: Vec<DiffusionPin>, |
| 1181 |
pub diffuses_to: Vec<DiffusionPin>, |
| 1182 |
} |
| 1183 |
|
| 1184 |
|
| 1185 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1186 |
pub struct DiffusionPin { |
| 1187 |
pub upstream: String, |
| 1188 |
pub consumer: String, |
| 1189 |
|
| 1190 |
pub path: String, |
| 1191 |
|
| 1192 |
pub bookmark: String, |
| 1193 |
|
| 1194 |
#[serde(default)] |
| 1195 |
pub behind: Option<u64>, |
| 1196 |
|
| 1197 |
pub follow: String, |
| 1198 |
|
| 1199 |
#[serde(default)] |
| 1200 |
pub bump: Option<i64>, |
| 1201 |
|
| 1202 |
#[serde(default)] |
| 1203 |
pub run: Option<i64>, |
| 1204 |
#[serde(default)] |
| 1205 |
pub run_status: Option<String>, |
| 1206 |
|
| 1207 |
pub upstream_state: DiffusionHalf, |
| 1208 |
pub consumer_state: DiffusionHalf, |
| 1209 |
} |
| 1210 |
|
| 1211 |
|
| 1212 |
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1213 |
pub struct DiffusionHalf { |
| 1214 |
|
| 1215 |
pub tone: String, |
| 1216 |
|
| 1217 |
pub word: String, |
| 1218 |
|
| 1219 |
pub title: String, |
| 1220 |
} |
| 1221 |
|
| 1222 |
|
| 1223 |
pub fn schemas() -> Vec<(&'static str, schemars::Schema)> { |
| 1224 |
vec![ |
| 1225 |
("Repository", schemars::schema_for!(Repository)), |
| 1226 |
("Diffusion", schemars::schema_for!(Diffusion)), |
| 1227 |
("DiffusionPin", schemars::schema_for!(DiffusionPin)), |
| 1228 |
("DiffusionHalf", schemars::schema_for!(DiffusionHalf)), |
| 1229 |
("Visibility", schemars::schema_for!(Visibility)), |
| 1230 |
("Bookmark", schemars::schema_for!(Bookmark)), |
| 1231 |
("Tag", schemars::schema_for!(Tag)), |
| 1232 |
("ChangeSummary", schemars::schema_for!(ChangeSummary)), |
| 1233 |
("Author", schemars::schema_for!(Author)), |
| 1234 |
("Signature", schemars::schema_for!(Signature)), |
| 1235 |
("Problem", schemars::schema_for!(Problem)), |
| 1236 |
("Proposal", schemars::schema_for!(Proposal)), |
| 1237 |
("ProposalState", schemars::schema_for!(ProposalState)), |
| 1238 |
("ProposalSource", schemars::schema_for!(ProposalSource)), |
| 1239 |
("Approval", schemars::schema_for!(Approval)), |
| 1240 |
("Issue", schemars::schema_for!(Issue)), |
| 1241 |
("Label", schemars::schema_for!(Label)), |
| 1242 |
("Milestone", schemars::schema_for!(Milestone)), |
| 1243 |
("NewMilestone", schemars::schema_for!(NewMilestone)), |
| 1244 |
("MilestoneEdit", schemars::schema_for!(MilestoneEdit)), |
| 1245 |
("Comment", schemars::schema_for!(Comment)), |
| 1246 |
("ProposalFile", schemars::schema_for!(ProposalFile)), |
| 1247 |
("Notification", schemars::schema_for!(Notification)), |
| 1248 |
("Inbox", schemars::schema_for!(Inbox)), |
| 1249 |
("Atom", schemars::schema_for!(Atom)), |
| 1250 |
("Review", schemars::schema_for!(Review)), |
| 1251 |
("TreeEntry", schemars::schema_for!(TreeEntry)), |
| 1252 |
("BlameLine", schemars::schema_for!(BlameLine)), |
| 1253 |
("FileChange", schemars::schema_for!(FileChange)), |
| 1254 |
("ChangeDetail", schemars::schema_for!(ChangeDetail)), |
| 1255 |
("History", schemars::schema_for!(History)), |
| 1256 |
("Conflict", schemars::schema_for!(Conflict)), |
| 1257 |
("Push", schemars::schema_for!(Push)), |
| 1258 |
("Trust", schemars::schema_for!(Trust)), |
| 1259 |
("Policy", schemars::schema_for!(Policy)), |
| 1260 |
("Rule", schemars::schema_for!(Rule)), |
| 1261 |
("Hook", schemars::schema_for!(Hook)), |
| 1262 |
("NewHook", schemars::schema_for!(NewHook)), |
| 1263 |
("Check", schemars::schema_for!(Check)), |
| 1264 |
("CheckStatus", schemars::schema_for!(CheckStatus)), |
| 1265 |
("NewCheck", schemars::schema_for!(NewCheck)), |
| 1266 |
("User", schemars::schema_for!(User)), |
| 1267 |
("Organisation", schemars::schema_for!(Organisation)), |
| 1268 |
("NewRepository", schemars::schema_for!(NewRepository)), |
| 1269 |
("NewIssue", schemars::schema_for!(NewIssue)), |
| 1270 |
("IssueEdit", schemars::schema_for!(IssueEdit)), |
| 1271 |
("ReleaseEdit", schemars::schema_for!(ReleaseEdit)), |
| 1272 |
("ProposalEdit", schemars::schema_for!(ProposalEdit)), |
| 1273 |
("NewLabel", schemars::schema_for!(NewLabel)), |
| 1274 |
("RequiredChecks", schemars::schema_for!(RequiredChecks)), |
| 1275 |
("Project", schemars::schema_for!(Project)), |
| 1276 |
("ProjectCard", schemars::schema_for!(ProjectCard)), |
| 1277 |
("ProjectColumn", schemars::schema_for!(ProjectColumn)), |
| 1278 |
("Board", schemars::schema_for!(Board)), |
| 1279 |
("NewProject", schemars::schema_for!(NewProject)), |
| 1280 |
("ProjectEdit", schemars::schema_for!(ProjectEdit)), |
| 1281 |
("NewCard", schemars::schema_for!(NewCard)), |
| 1282 |
("CardMove", schemars::schema_for!(CardMove)), |
| 1283 |
("NewComment", schemars::schema_for!(NewComment)), |
| 1284 |
("NewProposal", schemars::schema_for!(NewProposal)), |
| 1285 |
("NewReview", schemars::schema_for!(NewReview)), |
| 1286 |
("IssueStateChange", schemars::schema_for!(IssueStateChange)), |
| 1287 |
("WebhookEnvelope", schemars::schema_for!(WebhookEnvelope)), |
| 1288 |
("ProposalEvent", schemars::schema_for!(ProposalEvent)), |
| 1289 |
("Release", schemars::schema_for!(Release)), |
| 1290 |
("FlowRun", schemars::schema_for!(FlowRun)), |
| 1291 |
("FlowJob", schemars::schema_for!(FlowJob)), |
| 1292 |
("FlowLogLine", schemars::schema_for!(FlowLogLine)), |
| 1293 |
("AssetBuild", schemars::schema_for!(AssetBuild)), |
| 1294 |
("ReleaseAsset", schemars::schema_for!(ReleaseAsset)), |
| 1295 |
("NewRelease", schemars::schema_for!(NewRelease)), |
| 1296 |
("Drop", schemars::schema_for!(Drop)), |
| 1297 |
("NewDrop", schemars::schema_for!(NewDrop)), |
| 1298 |
("DropEdit", schemars::schema_for!(DropEdit)), |
| 1299 |
] |
| 1300 |
} |
| 1301 |
|
| 1302 |
|
| 1303 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1304 |
pub struct Runner { |
| 1305 |
pub id: i64, |
| 1306 |
pub name: String, |
| 1307 |
|
| 1308 |
pub status: String, |
| 1309 |
|
| 1310 |
pub serves: String, |
| 1311 |
pub arch: String, |
| 1312 |
pub os: String, |
| 1313 |
pub version: String, |
| 1314 |
pub labels: Vec<String>, |
| 1315 |
pub max_jobs: i64, |
| 1316 |
pub memory_mib: Option<i64>, |
| 1317 |
pub cpus: Option<i64>, |
| 1318 |
|
| 1319 |
pub key: String, |
| 1320 |
|
| 1321 |
pub source: String, |
| 1322 |
pub last_seen_ms: Option<i64>, |
| 1323 |
|
| 1324 |
pub running: i64, |
| 1325 |
|
| 1326 |
|
| 1327 |
|
| 1328 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1329 |
pub free_disk_mib: Option<i64>, |
| 1330 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1331 |
pub load_x100: Option<i64>, |
| 1332 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1333 |
pub speed: Option<i64>, |
| 1334 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1335 |
pub speed_class: Option<i64>, |
| 1336 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 1337 |
pub kernel: String, |
| 1338 |
} |
| 1339 |
|
| 1340 |
|
| 1341 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1342 |
pub struct RunnerJob { |
| 1343 |
pub repo: String, |
| 1344 |
pub run: i64, |
| 1345 |
pub job: String, |
| 1346 |
pub status: String, |
| 1347 |
pub started_ms: Option<i64>, |
| 1348 |
pub finished_ms: Option<i64>, |
| 1349 |
} |
| 1350 |
|
| 1351 |
|
| 1352 |
|
| 1353 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1354 |
pub struct QueueItem { |
| 1355 |
pub repo: String, |
| 1356 |
pub run: i64, |
| 1357 |
pub job: String, |
| 1358 |
|
| 1359 |
pub status: String, |
| 1360 |
|
| 1361 |
pub runner: String, |
| 1362 |
} |
| 1363 |
|
| 1364 |
|
| 1365 |
|
| 1366 |
|
| 1367 |
|
| 1368 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1369 |
pub struct Assistant { |
| 1370 |
pub name: String, |
| 1371 |
pub endpoint: String, |
| 1372 |
pub api: String, |
| 1373 |
pub model: String, |
| 1374 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 1375 |
pub headers: String, |
| 1376 |
pub enabled: bool, |
| 1377 |
pub budget: i64, |
| 1378 |
pub has_token: bool, |
| 1379 |
|
| 1380 |
|
| 1381 |
#[serde(default, skip_serializing_if = "String::is_empty")] |
| 1382 |
pub from: String, |
| 1383 |
|
| 1384 |
#[serde(default)] |
| 1385 |
pub off_above: bool, |
| 1386 |
} |
| 1387 |
|
| 1388 |
|
| 1389 |
|
| 1390 |
|
| 1391 |
|
| 1392 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1393 |
pub struct NewAssistant { |
| 1394 |
#[serde(default)] |
| 1395 |
pub name: String, |
| 1396 |
#[serde(default)] |
| 1397 |
pub preset: String, |
| 1398 |
#[serde(default)] |
| 1399 |
pub endpoint: String, |
| 1400 |
#[serde(default)] |
| 1401 |
pub api: String, |
| 1402 |
pub model: String, |
| 1403 |
#[serde(default)] |
| 1404 |
pub token: String, |
| 1405 |
#[serde(default)] |
| 1406 |
pub headers: String, |
| 1407 |
#[serde(default = "yes")] |
| 1408 |
pub enabled: bool, |
| 1409 |
#[serde(default)] |
| 1410 |
pub budget: Option<i64>, |
| 1411 |
} |
| 1412 |
|
| 1413 |
fn yes() -> bool { |
| 1414 |
true |
| 1415 |
} |
| 1416 |
|
| 1417 |
|
| 1418 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1419 |
pub struct AssistantPrompt { |
| 1420 |
pub prompt: String, |
| 1421 |
#[serde(default, skip_serializing_if = "Vec::is_empty")] |
| 1422 |
pub inherited: Vec<(String, String)>, |
| 1423 |
} |
| 1424 |
|
| 1425 |
|
| 1426 |
|
| 1427 |
|
| 1428 |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] |
| 1429 |
pub struct CoverageReport { |
| 1430 |
pub id: i64, |
| 1431 |
pub run: i64, |
| 1432 |
pub job: String, |
| 1433 |
pub bookmark: String, |
| 1434 |
|
| 1435 |
pub state: String, |
| 1436 |
|
| 1437 |
pub format: String, |
| 1438 |
pub lines_found: i64, |
| 1439 |
pub lines_hit: i64, |
| 1440 |
pub percent: Option<f64>, |
| 1441 |
pub functions_found: i64, |
| 1442 |
pub functions_hit: i64, |
| 1443 |
pub branches_found: i64, |
| 1444 |
pub branches_hit: i64, |
| 1445 |
pub files: i64, |
| 1446 |
|
| 1447 |
pub dropped: i64, |
| 1448 |
pub created_ms: i64, |
| 1449 |
|
| 1450 |
pub url: String, |
| 1451 |
|
| 1452 |
|
| 1453 |
#[serde(default, skip_serializing_if = "Option::is_none")] |
| 1454 |
pub uploaded_by: Option<String>, |
| 1455 |
} |
| 1456 |
|
| 1457 |
|
| 1458 |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] |
| 1459 |
pub struct CoverageFile { |
| 1460 |
pub path: String, |
| 1461 |
pub lines_found: i64, |
| 1462 |
pub lines_hit: i64, |
| 1463 |
pub percent: Option<f64>, |
| 1464 |
pub functions_found: i64, |
| 1465 |
pub functions_hit: i64, |
| 1466 |
pub branches_found: i64, |
| 1467 |
pub branches_hit: i64, |
| 1468 |
} |
| 1469 |
|
| 1470 |
|
| 1471 |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)] |
| 1472 |
pub struct CoverageDetail { |
| 1473 |
pub report: CoverageReport, |
| 1474 |
pub files: Vec<CoverageFile>, |
| 1475 |
} |
| 1476 |
|
| 1477 |
|
| 1478 |
|
| 1479 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1480 |
pub struct TestReport { |
| 1481 |
pub id: i64, |
| 1482 |
pub run: i64, |
| 1483 |
pub job: String, |
| 1484 |
pub bookmark: String, |
| 1485 |
pub state: String, |
| 1486 |
pub tests: i64, |
| 1487 |
pub passed: i64, |
| 1488 |
pub failed: i64, |
| 1489 |
pub errors: i64, |
| 1490 |
pub skipped: i64, |
| 1491 |
|
| 1492 |
pub time_ms: i64, |
| 1493 |
pub created_ms: i64, |
| 1494 |
pub url: String, |
| 1495 |
} |
| 1496 |
|
| 1497 |
|
| 1498 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1499 |
pub struct TestCase { |
| 1500 |
pub suite: String, |
| 1501 |
pub classname: String, |
| 1502 |
pub name: String, |
| 1503 |
|
| 1504 |
pub status: String, |
| 1505 |
pub time_ms: i64, |
| 1506 |
pub message: String, |
| 1507 |
|
| 1508 |
pub output: String, |
| 1509 |
} |
| 1510 |
|
| 1511 |
|
| 1512 |
|
| 1513 |
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] |
| 1514 |
pub struct TestReportDetail { |
| 1515 |
pub report: TestReport, |
| 1516 |
pub cases: Vec<TestCase>, |
| 1517 |
} |