pub struct RegistryClient { /* private fields */ }Expand description
HTTP client for the LOGOS package registry API.
Provides authenticated access to registry operations including:
- Token validation
- Package publishing
§Authentication
All API calls require a Bearer token, typically obtained via largo login.
Tokens are validated against the registry’s /auth/me endpoint.
§Example
use logicaffeine_cli::project::registry::RegistryClient;
let client = RegistryClient::new(
RegistryClient::default_url(),
"tok_xxxxx"
);
// Verify the token is valid
match client.validate_token() {
Ok(user) => println!("Logged in as {}", user.login),
Err(e) => eprintln!("Auth failed: {}", e),
}Implementations§
Source§impl RegistryClient
impl RegistryClient
Sourcepub fn new(base_url: &str, token: &str) -> Self
pub fn new(base_url: &str, token: &str) -> Self
Create a new registry client with the given URL and authentication token.
§Arguments
base_url- The registry API base URL. Trailing slashes are stripped.token- Bearer token for authentication.
§Example
use logicaffeine_cli::project::registry::RegistryClient;
let client = RegistryClient::new(
"https://registry.logicaffeine.com",
"tok_xxxxx"
);Sourcepub fn default_url() -> &'static str
pub fn default_url() -> &'static str
Returns the default registry URL.
Currently returns https://registry.logicaffeine.com.
Sourcepub fn validate_token(&self) -> Result<UserInfo, RegistryError>
pub fn validate_token(&self) -> Result<UserInfo, RegistryError>
Validate the authentication token by querying the registry.
Makes a request to /auth/me to verify the token is valid and
retrieve the associated user information.
§Errors
Returns RegistryError::Unauthorized if the token is invalid or expired.
Returns RegistryError::Network for connection failures.
Sourcepub fn publish(
&self,
name: &str,
version: &str,
tarball: &[u8],
metadata: &PublishMetadata,
) -> Result<PublishResult, RegistryError>
pub fn publish( &self, name: &str, version: &str, tarball: &[u8], metadata: &PublishMetadata, ) -> Result<PublishResult, RegistryError>
Publish a package to the registry.
Uploads a package tarball with metadata to the registry’s publish endpoint. The request is sent as multipart form data.
§Arguments
name- Package name (must match manifest)version- Semantic version stringtarball- Gzipped tar archive of the packagemetadata- Package metadata for the registry index
§Errors
RegistryError::Unauthorized- Invalid or missing tokenRegistryError::VersionExists- This version already publishedRegistryError::TooLarge- Package exceeds 10MB limitRegistryError::InvalidPackage- Metadata serialization failed
Auto Trait Implementations§
impl Freeze for RegistryClient
impl RefUnwindSafe for RegistryClient
impl Send for RegistryClient
impl Sync for RegistryClient
impl Unpin for RegistryClient
impl UnsafeUnpin for RegistryClient
impl UnwindSafe 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.