Add more debug logging

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2024-06-09 12:45:31 +10:00
parent 23a1bedc41
commit a236f53121
No known key found for this signature in database
GPG key ID: 76D1E687CA3C4928
3 changed files with 11 additions and 9 deletions

View file

@ -1,4 +1,4 @@
use std::{future::Future, sync::OnceLock, time::Duration};
use std::{fmt::Debug, future::Future, sync::OnceLock, time::Duration};
use binstalk_downloader::remote::{self, Response, Url};
use compact_str::CompactString;
@ -81,7 +81,7 @@ where
}
}
#[derive(Deserialize)]
#[derive(Debug, Deserialize)]
struct GraphQLResponse<T> {
data: T,
errors: Option<GhGraphQLErrors>,
@ -109,7 +109,7 @@ pub(super) fn issue_graphql_query<T>(
auth_token: &str,
) -> impl Future<Output = Result<T, GhApiError>> + Send + Sync + 'static
where
T: DeserializeOwned,
T: DeserializeOwned + Debug,
{
let res = to_json_string(&GraphQLQuery { query })
.map_err(remote::Error::from)
@ -132,6 +132,8 @@ where
let mut response: GraphQLResponse<T> = response.json().await?;
debug!("response = {response:?}");
if let Some(error) = response.errors.take() {
Err(error.into())
} else {

View file

@ -83,30 +83,30 @@ pub(super) fn fetch_release_artifacts_restful_api(
)
}
#[derive(Deserialize)]
#[derive(Debug, Deserialize)]
struct GraphQLData {
repository: Option<GraphQLRepo>,
}
#[derive(Deserialize)]
#[derive(Debug, Deserialize)]
struct GraphQLRepo {
release: Option<GraphQLRelease>,
}
#[derive(Deserialize)]
#[derive(Debug, Deserialize)]
struct GraphQLRelease {
#[serde(rename = "releaseAssets")]
assets: GraphQLReleaseAssets,
}
#[derive(Deserialize)]
#[derive(Debug, Deserialize)]
struct GraphQLReleaseAssets {
nodes: Vec<Artifact>,
#[serde(rename = "pageInfo")]
page_info: GraphQLPageInfo,
}
#[derive(Deserialize)]
#[derive(Debug, Deserialize)]
struct GraphQLPageInfo {
#[serde(rename = "endCursor")]
end_cursor: Option<CompactString>,

View file

@ -48,7 +48,7 @@ pub(super) fn fetch_repo_info_restful_api(
issue_restful_api(client, &["repos", owner, repo])
}
#[derive(Deserialize)]
#[derive(Debug, Deserialize)]
struct GraphQLData {
repository: Option<RepoInfo>,
}