mirror of
https://github.com/DeterminateSystems/flake-checker.git
synced 2024-09-11 14:25:44 +03:00
Undo some naming changes
This commit is contained in:
parent
6898d06d26
commit
d332a5f608
@ -1,43 +0,0 @@
|
||||
use crate::error::FlakeCheckerError;
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
const SUPPORTED_REFS_URL: &str = "https://prometheus.nixos.org/api/v1/query?query=channel_revision";
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Response {
|
||||
data: Data,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Data {
|
||||
result: Vec<DataResult>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct DataResult {
|
||||
metric: Metric,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Metric {
|
||||
channel: String,
|
||||
current: String,
|
||||
}
|
||||
|
||||
pub(crate) fn check(supported_refs: Vec<String>) -> Result<bool, FlakeCheckerError> {
|
||||
Ok(get()? == supported_refs)
|
||||
}
|
||||
|
||||
pub(crate) fn get() -> Result<Vec<String>, FlakeCheckerError> {
|
||||
let officially_supported: Vec<String> = reqwest::blocking::get(SUPPORTED_REFS_URL)?
|
||||
.json::<Response>()?
|
||||
.data
|
||||
.result
|
||||
.iter()
|
||||
.filter(|res| res.metric.current == "1")
|
||||
.map(|res| res.metric.channel.clone())
|
||||
.collect();
|
||||
|
||||
Ok(officially_supported)
|
||||
}
|
Loading…
Reference in New Issue
Block a user