Skip to content

Commit ceaada4

Browse files
committed
Initial graphql and some refactoring
1 parent 201b5d9 commit ceaada4

File tree

8 files changed

+46168
-173
lines changed

8 files changed

+46168
-173
lines changed

Cargo.lock

Lines changed: 179 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ serde_path_to_error = "0.1.2"
3636
octocrab = "0.9.1"
3737
comrak = "0.8.2"
3838
route-recognizer = "0.3.0"
39+
cynic = { version = "0.14" }
3940

4041
[dependencies.serde]
4142
version = "1"

src/actions.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,15 @@ pub struct Query<'a> {
2323
pub queries: Vec<QueryMap<'a>>,
2424
}
2525

26+
pub enum QueryKind {
27+
List,
28+
Count,
29+
}
30+
2631
pub struct QueryMap<'a> {
2732
pub name: &'a str,
28-
pub query: github::Query<'a>,
33+
pub kind: QueryKind,
34+
pub query: github::GithubQuery<'a>,
2935
}
3036

3137
#[derive(serde::Serialize)]
@@ -75,9 +81,12 @@ impl<'a> Action for Step<'a> {
7581
full_name: repo.to_string(),
7682
};
7783

78-
for QueryMap { name, query } in queries {
79-
match query.kind {
80-
github::QueryKind::List => {
84+
for QueryMap { name, kind, query } in queries {
85+
let query = match query {
86+
github::GithubQuery::REST(query) => query,
87+
};
88+
match kind {
89+
QueryKind::List => {
8190
let issues_search_result = repository.get_issues(&gh, &query).await;
8291

8392
match issues_search_result {
@@ -125,7 +134,7 @@ impl<'a> Action for Step<'a> {
125134
}
126135
}
127136

128-
github::QueryKind::Count => {
137+
QueryKind::Count => {
129138
let count = repository.get_issues_count(&gh, &query).await;
130139

131140
match count {

0 commit comments

Comments
 (0)