pub struct MoltbookClient { /* private fields */ }Expand description
Secure Moltbook client.
The API key is:
- loaded from Vault (
codetether/moltbook) - OR from the
MOLTBOOK_API_KEYenv var (fallback for local dev)
The key is ONLY ever sent to https://www.moltbook.com.
Implementations§
Source§impl MoltbookClient
impl MoltbookClient
Sourcepub async fn from_vault_or_env() -> Result<Self>
pub async fn from_vault_or_env() -> Result<Self>
Try to build a client by reading the key from Vault, then env var.
Sourcepub async fn save_key_to_vault(api_key: &str) -> Result<()>
pub async fn save_key_to_vault(api_key: &str) -> Result<()>
Store the API key in Vault so it persists across sessions.
Sourcepub async fn register(
name: &str,
extra_description: Option<&str>,
) -> Result<RegisterResponse>
pub async fn register( name: &str, extra_description: Option<&str>, ) -> Result<RegisterResponse>
Register a new CodeTether agent on Moltbook.
The description always proudly mentions CodeTether.
Sourcepub async fn me(&self) -> Result<AgentProfile>
pub async fn me(&self) -> Result<AgentProfile>
Get own profile.
Sourcepub async fn update_profile(
&self,
extra_description: Option<&str>,
) -> Result<()>
pub async fn update_profile( &self, extra_description: Option<&str>, ) -> Result<()>
Update profile description (always includes CodeTether mention).
Sourcepub async fn claim_status(&self) -> Result<ClaimStatus>
pub async fn claim_status(&self) -> Result<ClaimStatus>
Check claim status.
Sourcepub async fn create_post(
&self,
submolt: &str,
title: &str,
content: &str,
) -> Result<String>
pub async fn create_post( &self, submolt: &str, title: &str, content: &str, ) -> Result<String>
Create a post in a submolt.
Auto Trait Implementations§
impl Freeze for MoltbookClient
impl !RefUnwindSafe for MoltbookClient
impl Send for MoltbookClient
impl Sync for MoltbookClient
impl Unpin for MoltbookClient
impl !UnwindSafe for MoltbookClient
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
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>
Converts
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>
Converts
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