| 1 | use super::RepositoryResult; |
| 2 | use crate::domain::{IssueId, Label, LabelId, PullRequestId, RepoId}; |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | pub trait LabelRepository: Send + Sync { |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | fn list_by_repo( |
| 22 | &self, |
| 23 | repo_id: &RepoId, |
| 24 | ) -> impl Future<Output = RepositoryResult<Vec<Label>>> + Send; |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | fn find_by_id( |
| 32 | &self, |
| 33 | id: &LabelId, |
| 34 | ) -> impl Future<Output = RepositoryResult<Option<Label>>> + Send; |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | fn find_by_name( |
| 40 | &self, |
| 41 | repo_id: &RepoId, |
| 42 | name: &str, |
| 43 | ) -> impl Future<Output = RepositoryResult<Option<Label>>> + Send; |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | fn save(&self, label: &Label) -> impl Future<Output = RepositoryResult<()>> + Send; |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | fn delete(&self, id: &LabelId) -> impl Future<Output = RepositoryResult<()>> + Send; |
| 56 | |
| 57 | |
| 58 | fn labels_for_issue( |
| 59 | &self, |
| 60 | issue_id: &IssueId, |
| 61 | ) -> impl Future<Output = RepositoryResult<Vec<Label>>> + Send; |
| 62 | |
| 63 | |
| 64 | |
| 65 | fn labels_for_repo( |
| 66 | &self, |
| 67 | repo_id: &RepoId, |
| 68 | ) -> impl Future<Output = RepositoryResult<Vec<(IssueId, Label)>>> + Send; |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | fn issue_counts( |
| 75 | &self, |
| 76 | repo_id: &RepoId, |
| 77 | ) -> impl Future<Output = RepositoryResult<Vec<(LabelId, u64)>>> + Send; |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | fn set_issue_labels( |
| 85 | &self, |
| 86 | issue_id: &IssueId, |
| 87 | labels: &[LabelId], |
| 88 | ) -> impl Future<Output = RepositoryResult<()>> + Send; |
| 89 | |
| 90 | |
| 91 | fn labels_for_pull( |
| 92 | &self, |
| 93 | pull_id: &PullRequestId, |
| 94 | ) -> impl Future<Output = RepositoryResult<Vec<Label>>> + Send; |
| 95 | |
| 96 | |
| 97 | |
| 98 | fn labels_for_repo_pulls( |
| 99 | &self, |
| 100 | repo_id: &RepoId, |
| 101 | ) -> impl Future<Output = RepositoryResult<Vec<(PullRequestId, Label)>>> + Send; |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | fn pull_counts( |
| 109 | &self, |
| 110 | repo_id: &RepoId, |
| 111 | ) -> impl Future<Output = RepositoryResult<Vec<(LabelId, u64)>>> + Send; |
| 112 | |
| 113 | |
| 114 | fn set_pull_labels( |
| 115 | &self, |
| 116 | pull_id: &PullRequestId, |
| 117 | labels: &[LabelId], |
| 118 | ) -> impl Future<Output = RepositoryResult<()>> + Send; |
| 119 | } |