Skip to content

Commit c8b90d2

Browse files
committed
doc(aggregator-client): add missing doc
1 parent 50c9473 commit c8b90d2

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

internal/mithril-aggregator-client/src/client.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::query::{AggregatorQuery, QueryContext, QueryMethod};
1414

1515
const API_VERSION_MISMATCH_WARNING_MESSAGE: &str = "OpenAPI version may be incompatible, please update Mithril client library to the latest version.";
1616

17+
/// A client to send HTTP requests to a Mithril Aggregator
1718
pub struct AggregatorClient {
1819
pub(super) aggregator_endpoint: Url,
1920
pub(super) api_version_provider: APIVersionProvider,
@@ -30,6 +31,7 @@ impl AggregatorClient {
3031
AggregatorClientBuilder::new(aggregator_url)
3132
}
3233

34+
/// Send the given query to the Mithril Aggregator
3335
pub async fn send<Q: AggregatorQuery>(&self, query: Q) -> AggregatorClientResult<Q::Response> {
3436
// Todo: error handling ? Reuse the version in `warn_if_api_version_mismatch` ?
3537
let current_api_version = self.api_version_provider.compute_current_version().unwrap();

internal/mithril-aggregator-client/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ pub use error::AggregatorClientError;
1616
pub(crate) const JSON_CONTENT_TYPE: reqwest::header::HeaderValue =
1717
reqwest::header::HeaderValue::from_static("application/json");
1818

19+
/// Aggregator-client result type
1920
pub type AggregatorClientResult<T> = Result<T, error::AggregatorClientError>;

internal/mithril-aggregator-client/src/query/certificate/get_certificate_details.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ use crate::AggregatorClientResult;
88
use crate::error::AggregatorClientError;
99
use crate::query::{AggregatorQuery, QueryContext, QueryMethod};
1010

11+
/// Get the details of a certificate
1112
pub struct CertificateDetailsQuery {
1213
hash: String,
1314
}
1415

1516
impl CertificateDetailsQuery {
16-
pub fn new(hash: String) -> Self {
17+
/// Instantiate a query to get a certificate by hash
18+
pub fn by_hash(hash: String) -> Self {
1719
Self { hash }
1820
}
1921
}

internal/mithril-aggregator-client/src/query/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! Provides queries to retrieve or send data to a Mithril aggregator
2+
//!
3+
//! Available queries
4+
//! - Certificate: Get by hash
5+
//!
16
mod api;
27
mod certificate;
38

0 commit comments

Comments
 (0)