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 well_known_config(
&self,
) -> Result<Option<RegistryUrl>, ClientError>
pub async fn well_known_config( &self, ) -> Result<Option<RegistryUrl>, ClientError>
Gets the .well-known
configuration registry URL.
Sourcepub async fn latest_checkpoint(
&self,
registry_domain: Option<&RegistryDomain>,
) -> Result<SerdeEnvelope<TimestampedCheckpoint>, ClientError>
pub async fn latest_checkpoint( &self, registry_domain: Option<&RegistryDomain>, ) -> Result<SerdeEnvelope<TimestampedCheckpoint>, ClientError>
Gets the latest checkpoint from the registry.
Sourcepub async fn verify_checkpoint(
&self,
registry_domain: Option<&RegistryDomain>,
request: SerdeEnvelope<TimestampedCheckpoint>,
) -> Result<CheckpointVerificationResponse, ClientError>
pub async fn verify_checkpoint( &self, registry_domain: Option<&RegistryDomain>, request: SerdeEnvelope<TimestampedCheckpoint>, ) -> Result<CheckpointVerificationResponse, ClientError>
Verify checkpoint of the registry.
Sourcepub async fn fetch_logs(
&self,
registry_domain: Option<&RegistryDomain>,
request: FetchLogsRequest<'_>,
) -> Result<FetchLogsResponse, ClientError>
pub async fn fetch_logs( &self, registry_domain: Option<&RegistryDomain>, request: FetchLogsRequest<'_>, ) -> Result<FetchLogsResponse, ClientError>
Fetches package log entries from the registry.
Sourcepub async fn fetch_package_names(
&self,
registry_domain: Option<&RegistryDomain>,
request: FetchPackageNamesRequest<'_>,
) -> Result<FetchPackageNamesResponse, ClientError>
pub async fn fetch_package_names( &self, registry_domain: Option<&RegistryDomain>, request: FetchPackageNamesRequest<'_>, ) -> Result<FetchPackageNamesResponse, ClientError>
Fetches package names from the registry.
Sourcepub async fn ledger_sources(
&self,
registry_domain: Option<&RegistryDomain>,
) -> Result<LedgerSourcesResponse, ClientError>
pub async fn ledger_sources( &self, registry_domain: Option<&RegistryDomain>, ) -> Result<LedgerSourcesResponse, ClientError>
Gets ledger sources from the registry.
Sourcepub async fn publish_package_record(
&self,
registry_domain: Option<&RegistryDomain>,
log_id: &LogId,
request: PublishRecordRequest<'_>,
) -> Result<PackageRecord, ClientError>
pub async fn publish_package_record( &self, registry_domain: Option<&RegistryDomain>, log_id: &LogId, request: PublishRecordRequest<'_>, ) -> Result<PackageRecord, ClientError>
Publish a new record to a package log.
Sourcepub async fn get_package_record(
&self,
registry_domain: Option<&RegistryDomain>,
log_id: &LogId,
record_id: &RecordId,
) -> Result<PackageRecord, ClientError>
pub async fn get_package_record( &self, registry_domain: Option<&RegistryDomain>, log_id: &LogId, record_id: &RecordId, ) -> Result<PackageRecord, ClientError>
Gets a package record from the registry.
Sourcepub async fn content_sources(
&self,
registry_domain: Option<&RegistryDomain>,
digest: &AnyHash,
) -> Result<ContentSourcesResponse, ClientError>
pub async fn content_sources( &self, registry_domain: Option<&RegistryDomain>, digest: &AnyHash, ) -> Result<ContentSourcesResponse, ClientError>
Gets a content sources from the registry.
Sourcepub async fn download_content(
&self,
registry_domain: Option<&RegistryDomain>,
digest: &AnyHash,
) -> Result<impl Stream<Item = Result<Bytes>>, ClientError>
pub async fn download_content( &self, registry_domain: Option<&RegistryDomain>, 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 async fn prove_inclusion(
&self,
registry_domain: Option<&RegistryDomain>,
request: InclusionRequest,
checkpoint: &Checkpoint,
leafs: &[LogLeaf],
) -> Result<(), ClientError>
pub async fn prove_inclusion( &self, registry_domain: Option<&RegistryDomain>, 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,
registry_domain: Option<&RegistryDomain>,
request: ConsistencyRequest,
from_log_root: Cow<'_, AnyHash>,
to_log_root: Cow<'_, AnyHash>,
) -> Result<(), ClientError>
pub async fn prove_log_consistency( &self, registry_domain: Option<&RegistryDomain>, request: ConsistencyRequest, from_log_root: Cow<'_, AnyHash>, to_log_root: Cow<'_, AnyHash>, ) -> Result<(), ClientError>
Proves consistency between two log roots.
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more