This commit is contained in:
2026-04-21 20:30:41 +01:00
parent 6c60013295
commit e8005f3fbf
13 changed files with 234 additions and 97 deletions

View File

@@ -1,5 +1,6 @@
use crate::query;
pub(crate) mod auth;
pub(crate) mod repo;
pub(crate) mod user;
@@ -7,16 +8,36 @@ pub(crate) mod user;
pub struct QueryContext {
pub(crate) http: reqwest::Client,
pub(crate) auth: Option<Auth>,
pub(crate) github: GithubCredentials,
}
#[derive(Clone)]
pub(crate) struct Auth {
pub(crate) access_token: String,
pub(crate) refresh_token: String,
pub(crate) access_token: &'static str,
pub(crate) refresh_token: &'static str,
}
#[derive(Clone)]
pub(crate) struct GithubCredentials {
pub(crate) client_id: &'static str,
}
pub enum Error {
Unauthenticated,
MalformedResponse(serde_json::Error),
HttpError(reqwest::Error),
}
impl query::Context for QueryContext {}
impl From<reqwest::Error> for Error {
fn from(value: reqwest::Error) -> Self {
Self::HttpError(value)
}
}
impl From<serde_json::Error> for Error {
fn from(value: serde_json::Error) -> Self {
Self::MalformedResponse(value)
}
}