pub struct NostrClient { /* private fields */ }Expand description
Nostr client for git operations
Implementations§
Source§impl NostrClient
impl NostrClient
Sourcepub fn new(
pubkey: &str,
secret_key: Option<String>,
url_secret: Option<[u8; 32]>,
is_private: bool,
config: &Config,
) -> Result<Self>
pub fn new( pubkey: &str, secret_key: Option<String>, url_secret: Option<[u8; 32]>, is_private: bool, config: &Config, ) -> Result<Self>
Create a new client with pubkey, optional secret key, url secret, is_private flag, and config
pub fn list_repos(&self) -> Result<Vec<String>>
pub async fn list_repos_async(&self) -> Result<Vec<String>>
Sourcepub fn fetch_refs(&mut self, repo_name: &str) -> Result<HashMap<String, String>>
pub fn fetch_refs(&mut self, repo_name: &str) -> Result<HashMap<String, String>>
Fetch refs for a repository from nostr Returns refs parsed from the hashtree at the root hash
Sourcepub fn fetch_refs_quick(
&mut self,
repo_name: &str,
) -> Result<HashMap<String, String>>
pub fn fetch_refs_quick( &mut self, repo_name: &str, ) -> Result<HashMap<String, String>>
Fetch refs with a quick timeout (3s) for push operations Returns empty if timeout - allows push to proceed
Sourcepub fn fetch_refs_with_root(
&mut self,
repo_name: &str,
) -> Result<(HashMap<String, String>, Option<String>, Option<[u8; 32]>)>
pub fn fetch_refs_with_root( &mut self, repo_name: &str, ) -> Result<(HashMap<String, String>, Option<String>, Option<[u8; 32]>)>
Fetch refs and root hash info from nostr Returns (refs, root_hash, encryption_key)
Sourcepub fn update_ref(
&mut self,
repo_name: &str,
ref_name: &str,
sha: &str,
) -> Result<()>
pub fn update_ref( &mut self, repo_name: &str, ref_name: &str, sha: &str, ) -> Result<()>
Update a ref in local cache (will be published with publish_repo)
Sourcepub fn delete_ref(&mut self, repo_name: &str, ref_name: &str) -> Result<()>
pub fn delete_ref(&mut self, repo_name: &str, ref_name: &str) -> Result<()>
Delete a ref from local cache
Sourcepub fn get_cached_root_hash(&self, repo_name: &str) -> Option<&String>
pub fn get_cached_root_hash(&self, repo_name: &str) -> Option<&String>
Get cached root hash for a repository
Sourcepub fn get_cached_encryption_key(&self, repo_name: &str) -> Option<&[u8; 32]>
pub fn get_cached_encryption_key(&self, repo_name: &str) -> Option<&[u8; 32]>
Get cached encryption key for a repository
Sourcepub fn blossom(&self) -> &BlossomClient
pub fn blossom(&self) -> &BlossomClient
Get the Blossom client for direct downloads
Sourcepub fn relay_urls(&self) -> Vec<String>
pub fn relay_urls(&self) -> Vec<String>
Get the configured relay URLs
Sourcepub fn publish_repo(
&self,
repo_name: &str,
root_hash: &str,
encryption_key: Option<(&[u8; 32], bool, bool)>,
) -> Result<(String, RelayResult)>
pub fn publish_repo( &self, repo_name: &str, root_hash: &str, encryption_key: Option<(&[u8; 32], bool, bool)>, ) -> Result<(String, RelayResult)>
Publish repository to nostr as kind 30078 event
Format:
kind: 30078
tags: [[“d”, repo_name], [“l”, “hashtree”], [“hash”, root_hash], [“key”|“encryptedKey”, encryption_key]]
content:
Sourcepub fn fetch_prs(
&self,
repo_name: &str,
state_filter: PullRequestStateFilter,
) -> Result<Vec<PullRequestListItem>>
pub fn fetch_prs( &self, repo_name: &str, state_filter: PullRequestStateFilter, ) -> Result<Vec<PullRequestListItem>>
Fetch pull requests targeting this repo, filtered by state.
pub async fn fetch_prs_async( &self, repo_name: &str, state_filter: PullRequestStateFilter, ) -> Result<Vec<PullRequestListItem>>
Sourcepub fn publish_pr_merged_status(
&self,
pr_event_id: &str,
pr_author_pubkey: &str,
) -> Result<()>
pub fn publish_pr_merged_status( &self, pr_event_id: &str, pr_author_pubkey: &str, ) -> Result<()>
Publish a kind 1631 (STATUS_APPLIED) event to mark a PR as merged
Sourcepub async fn upload_blob(&self, _hash: &str, data: &[u8]) -> Result<String>
pub async fn upload_blob(&self, _hash: &str, data: &[u8]) -> Result<String>
Upload blob to blossom server
Sourcepub async fn upload_blob_if_missing(
&self,
data: &[u8],
) -> Result<(String, bool)>
pub async fn upload_blob_if_missing( &self, data: &[u8], ) -> Result<(String, bool)>
Upload blob only if it doesn’t exist
Auto Trait Implementations§
impl !Freeze for NostrClient
impl !RefUnwindSafe for NostrClient
impl Send for NostrClient
impl Sync for NostrClient
impl Unpin for NostrClient
impl UnsafeUnpin for NostrClient
impl !UnwindSafe for NostrClient
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
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>
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>
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