pub struct RegistryClient { /* private fields */ }Expand description
A minimal client over the registry REST surface.
Implementations§
Source§impl RegistryClient
impl RegistryClient
Sourcepub fn new(base: impl Into<String>) -> Self
pub fn new(base: impl Into<String>) -> Self
Build a client against base (e.g. http://localhost:18080).
Sourcepub fn with_token(self, token: impl Into<String>) -> Self
pub fn with_token(self, token: impl Into<String>) -> Self
Attach a bearer token used for authenticated (publish/unpublish) calls.
Sourcepub async fn search(
&self,
query: Option<&str>,
artifact_type: Option<&str>,
ecosystem: Option<&str>,
) -> Result<Vec<ArtifactSummary>>
pub async fn search( &self, query: Option<&str>, artifact_type: Option<&str>, ecosystem: Option<&str>, ) -> Result<Vec<ArtifactSummary>>
GET /api/v1/artifacts with optional filters.
Sourcepub async fn info(&self, namespace: &str, slug: &str) -> Result<Value>
pub async fn info(&self, namespace: &str, slug: &str) -> Result<Value>
GET /api/v1/artifacts/{ns}/{slug} detail.
Sourcepub async fn manifest(
&self,
namespace: &str,
slug: &str,
target: &str,
) -> Result<Manifest>
pub async fn manifest( &self, namespace: &str, slug: &str, target: &str, ) -> Result<Manifest>
GET …/install-manifest?target=….
Sourcepub async fn fetch_file(&self, url: &str) -> Result<Vec<u8>>
pub async fn fetch_file(&self, url: &str) -> Result<Vec<u8>>
Download a file’s bytes from its (possibly external) source URL.
Deliberately not routed through [ensure_ok]: a failure here belongs to
the artifact’s source host, and reporting it as registry API {status}
pointed whoever was debugging an install at the wrong system.
Sourcepub async fn publish(&self, body: &PublishReq) -> Result<Value>
pub async fn publish(&self, body: &PublishReq) -> Result<Value>
POST /api/v1/artifacts with the bearer token, returning the created
artifact JSON.
Auto Trait Implementations§
impl !RefUnwindSafe for RegistryClient
impl !UnwindSafe for RegistryClient
impl Freeze for RegistryClient
impl Send for RegistryClient
impl Sync for RegistryClient
impl Unpin for RegistryClient
impl UnsafeUnpin for RegistryClient
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