Struct warg_client::api::Client
source · pub struct Client { /* private fields */ }Expand description
Represents a Warg API client for communicating with a Warg registry server.
Implementations§
source§impl Client
impl Client
sourcepub fn new(
url: impl IntoUrl,
auth_token: Option<Secret<String>>
) -> Result<Self>
pub fn new( url: impl IntoUrl, auth_token: Option<Secret<String>> ) -> Result<Self>
Creates a new API client with the given URL.
sourcepub fn auth_token(&self) -> &Option<Secret<String>>
pub fn auth_token(&self) -> &Option<Secret<String>>
Gets auth token
sourcepub fn url(&self) -> &RegistryUrl
pub fn url(&self) -> &RegistryUrl
Gets the URL of the API client.
sourcepub async fn latest_checkpoint(
&self
) -> Result<SerdeEnvelope<TimestampedCheckpoint>, ClientError>
pub async fn latest_checkpoint( &self ) -> Result<SerdeEnvelope<TimestampedCheckpoint>, ClientError>
Gets the latest checkpoint from the registry.
sourcepub async fn latest_checkpoints(
&self,
registries: impl Iterator<Item = &String>
) -> Result<IndexMap<String, SerdeEnvelope<TimestampedCheckpoint>>>
pub async fn latest_checkpoints( &self, registries: impl Iterator<Item = &String> ) -> Result<IndexMap<String, SerdeEnvelope<TimestampedCheckpoint>>>
Gets the latest checkpoints from registries.
sourcepub async fn verify_checkpoint(
&self,
request: SerdeEnvelope<TimestampedCheckpoint>
) -> Result<CheckpointVerificationResponse, ClientError>
pub async fn verify_checkpoint( &self, request: SerdeEnvelope<TimestampedCheckpoint> ) -> Result<CheckpointVerificationResponse, ClientError>
Verify checkpoint of the registry.
sourcepub async fn fetch_logs(
&self,
request: FetchLogsRequest<'_>
) -> Result<FetchLogsResponse, ClientError>
pub async fn fetch_logs( &self, request: FetchLogsRequest<'_> ) -> Result<FetchLogsResponse, ClientError>
Fetches package log entries from the registry.
sourcepub async fn fetch_package_names(
&self,
request: FetchPackageNamesRequest<'_>
) -> Result<FetchPackageNamesResponse, ClientError>
pub async fn fetch_package_names( &self, request: FetchPackageNamesRequest<'_> ) -> Result<FetchPackageNamesResponse, ClientError>
Fetches package names from the registry.
sourcepub async fn ledger_sources(&self) -> Result<LedgerSourcesResponse, ClientError>
pub async fn ledger_sources(&self) -> Result<LedgerSourcesResponse, ClientError>
Gets ledger sources from the registry.
sourcepub async fn publish_package_record(
&self,
log_id: &LogId,
request: PublishRecordRequest<'_>
) -> Result<PackageRecord, ClientError>
pub async fn publish_package_record( &self, log_id: &LogId, request: PublishRecordRequest<'_> ) -> Result<PackageRecord, ClientError>
Publish a new record to a package log.
sourcepub async fn get_package_record(
&self,
log_id: &LogId,
record_id: &RecordId
) -> Result<PackageRecord, ClientError>
pub async fn get_package_record( &self, log_id: &LogId, record_id: &RecordId ) -> Result<PackageRecord, ClientError>
Gets a package record from the registry.
sourcepub async fn content_sources(
&self,
digest: &AnyHash
) -> Result<ContentSourcesResponse, ClientError>
pub async fn content_sources( &self, digest: &AnyHash ) -> Result<ContentSourcesResponse, ClientError>
Gets a content sources from the registry.
sourcepub async fn download_content(
&self,
digest: &AnyHash
) -> Result<impl Stream<Item = Result<Bytes>>, ClientError>
pub async fn download_content( &self, digest: &AnyHash ) -> Result<impl Stream<Item = Result<Bytes>>, ClientError>
Downloads the content associated with a given record.
sourcepub fn set_warg_registry(&mut self, registry: Option<RegistryDomain>)
pub fn set_warg_registry(&mut self, registry: Option<RegistryDomain>)
Set warg-registry header value
sourcepub fn get_warg_registry(&self) -> &Option<RegistryDomain>
pub fn get_warg_registry(&self) -> &Option<RegistryDomain>
Get warg-registry header value
sourcepub async fn prove_inclusion(
&self,
request: InclusionRequest,
checkpoint: &Checkpoint,
leafs: &[LogLeaf]
) -> Result<(), ClientError>
pub async fn prove_inclusion( &self, request: InclusionRequest, checkpoint: &Checkpoint, leafs: &[LogLeaf] ) -> Result<(), ClientError>
Proves the inclusion of the given package log heads in the registry.
sourcepub async fn prove_log_consistency(
&self,
request: ConsistencyRequest,
from_log_root: Cow<'_, AnyHash>,
to_log_root: Cow<'_, AnyHash>
) -> Result<(), ClientError>
pub async fn prove_log_consistency( &self, request: ConsistencyRequest, from_log_root: Cow<'_, AnyHash>, to_log_root: Cow<'_, AnyHash> ) -> Result<(), ClientError>
Proves consistency between two log roots.