pub struct AccountStore { /* private fields */ }Expand description
Top-level account store coordinating metadata and secrets.
Implementations§
Source§impl AccountStore
impl AccountStore
Sourcepub fn new(paths: ConfigPaths) -> Result<Self, AccountStoreError>
pub fn new(paths: ConfigPaths) -> Result<Self, AccountStoreError>
Initialise an account store for the provided configuration paths.
Sourcepub fn add_account(
&self,
alias: &str,
api_key: &str,
profile: AccountProfile,
) -> Result<(), AccountStoreError>
pub fn add_account( &self, alias: &str, api_key: &str, profile: AccountProfile, ) -> Result<(), AccountStoreError>
Add or update an account entry and store its API key.
Sourcepub fn get_account(
&self,
alias: &str,
) -> Result<AccountRecord, AccountStoreError>
pub fn get_account( &self, alias: &str, ) -> Result<AccountRecord, AccountStoreError>
Retrieve metadata and API key for a given alias.
Sourcepub fn list_accounts(&self) -> Result<Vec<AccountSummary>, AccountStoreError>
pub fn list_accounts(&self) -> Result<Vec<AccountSummary>, AccountStoreError>
Enumerate stored accounts.
Sourcepub fn default_alias(&self) -> Result<Option<String>, AccountStoreError>
pub fn default_alias(&self) -> Result<Option<String>, AccountStoreError>
Retrieve the configured default account alias, if any.
Sourcepub fn set_default(&self, alias: &str) -> Result<(), AccountStoreError>
pub fn set_default(&self, alias: &str) -> Result<(), AccountStoreError>
Update default account alias.
Sourcepub fn set_daily_budget(
&self,
alias: &str,
budget: Option<NonZeroU32>,
) -> Result<(), AccountStoreError>
pub fn set_daily_budget( &self, alias: &str, budget: Option<NonZeroU32>, ) -> Result<(), AccountStoreError>
Set or clear the daily budget for an account.
Sourcepub fn remove_account(&self, alias: &str) -> Result<(), AccountStoreError>
pub fn remove_account(&self, alias: &str) -> Result<(), AccountStoreError>
Remove an account and associated secret.
Sourcepub fn export_accounts(&self) -> Result<Vec<AccountExport>, AccountStoreError>
pub fn export_accounts(&self) -> Result<Vec<AccountExport>, AccountStoreError>
Export account metadata without secrets.
Trait Implementations§
Source§impl Clone for AccountStore
impl Clone for AccountStore
Source§fn clone(&self) -> AccountStore
fn clone(&self) -> AccountStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AccountStore
impl RefUnwindSafe for AccountStore
impl Send for AccountStore
impl Sync for AccountStore
impl Unpin for AccountStore
impl UnwindSafe for AccountStore
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