pub struct Service { /* private fields */ }Expand description
A versioned TEA API base.
Paths are OpenAPI paths appended to {rootUrl}/v{advertised-version}/.
Implementations§
Source§impl Service
impl Service
Sourcepub async fn download_format_to_writer<W>(
&self,
artifact: &Artifact,
media_type: &str,
writer: &mut W,
) -> Result<StreamedDownload, ClientError>
pub async fn download_format_to_writer<W>( &self, artifact: &Artifact, media_type: &str, writer: &mut W, ) -> Result<StreamedDownload, ClientError>
Stream one format of an artifact revision into writer.
Experimental. The writer receives bytes before the checksum
comparison is possible. Use it only if you can discard them on error;
prefer Service::download_format_to_file. The writer is flushed on
success.
Like Service::download_format, an external url is fetched without
the TEA access token.
§Errors
As Service::download_format, plus ClientError::Io when the
writer fails. ClientError::Integrity is returned after the bytes
were written.
Sourcepub async fn download_format_to_file(
&self,
artifact: &Artifact,
media_type: &str,
dest: &Path,
options: &FileDownloadOptions,
) -> Result<FileDownload, ClientError>
pub async fn download_format_to_file( &self, artifact: &Artifact, media_type: &str, dest: &Path, options: &FileDownloadOptions, ) -> Result<FileDownload, ClientError>
Stream one format of an artifact revision into a file.
Experimental. The file at dest appears only after the stream ended
cleanly and the checksums passed the client’s policy; see the module
documentation. dest’s parent directory must exist.
A NotDeclared integrity outcome is committed, as in
Service::download_format; inspect
StreamedDownload::integrity when that matters.
§Errors
As Service::download_format_to_writer; also ClientError::Io
when dest exists and overwrite is not set, is a symbolic link, or
cannot be created.
Sourcepub async fn download_artifact_to_file(
&self,
id: ArtifactId,
version: u64,
media_type: Option<&str>,
checksums: &[Checksum],
dest: &Path,
options: &FileDownloadOptions,
) -> Result<FileDownload, ClientError>
pub async fn download_artifact_to_file( &self, id: ArtifactId, version: u64, media_type: Option<&str>, checksums: &[Checksum], dest: &Path, options: &FileDownloadOptions, ) -> Result<FileDownload, ClientError>
Stream GET /artifact/{uuid}/{version}/download into a file.
Experimental. checksums are the ones declared for the selected
format; with none, the outcome is NotDeclared.
§Errors
Sourcepub async fn download_latest_artifact_to_file(
&self,
id: ArtifactId,
media_type: Option<&str>,
checksums: &[Checksum],
dest: &Path,
options: &FileDownloadOptions,
) -> Result<FileDownload, ClientError>
pub async fn download_latest_artifact_to_file( &self, id: ArtifactId, media_type: Option<&str>, checksums: &[Checksum], dest: &Path, options: &FileDownloadOptions, ) -> Result<FileDownload, ClientError>
Stream GET /artifact/{uuid}/latest/download into a file.
Experimental. See Service::download_artifact_to_file.
§Errors
Source§impl Service
impl Service
Sourcepub fn api_version(&self) -> &str
pub fn api_version(&self) -> &str
Advertised version string used in the path.
Sourcepub async fn discover_identifier(
&self,
tei: Option<&str>,
purl: Option<&str>,
) -> Result<Vec<DiscoveryInfo>, ClientError>
pub async fn discover_identifier( &self, tei: Option<&str>, purl: Option<&str>, ) -> Result<Vec<DiscoveryInfo>, ClientError>
Resolve a TEI or PURL on this already-known API base.
Exactly one of the arguments must be set.
§Errors
Returns ClientError::Unresolved for a TEA 404, which does not mean failover.
Sourcepub async fn discover_purl(
&self,
purl: &Purl,
) -> Result<Vec<ResolvedRelease>, ClientError>
pub async fn discover_purl( &self, purl: &Purl, ) -> Result<Vec<ResolvedRelease>, ClientError>
Resolve a Package URL on this already-known API base, and choose the
server and version to call next for each release, as
Client::discover does for a TEI.
A PURL names no server, so there is no .well-known step: the base is
the caller’s. The PURL is sent exactly as it was parsed
(Purl::as_str), never in canonical form,
since the server matches the identifiers it stores.
§Errors
Returns ClientError::Unresolved for a TEA 404 (not evidence that
no release exists), and an error when a release has no server with a
supported version.
Sourcepub async fn query_products(
&self,
query: &ListParams<ProductSort>,
) -> Result<Page<Product>, ClientError>
pub async fn query_products( &self, query: &ListParams<ProductSort>, ) -> Result<Page<Product>, ClientError>
Sourcepub async fn get_product(&self, id: ProductId) -> Result<Product, ClientError>
pub async fn get_product(&self, id: ProductId) -> Result<Product, ClientError>
GET /product/{uuid}.
Sourcepub async fn list_product_releases(
&self,
id: ProductId,
query: &ListParams<ReleaseSort>,
) -> Result<Page<ProductRelease>, ClientError>
pub async fn list_product_releases( &self, id: ProductId, query: &ListParams<ReleaseSort>, ) -> Result<Page<ProductRelease>, ClientError>
GET /product/{uuid}/releases.
Sourcepub async fn get_product_cle(
&self,
id: ProductId,
) -> Result<CleFetch, ClientError>
pub async fn get_product_cle( &self, id: ProductId, ) -> Result<CleFetch, ClientError>
GET /product/{uuid}/cle.
Sourcepub async fn query_product_releases(
&self,
query: &ListParams<ReleaseSort>,
) -> Result<Page<ProductRelease>, ClientError>
pub async fn query_product_releases( &self, query: &ListParams<ReleaseSort>, ) -> Result<Page<ProductRelease>, ClientError>
GET /productReleases.
Sourcepub async fn get_product_release(
&self,
id: ProductReleaseId,
) -> Result<ProductReleaseWithCollection, ClientError>
pub async fn get_product_release( &self, id: ProductReleaseId, ) -> Result<ProductReleaseWithCollection, ClientError>
GET /productRelease/{uuid}.
Sourcepub async fn get_product_release_cle(
&self,
id: ProductReleaseId,
) -> Result<CleFetch, ClientError>
pub async fn get_product_release_cle( &self, id: ProductReleaseId, ) -> Result<CleFetch, ClientError>
GET /productRelease/{uuid}/cle.
Sourcepub async fn list_product_release_collections(
&self,
id: ProductReleaseId,
query: &ListParams<CollectionSort>,
) -> Result<Page<Collection>, ClientError>
pub async fn list_product_release_collections( &self, id: ProductReleaseId, query: &ListParams<CollectionSort>, ) -> Result<Page<Collection>, ClientError>
GET /productRelease/{uuid}/collections.
Sourcepub async fn get_latest_product_release_collection(
&self,
id: ProductReleaseId,
) -> Result<Collection, ClientError>
pub async fn get_latest_product_release_collection( &self, id: ProductReleaseId, ) -> Result<Collection, ClientError>
GET /productRelease/{uuid}/collection/latest.
Sourcepub async fn get_product_release_collection(
&self,
id: ProductReleaseId,
version: u64,
) -> Result<Collection, ClientError>
pub async fn get_product_release_collection( &self, id: ProductReleaseId, version: u64, ) -> Result<Collection, ClientError>
GET /productRelease/{uuid}/collection/{version}.
Sourcepub async fn query_components(
&self,
query: &ListParams<ComponentSort>,
) -> Result<Page<Component>, ClientError>
pub async fn query_components( &self, query: &ListParams<ComponentSort>, ) -> Result<Page<Component>, ClientError>
GET /components.
Sourcepub async fn get_component(
&self,
id: ComponentId,
) -> Result<Component, ClientError>
pub async fn get_component( &self, id: ComponentId, ) -> Result<Component, ClientError>
GET /component/{uuid}.
Sourcepub async fn list_component_releases(
&self,
id: ComponentId,
query: &ListParams<ReleaseSort>,
) -> Result<Page<ComponentRelease>, ClientError>
pub async fn list_component_releases( &self, id: ComponentId, query: &ListParams<ReleaseSort>, ) -> Result<Page<ComponentRelease>, ClientError>
GET /component/{uuid}/releases.
Sourcepub async fn get_component_cle(
&self,
id: ComponentId,
) -> Result<CleFetch, ClientError>
pub async fn get_component_cle( &self, id: ComponentId, ) -> Result<CleFetch, ClientError>
GET /component/{uuid}/cle.
Sourcepub async fn query_component_releases(
&self,
query: &ListParams<ReleaseSort>,
) -> Result<Page<ComponentRelease>, ClientError>
pub async fn query_component_releases( &self, query: &ListParams<ReleaseSort>, ) -> Result<Page<ComponentRelease>, ClientError>
GET /componentReleases.
Sourcepub async fn get_component_release(
&self,
id: ComponentReleaseId,
) -> Result<ComponentReleaseWithCollection, ClientError>
pub async fn get_component_release( &self, id: ComponentReleaseId, ) -> Result<ComponentReleaseWithCollection, ClientError>
GET /componentRelease/{uuid}.
Sourcepub async fn get_component_release_cle(
&self,
id: ComponentReleaseId,
) -> Result<CleFetch, ClientError>
pub async fn get_component_release_cle( &self, id: ComponentReleaseId, ) -> Result<CleFetch, ClientError>
GET /componentRelease/{uuid}/cle.
Sourcepub async fn list_component_release_collections(
&self,
id: ComponentReleaseId,
query: &ListParams<CollectionSort>,
) -> Result<Page<Collection>, ClientError>
pub async fn list_component_release_collections( &self, id: ComponentReleaseId, query: &ListParams<CollectionSort>, ) -> Result<Page<Collection>, ClientError>
GET /componentRelease/{uuid}/collections.
Sourcepub async fn get_latest_component_release_collection(
&self,
id: ComponentReleaseId,
) -> Result<Collection, ClientError>
pub async fn get_latest_component_release_collection( &self, id: ComponentReleaseId, ) -> Result<Collection, ClientError>
GET /componentRelease/{uuid}/collection/latest.
Sourcepub async fn get_component_release_collection(
&self,
id: ComponentReleaseId,
version: u64,
) -> Result<Collection, ClientError>
pub async fn get_component_release_collection( &self, id: ComponentReleaseId, version: u64, ) -> Result<Collection, ClientError>
GET /componentRelease/{uuid}/collection/{version}.
Sourcepub async fn get_latest_artifact(
&self,
id: ArtifactId,
) -> Result<Artifact, ClientError>
pub async fn get_latest_artifact( &self, id: ArtifactId, ) -> Result<Artifact, ClientError>
GET /artifact/{uuid}/latest.
Sourcepub async fn get_artifact(
&self,
id: ArtifactId,
version: u64,
) -> Result<Artifact, ClientError>
pub async fn get_artifact( &self, id: ArtifactId, version: u64, ) -> Result<Artifact, ClientError>
GET /artifact/{uuid}/{version}.
Sourcepub async fn download_format(
&self,
artifact: &Artifact,
media_type: &str,
if_none_match: Option<&str>,
) -> Result<ArtifactFetch, ClientError>
pub async fn download_format( &self, artifact: &Artifact, media_type: &str, if_none_match: Option<&str>, ) -> Result<ArtifactFetch, ClientError>
Download one format of an artifact revision.
When the format has url, that external URL is fetched and the TEA
access token is not sent. Otherwise the versioned download endpoint is
used. Declared checksums are checked over the bytes left after HTTP
content coding is removed (integrity of decoded bytes, not authenticity).
Sourcepub async fn download_latest_artifact(
&self,
id: ArtifactId,
media_type: Option<&str>,
checksums: &[Checksum],
if_none_match: Option<&str>,
) -> Result<ArtifactFetch, ClientError>
pub async fn download_latest_artifact( &self, id: ArtifactId, media_type: Option<&str>, checksums: &[Checksum], if_none_match: Option<&str>, ) -> Result<ArtifactFetch, ClientError>
GET /artifact/{uuid}/latest/download.
Sourcepub async fn download_artifact(
&self,
id: ArtifactId,
version: u64,
media_type: Option<&str>,
checksums: &[Checksum],
if_none_match: Option<&str>,
) -> Result<ArtifactFetch, ClientError>
pub async fn download_artifact( &self, id: ArtifactId, version: u64, media_type: Option<&str>, checksums: &[Checksum], if_none_match: Option<&str>, ) -> Result<ArtifactFetch, ClientError>
GET /artifact/{uuid}/{version}/download.
Sourcepub async fn download_signature_for_format(
&self,
artifact: &Artifact,
media_type: &str,
if_none_match: Option<&str>,
) -> Result<SignatureFetch, ClientError>
pub async fn download_signature_for_format( &self, artifact: &Artifact, media_type: &str, if_none_match: Option<&str>, ) -> Result<SignatureFetch, ClientError>
Download a detached signature for one content format.
media_type selects the artifact format, not the signature’s own media type.
An external signatureUrl is fetched without a TEA access token.
Sourcepub async fn download_signature(
&self,
id: ArtifactId,
version: u64,
media_type: Option<&str>,
if_none_match: Option<&str>,
) -> Result<SignatureFetch, ClientError>
pub async fn download_signature( &self, id: ArtifactId, version: u64, media_type: Option<&str>, if_none_match: Option<&str>, ) -> Result<SignatureFetch, ClientError>
GET /artifact/{uuid}/{version}/signature/download.
Sourcepub async fn download_latest_signature(
&self,
id: ArtifactId,
media_type: Option<&str>,
if_none_match: Option<&str>,
) -> Result<SignatureFetch, ClientError>
pub async fn download_latest_signature( &self, id: ArtifactId, media_type: Option<&str>, if_none_match: Option<&str>, ) -> Result<SignatureFetch, ClientError>
GET /artifact/{uuid}/latest/signature/download.
Sourcepub async fn head_artifact(
&self,
id: ArtifactId,
version: u64,
media_type: Option<&str>,
) -> Result<HashMap<String, String>, ClientError>
pub async fn head_artifact( &self, id: ArtifactId, version: u64, media_type: Option<&str>, ) -> Result<HashMap<String, String>, ClientError>
HEAD the versioned artifact download and return the response headers without a body.