1#![allow(clippy::needless_update)]
2
3use std::collections::HashMap;
4
5use derive_setters::Setters;
6use merge::Merge;
7use serde::{Deserialize, Serialize};
8
9use crate::is_default;
10
11#[derive(Default, Debug, Clone, Deserialize, Serialize, Merge, Setters, PartialEq, Eq)]
14#[setters(strip_option, into)]
15pub struct Event {
16 #[serde(skip_serializing_if = "Option::is_none")]
17 #[merge(strategy = merge::option::overwrite_none)]
18 pub branch_protection_rule: Option<BranchProtectionRule>,
19 #[serde(skip_serializing_if = "Option::is_none")]
20 #[merge(strategy = merge::option::overwrite_none)]
21 pub check_run: Option<CheckRun>,
22 #[serde(skip_serializing_if = "Option::is_none")]
23 #[merge(strategy = merge::option::overwrite_none)]
24 pub check_suite: Option<CheckSuite>,
25 #[serde(skip_serializing_if = "Option::is_none")]
26 #[merge(strategy = merge::option::overwrite_none)]
27 pub create: Option<Create>,
28 #[serde(skip_serializing_if = "Option::is_none")]
29 #[merge(strategy = merge::option::overwrite_none)]
30 pub delete: Option<Delete>,
31 #[serde(skip_serializing_if = "Option::is_none")]
32 #[merge(strategy = merge::option::overwrite_none)]
33 pub deployment: Option<Deployment>,
34 #[serde(skip_serializing_if = "Option::is_none")]
35 #[merge(strategy = merge::option::overwrite_none)]
36 pub deployment_status: Option<DeploymentStatus>,
37 #[serde(skip_serializing_if = "Option::is_none")]
38 #[merge(strategy = merge::option::overwrite_none)]
39 pub discussion: Option<Discussion>,
40 #[serde(skip_serializing_if = "Option::is_none")]
41 #[merge(strategy = merge::option::overwrite_none)]
42 pub discussion_comment: Option<DiscussionComment>,
43 #[serde(skip_serializing_if = "Option::is_none")]
44 #[merge(strategy = merge::option::overwrite_none)]
45 pub fork: Option<bool>,
46 #[serde(skip_serializing_if = "Option::is_none")]
47 #[merge(strategy = merge::option::overwrite_none)]
48 pub gollum: Option<bool>,
49 #[serde(skip_serializing_if = "Option::is_none")]
50 #[merge(strategy = merge::option::overwrite_none)]
51 pub issue_comment: Option<IssueComment>,
52 #[serde(skip_serializing_if = "Option::is_none")]
53 #[merge(strategy = merge::option::overwrite_none)]
54 pub issues: Option<Issues>,
55 #[serde(skip_serializing_if = "Option::is_none")]
56 #[merge(strategy = merge::option::overwrite_none)]
57 pub label: Option<Label>,
58 #[serde(skip_serializing_if = "Option::is_none")]
59 #[merge(strategy = merge::option::overwrite_none)]
60 pub merge_group: Option<MergeGroup>,
61 #[serde(skip_serializing_if = "Option::is_none")]
62 #[merge(strategy = merge::option::overwrite_none)]
63 pub milestone: Option<Milestone>,
64 #[serde(skip_serializing_if = "Option::is_none")]
65 #[merge(strategy = merge::option::overwrite_none)]
66 pub page_build: Option<bool>,
67 #[serde(skip_serializing_if = "Option::is_none")]
68 #[merge(strategy = merge::option::overwrite_none)]
69 pub public: Option<bool>,
70 #[serde(skip_serializing_if = "Option::is_none")]
71 #[merge(strategy = merge::option::overwrite_none)]
72 pub pull_request: Option<PullRequest>,
73 #[serde(skip_serializing_if = "Option::is_none")]
74 #[merge(strategy = merge::option::overwrite_none)]
75 pub pull_request_review: Option<PullRequestReview>,
76 #[serde(skip_serializing_if = "Option::is_none")]
77 #[merge(strategy = merge::option::overwrite_none)]
78 pub pull_request_review_comment: Option<PullRequestReviewComment>,
79 #[serde(skip_serializing_if = "Option::is_none")]
80 #[merge(strategy = merge::option::overwrite_none)]
81 pub pull_request_target: Option<PullRequestTarget>,
82 #[serde(skip_serializing_if = "Option::is_none")]
83 #[merge(strategy = merge::option::overwrite_none)]
84 pub push: Option<Push>,
85 #[serde(skip_serializing_if = "Option::is_none")]
86 #[merge(strategy = merge::option::overwrite_none)]
87 pub registry_package: Option<RegistryPackage>,
88 #[serde(skip_serializing_if = "Option::is_none")]
89 #[merge(strategy = merge::option::overwrite_none)]
90 pub release: Option<Release>,
91 #[serde(skip_serializing_if = "Option::is_none")]
92 #[merge(strategy = merge::option::overwrite_none)]
93 pub repository_dispatch: Option<RepositoryDispatch>,
94 #[serde(skip_serializing_if = "Option::is_none")]
95 #[merge(strategy = merge::option::overwrite_none)]
96 pub schedule: Option<Vec<Schedule>>,
97 #[serde(skip_serializing_if = "Option::is_none")]
98 #[merge(strategy = merge::option::overwrite_none)]
99 pub status: Option<bool>,
100 #[serde(skip_serializing_if = "Option::is_none")]
101 #[merge(strategy = merge::option::overwrite_none)]
102 pub watch: Option<Watch>,
103 #[serde(skip_serializing_if = "Option::is_none")]
104 #[merge(strategy = merge::option::overwrite_none)]
105 pub workflow_call: Option<WorkflowCall>,
106 #[serde(skip_serializing_if = "Option::is_none")]
107 #[merge(strategy = merge::option::overwrite_none)]
108 pub workflow_dispatch: Option<WorkflowDispatch>,
109 #[serde(skip_serializing_if = "Option::is_none")]
110 #[merge(strategy = merge::option::overwrite_none)]
111 pub workflow_run: Option<WorkflowRun>,
112}
113
114impl Event {
115 pub fn add_schedule(mut self, schedule: impl Into<Schedule>) -> Self {
116 if let Some(list) = self.schedule.as_mut() {
117 list.push(schedule.into());
118 } else {
119 self.schedule = Some(vec![schedule.into()])
120 }
121
122 self
123 }
124
125 pub fn add_cron_schedule(self, cron: impl ToString) -> Self {
126 self.add_schedule(Schedule::new(cron))
127 }
128}
129
130#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
133#[serde(rename_all = "snake_case")]
134pub enum BranchProtectionRuleType {
135 Created,
137 Edited,
139 Deleted,
141}
142
143#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
145#[setters(strip_option, into)]
146pub struct BranchProtectionRule {
147 #[serde(default, skip_serializing_if = "Vec::is_empty")]
148 pub types: Vec<BranchProtectionRuleType>,
149}
150
151impl BranchProtectionRule {
152 pub fn add_type(mut self, type_: BranchProtectionRuleType) -> Self {
154 self.types.push(type_);
155 self
156 }
157}
158
159#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
162#[serde(rename_all = "snake_case")]
163pub enum CheckRunType {
164 Created,
166 Rerequested,
168 Completed,
170 RequestedAction,
172}
173
174#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
175#[setters(strip_option, into)]
176pub struct CheckRun {
177 #[serde(default, skip_serializing_if = "Vec::is_empty")]
178 pub types: Vec<CheckRunType>,
179}
180
181impl CheckRun {
182 pub fn add_type(mut self, type_: CheckRunType) -> Self {
184 self.types.push(type_);
185 self
186 }
187}
188
189#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
192#[serde(rename_all = "snake_case")]
193pub enum CheckSuiteType {
194 Completed,
196}
197
198#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
201#[setters(strip_option, into)]
202pub struct CheckSuite {
203 #[serde(default, skip_serializing_if = "Vec::is_empty")]
204 pub types: Vec<CheckSuiteType>,
205}
206
207impl CheckSuite {
208 pub fn add_type(mut self, type_: CheckSuiteType) -> Self {
210 self.types.push(type_);
211 self
212 }
213}
214
215#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
218#[setters(strip_option, into)]
219pub struct Create {
220 #[serde(default, skip_serializing_if = "Vec::is_empty")]
222 pub branches: Vec<String>,
223 #[serde(default, skip_serializing_if = "Vec::is_empty")]
225 pub tags: Vec<String>,
226}
227
228impl Create {
229 pub fn add_branch<S: Into<String>>(mut self, branch: S) -> Self {
231 self.branches.push(branch.into());
232 self
233 }
234
235 pub fn add_tag<S: Into<String>>(mut self, tag: S) -> Self {
237 self.tags.push(tag.into());
238 self
239 }
240}
241
242#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
245#[setters(strip_option, into)]
246pub struct Delete {
247 #[serde(default, skip_serializing_if = "Vec::is_empty")]
249 pub branches: Vec<String>,
250 #[serde(default, skip_serializing_if = "Vec::is_empty")]
252 pub tags: Vec<String>,
253}
254
255impl Delete {
256 pub fn add_branch<S: Into<String>>(mut self, branch: S) -> Self {
258 self.branches.push(branch.into());
259 self
260 }
261
262 pub fn add_tag<S: Into<String>>(mut self, tag: S) -> Self {
264 self.tags.push(tag.into());
265 self
266 }
267}
268
269#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
273#[setters(strip_option, into)]
274pub struct Deployment {
275 #[serde(default, skip_serializing_if = "Vec::is_empty")]
277 pub branches: Vec<String>,
278}
279
280impl Deployment {
281 pub fn add_branch<S: Into<String>>(mut self, branch: S) -> Self {
283 self.branches.push(branch.into());
284 self
285 }
286}
287
288#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
292#[setters(strip_option, into)]
293pub struct DeploymentStatus {
294 #[serde(default, skip_serializing_if = "Vec::is_empty")]
296 pub states: Vec<String>,
297}
298
299impl DeploymentStatus {
300 pub fn add_state<S: Into<String>>(mut self, state: S) -> Self {
302 self.states.push(state.into());
303 self
304 }
305}
306
307#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
310#[serde(rename_all = "snake_case")]
311pub enum DiscussionType {
312 Created,
314 Edited,
316 Deleted,
318 Transferred,
320 Pinned,
322 Unpinned,
324 Labeled,
326 Unlabeled,
328 Locked,
330 Unlocked,
332 CategoryChanged,
334 Answered,
336 Unanswered,
338}
339
340#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
343pub struct Discussion {
344 #[serde(default, skip_serializing_if = "Vec::is_empty")]
346 pub types: Vec<DiscussionType>,
347}
348
349impl Discussion {
350 pub fn add_type(mut self, type_: DiscussionType) -> Self {
352 self.types.push(type_);
353 self
354 }
355}
356
357#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
360#[serde(rename_all = "snake_case")]
361pub enum DiscussionCommentType {
362 Created,
364 Edited,
366 Deleted,
368}
369
370#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
373pub struct DiscussionComment {
374 #[serde(default, skip_serializing_if = "Vec::is_empty")]
376 pub types: Vec<DiscussionCommentType>,
377}
378
379impl DiscussionComment {
380 pub fn add_type(mut self, type_: DiscussionCommentType) -> Self {
382 self.types.push(type_);
383 self
384 }
385}
386
387#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
390pub struct IssueComment {
391 #[serde(default, skip_serializing_if = "Vec::is_empty")]
393 pub types: Vec<IssueCommentType>,
394}
395
396#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
398#[serde(rename_all = "snake_case")]
399pub enum IssueCommentType {
400 Created,
402 Edited,
404 Deleted,
406}
407
408impl IssueComment {
409 pub fn add_type(mut self, type_: IssueCommentType) -> Self {
411 self.types.push(type_);
412 self
413 }
414}
415
416#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
419#[serde(rename_all = "snake_case")]
420pub enum IssuesType {
421 Opened,
423 Edited,
425 Deleted,
427 Transferred,
429 Pinned,
431 Unpinned,
433 Closed,
435 Reopened,
437 Assigned,
439 Unassigned,
441 Labeled,
443 Unlabeled,
445 Locked,
447 Unlocked,
449 Milestoned,
451 Demilestoned,
453}
454
455#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
458#[setters(strip_option, into)]
459pub struct Issues {
460 #[serde(default, skip_serializing_if = "Vec::is_empty")]
462 pub types: Vec<IssuesType>,
463}
464
465impl Issues {
466 pub fn add_type(mut self, type_: IssuesType) -> Self {
468 self.types.push(type_);
469 self
470 }
471}
472
473#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
476#[serde(rename_all = "snake_case")]
477pub enum LabelType {
478 Created,
480 Edited,
482 Deleted,
484}
485
486#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
489#[setters(strip_option, into)]
490pub struct Label {
491 #[serde(default, skip_serializing_if = "Vec::is_empty")]
493 pub types: Vec<LabelType>,
494}
495
496impl Label {
497 pub fn add_type(mut self, type_: LabelType) -> Self {
499 self.types.push(type_);
500 self
501 }
502}
503
504#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
505#[serde(rename_all = "snake_case")]
506pub enum MergeGroupType {
507 ChecksRequested,
508}
509
510#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
511#[setters(strip_option, into)]
512pub struct MergeGroup {
513 #[serde(default, skip_serializing_if = "Vec::is_empty")]
514 pub types: Vec<MergeGroupType>,
515}
516
517impl MergeGroup {
518 pub fn add_type(mut self, type_: MergeGroupType) -> Self {
519 self.types.push(type_);
520 self
521 }
522}
523
524#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
525#[serde(rename_all = "snake_case")]
526pub enum MilestoneType {
527 Created,
528 Closed,
529 Opened,
530 Edited,
531 Deleted,
532}
533
534#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
535#[setters(strip_option, into)]
536pub struct Milestone {
537 #[serde(default, skip_serializing_if = "Vec::is_empty")]
538 pub types: Vec<MilestoneType>,
539}
540
541impl Milestone {
542 pub fn add_type(mut self, type_: MilestoneType) -> Self {
543 self.types.push(type_);
544 self
545 }
546}
547
548#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
549#[serde(rename_all = "snake_case")]
550pub enum PullRequestType {
551 Assigned,
552 Unassigned,
553 Labeled,
554 Unlabeled,
555 Opened,
556 Edited,
557 Closed,
558 Reopened,
559 Synchronize,
560 ReadyForReview,
561 Locked,
562 Unlocked,
563 ReviewRequested,
564 ReviewRequestRemoved,
565}
566
567#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
568#[setters(strip_option, into)]
569pub struct PullRequest {
570 #[serde(default, skip_serializing_if = "Vec::is_empty")]
571 pub types: Vec<PullRequestType>,
572 #[serde(default, skip_serializing_if = "Vec::is_empty")]
573 pub branches: Vec<String>,
574 #[serde(default, skip_serializing_if = "Vec::is_empty")]
575 pub paths: Vec<String>,
576}
577
578impl PullRequest {
579 pub fn add_type(mut self, type_: PullRequestType) -> Self {
580 self.types.push(type_);
581 self
582 }
583
584 pub fn add_branch<S: Into<String>>(mut self, branch: S) -> Self {
585 self.branches.push(branch.into());
586 self
587 }
588
589 pub fn add_path<S: Into<String>>(mut self, path: S) -> Self {
590 self.paths.push(path.into());
591 self
592 }
593}
594
595#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
598#[serde(rename_all = "snake_case")]
599pub enum PullRequestReviewType {
600 Submitted,
602 Edited,
604 Dismissed,
606}
607
608#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
611#[setters(strip_option, into)]
612pub struct PullRequestReview {
613 #[serde(default, skip_serializing_if = "Vec::is_empty")]
615 pub types: Vec<PullRequestReviewType>,
616}
617
618impl PullRequestReview {
619 pub fn add_type(mut self, type_: PullRequestReviewType) -> Self {
621 self.types.push(type_);
622 self
623 }
624}
625
626#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
629#[serde(rename_all = "snake_case")]
630pub enum PullRequestReviewCommentType {
631 Created,
633 Edited,
635 Deleted,
637}
638
639#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
641#[setters(strip_option, into)]
642pub struct PullRequestReviewComment {
643 #[serde(default, skip_serializing_if = "Vec::is_empty")]
645 pub types: Vec<PullRequestReviewCommentType>,
646}
647
648impl PullRequestReviewComment {
649 pub fn add_type(mut self, type_: PullRequestReviewCommentType) -> Self {
651 self.types.push(type_);
652 self
653 }
654}
655
656#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
659#[setters(strip_option, into)]
660pub struct PullRequestTarget {
661 #[serde(default, skip_serializing_if = "Vec::is_empty")]
663 pub types: Vec<PullRequestType>,
664 #[serde(default, skip_serializing_if = "Vec::is_empty")]
666 pub branches: Vec<String>,
667}
668
669impl PullRequestTarget {
670 pub fn add_type(mut self, type_: PullRequestType) -> Self {
672 self.types.push(type_);
673 self
674 }
675
676 pub fn add_branch<S: Into<String>>(mut self, branch: S) -> Self {
678 self.branches.push(branch.into());
679 self
680 }
681}
682
683#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
686#[setters(strip_option, into)]
687pub struct Push {
688 #[serde(default, skip_serializing_if = "Vec::is_empty")]
690 pub branches: Vec<String>,
691 #[serde(default, skip_serializing_if = "Vec::is_empty")]
693 pub paths: Vec<String>,
694 #[serde(default, skip_serializing_if = "Vec::is_empty")]
696 pub tags: Vec<String>,
697}
698
699impl Push {
700 pub fn add_branch<S: Into<String>>(mut self, branch: S) -> Self {
702 self.branches.push(branch.into());
703 self
704 }
705
706 pub fn add_path<S: Into<String>>(mut self, path: S) -> Self {
708 self.paths.push(path.into());
709 self
710 }
711
712 pub fn add_tag<S: Into<String>>(mut self, tag: S) -> Self {
714 self.tags.push(tag.into());
715 self
716 }
717}
718
719#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
722#[serde(rename_all = "snake_case")]
723pub enum RegistryPackageType {
724 Published,
726 Updated,
728}
729
730#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
733#[setters(strip_option, into)]
734pub struct RegistryPackage {
735 #[serde(default, skip_serializing_if = "Vec::is_empty")]
737 pub types: Vec<RegistryPackageType>,
738}
739
740impl RegistryPackage {
741 pub fn add_type(mut self, type_: RegistryPackageType) -> Self {
743 self.types.push(type_);
744 self
745 }
746}
747
748#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
751#[serde(rename_all = "snake_case")]
752pub enum ReleaseType {
753 Published,
755 Unpublished,
757 Created,
759 Edited,
761 Deleted,
763 Prereleased,
765 Released,
767}
768
769#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
772#[setters(strip_option, into)]
773pub struct Release {
774 #[serde(default, skip_serializing_if = "Vec::is_empty")]
776 pub types: Vec<ReleaseType>,
777}
778
779impl Release {
780 pub fn add_type(mut self, type_: ReleaseType) -> Self {
782 self.types.push(type_);
783 self
784 }
785}
786
787#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
788#[setters(strip_option, into)]
789pub struct RepositoryDispatch {
790 #[serde(default, skip_serializing_if = "Vec::is_empty")]
791 pub types: Vec<String>,
792}
793
794impl RepositoryDispatch {
795 pub fn add_type<S: Into<String>>(mut self, type_: S) -> Self {
796 self.types.push(type_.into());
797 self
798 }
799}
800
801#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
802#[setters(strip_option, into)]
803pub struct Schedule {
804 pub cron: String,
805}
806
807impl Schedule {
808 pub fn new(cron: impl ToString) -> Self {
809 Self { cron: cron.to_string() }
810 }
811}
812
813#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
814#[setters(strip_option, into)]
815pub struct Watch {
816 #[serde(default, skip_serializing_if = "Vec::is_empty")]
817 pub types: Vec<String>,
818}
819
820impl Watch {
821 pub fn add_type<S: Into<String>>(mut self, type_: S) -> Self {
822 self.types.push(type_.into());
823 self
824 }
825}
826
827#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
830#[setters(strip_option, into)]
831pub struct WorkflowCall {
832 #[serde(skip_serializing_if = "HashMap::is_empty")]
834 pub inputs: HashMap<String, WorkflowCallInput>,
835 #[serde(skip_serializing_if = "HashMap::is_empty")]
837 pub outputs: HashMap<String, WorkflowCallOutput>,
838 #[serde(skip_serializing_if = "HashMap::is_empty")]
840 pub secrets: HashMap<String, WorkflowCallSecret>,
841}
842
843impl WorkflowCall {
844 pub fn add_input(mut self, name: impl Into<String>, input: WorkflowCallInput) -> Self {
845 self.inputs.insert(name.into(), input);
846 self
847 }
848}
849
850#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq, Setters, Eq)]
852#[setters(strip_option, into)]
853pub struct WorkflowCallInput {
854 #[serde(skip_serializing_if = "String::is_empty")]
856 pub description: String,
857 #[serde(skip_serializing_if = "is_default")]
859 pub required: bool,
860 #[serde(rename = "type")]
862 pub input_type: String,
863 #[serde(skip_serializing_if = "Option::is_none")]
865 pub default: Option<String>,
866}
867
868#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq, Setters, Eq)]
870#[setters(strip_option, into)]
871pub struct WorkflowCallOutput {
872 #[serde(skip_serializing_if = "String::is_empty")]
874 pub description: String,
875 #[serde(skip_serializing_if = "String::is_empty")]
877 pub value: String,
878}
879
880#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq, Setters, Eq)]
882#[setters(strip_option, into)]
883pub struct WorkflowCallSecret {
884 #[serde(skip_serializing_if = "String::is_empty")]
886 pub description: String,
887 #[serde(skip_serializing_if = "is_default")]
889 pub required: bool,
890}
891
892#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
896#[setters(strip_option, into)]
897pub struct WorkflowDispatch {
898 #[serde(skip_serializing_if = "HashMap::is_empty")]
900 pub inputs: HashMap<String, WorkflowDispatchInput>,
901}
902
903#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
905#[setters(strip_option, into)]
906pub struct WorkflowDispatchInput {
907 #[serde(skip_serializing_if = "String::is_empty")]
909 pub description: String,
910 #[serde(skip_serializing_if = "is_default")]
912 pub required: bool,
913 #[serde(rename = "type")]
915 pub input_type: String,
916 #[serde(skip_serializing_if = "Option::is_none")]
918 pub default: Option<String>,
919}
920
921#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
924#[serde(rename_all = "snake_case")]
925pub enum WorkflowRunType {
926 Completed,
928 Requested,
930 InProgress,
932}
933
934#[derive(Debug, Clone, Default, Deserialize, Serialize, Setters, PartialEq, Eq)]
936#[setters(strip_option, into)]
937pub struct WorkflowRun {
938 #[serde(default, skip_serializing_if = "Vec::is_empty")]
940 pub types: Vec<WorkflowRunType>,
941 #[serde(default, skip_serializing_if = "Vec::is_empty")]
943 pub workflows: Vec<String>,
944 #[serde(default, skip_serializing_if = "Vec::is_empty")]
946 pub branches: Vec<String>,
947}
948
949impl WorkflowRun {
950 pub fn add_type(mut self, type_: WorkflowRunType) -> Self {
952 self.types.push(type_);
953 self
954 }
955
956 pub fn add_workflow<S: Into<String>>(mut self, workflow: S) -> Self {
958 self.workflows.push(workflow.into());
959 self
960 }
961
962 pub fn add_branch<S: Into<String>>(mut self, branch: S) -> Self {
964 self.branches.push(branch.into());
965 self
966 }
967}