2022-03-26 23:53:27 +01:00
|
|
|
use reqwest::Client;
|
2022-01-30 22:18:09 +01:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct Request {
|
|
|
|
pub repo: Repository,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct Repository {
|
2023-07-19 21:51:47 +02:00
|
|
|
pub config_path: Option<String>,
|
|
|
|
pub config_file: Option<String>,
|
|
|
|
pub config: Option<String>,
|
2022-01-30 22:18:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Serialize)]
|
|
|
|
pub struct Response {
|
|
|
|
pub data: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
2022-03-26 23:53:27 +01:00
|
|
|
pub struct APIConfig(pub Client);
|
2022-01-30 22:18:09 +01:00
|
|
|
|
|
|
|
impl Request {
|
2023-07-19 21:51:47 +02:00
|
|
|
pub fn config(&self) -> Option<String> {
|
|
|
|
self.repo.config_path.clone().or(self.repo.config_file.clone()).or(self.repo.config.clone())
|
2022-03-23 21:18:35 +01:00
|
|
|
}
|
2022-01-30 22:18:09 +01:00
|
|
|
}
|