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