use graphql_client::GraphQLQuery;
type DateTime = chrono::DateTime<chrono::Utc>;
#[derive(GraphQLQuery, Debug, Copy, Clone)]
#[graphql(
schema_path = "graphql/schema.json",
query_path = "graphql/queries/health.graphql",
response_derives = "Debug"
)]
pub struct HealthQuery;
#[derive(GraphQLQuery, Debug, Copy, Clone)]
#[graphql(
schema_path = "graphql/schema.json",
query_path = "graphql/subscriptions/heartbeat.graphql",
response_derives = "Debug"
)]
pub struct HeartbeatSubscription;
pub trait HealthQueryExt {
async fn health_query(&self) -> crate::QueryResult<HealthQuery>;
}
impl HealthQueryExt for crate::Client {
async fn health_query(&self) -> crate::QueryResult<HealthQuery> {
self.query::<HealthQuery>(&HealthQuery::build_query(health_query::Variables))
.await
}
}
pub trait HealthSubscriptionExt {
fn heartbeat_subscription(
&self,
interval: i64,
) -> crate::BoxedSubscription<HeartbeatSubscription>;
}
impl HealthSubscriptionExt for crate::SubscriptionClient {
fn heartbeat_subscription(
&self,
interval: i64,
) -> crate::BoxedSubscription<HeartbeatSubscription> {
let request_body =
HeartbeatSubscription::build_query(heartbeat_subscription::Variables { interval });
self.start::<HeartbeatSubscription>(&request_body)
}
}