Trait mutiny_core::labels::LabelStorage
source · pub trait LabelStorage {
Show 13 methods
// Required methods
fn get_address_labels(
&self
) -> Result<HashMap<String, Vec<String>>, MutinyError>;
fn get_invoice_labels(
&self
) -> Result<HashMap<Bolt11Invoice, Vec<String>>, MutinyError>;
fn get_labels(&self) -> Result<HashMap<String, LabelItem>, MutinyError>;
fn get_label(
&self,
label: impl AsRef<str>
) -> Result<Option<LabelItem>, MutinyError>;
fn set_address_labels(
&self,
address: Address,
labels: Vec<String>
) -> Result<(), MutinyError>;
fn set_invoice_labels(
&self,
invoice: Bolt11Invoice,
labels: Vec<String>
) -> Result<(), MutinyError>;
fn get_contacts(&self) -> Result<HashMap<String, Contact>, MutinyError>;
fn get_contact(
&self,
label: impl AsRef<str>
) -> Result<Option<Contact>, MutinyError>;
fn create_contact_from_label(
&self,
label: impl AsRef<str>,
contact: Contact
) -> Result<String, MutinyError>;
fn create_new_contact(
&self,
contact: Contact
) -> Result<String, MutinyError>;
fn archive_contact(&self, id: impl AsRef<str>) -> Result<(), MutinyError>;
fn edit_contact(
&self,
id: impl AsRef<str>,
contact: Contact
) -> Result<(), MutinyError>;
fn get_tag_items(&self) -> Result<Vec<TagItem>, MutinyError>;
}Required Methods§
sourcefn get_address_labels(
&self
) -> Result<HashMap<String, Vec<String>>, MutinyError>
fn get_address_labels( &self ) -> Result<HashMap<String, Vec<String>>, MutinyError>
Get a map of addresses to labels. This can be used to get all the labels for an address
sourcefn get_invoice_labels(
&self
) -> Result<HashMap<Bolt11Invoice, Vec<String>>, MutinyError>
fn get_invoice_labels( &self ) -> Result<HashMap<Bolt11Invoice, Vec<String>>, MutinyError>
Get a map of invoices to labels. This can be used to get all the labels for an invoice
sourcefn get_labels(&self) -> Result<HashMap<String, LabelItem>, MutinyError>
fn get_labels(&self) -> Result<HashMap<String, LabelItem>, MutinyError>
Get all the existing labels
sourcefn get_label(
&self,
label: impl AsRef<str>
) -> Result<Option<LabelItem>, MutinyError>
fn get_label( &self, label: impl AsRef<str> ) -> Result<Option<LabelItem>, MutinyError>
Get information about a label
sourcefn set_address_labels(
&self,
address: Address,
labels: Vec<String>
) -> Result<(), MutinyError>
fn set_address_labels( &self, address: Address, labels: Vec<String> ) -> Result<(), MutinyError>
Set the labels for an address, replacing any existing labels
If you do not want to replace any existing labels, use get_address_labels to get the existing labels,
add the new labels, and then use set_address_labels to set the new labels
sourcefn set_invoice_labels(
&self,
invoice: Bolt11Invoice,
labels: Vec<String>
) -> Result<(), MutinyError>
fn set_invoice_labels( &self, invoice: Bolt11Invoice, labels: Vec<String> ) -> Result<(), MutinyError>
Set the labels for an invoice, replacing any existing labels
If you do not want to replace any existing labels, use get_invoice_labels to get the existing labels,
add the new labels, and then use set_invoice_labels to set the new labels
sourcefn get_contacts(&self) -> Result<HashMap<String, Contact>, MutinyError>
fn get_contacts(&self) -> Result<HashMap<String, Contact>, MutinyError>
Get all the existing contacts
sourcefn get_contact(
&self,
label: impl AsRef<str>
) -> Result<Option<Contact>, MutinyError>
fn get_contact( &self, label: impl AsRef<str> ) -> Result<Option<Contact>, MutinyError>
Get a contact by label, the label should be a uuid
sourcefn create_contact_from_label(
&self,
label: impl AsRef<str>,
contact: Contact
) -> Result<String, MutinyError>
fn create_contact_from_label( &self, label: impl AsRef<str>, contact: Contact ) -> Result<String, MutinyError>
Create a new contact from an existing label and returns the new identifying label
sourcefn create_new_contact(&self, contact: Contact) -> Result<String, MutinyError>
fn create_new_contact(&self, contact: Contact) -> Result<String, MutinyError>
Create a new contact and return the identifying label
sourcefn archive_contact(&self, id: impl AsRef<str>) -> Result<(), MutinyError>
fn archive_contact(&self, id: impl AsRef<str>) -> Result<(), MutinyError>
Marks a contact as archived
sourcefn edit_contact(
&self,
id: impl AsRef<str>,
contact: Contact
) -> Result<(), MutinyError>
fn edit_contact( &self, id: impl AsRef<str>, contact: Contact ) -> Result<(), MutinyError>
Edits an existing contact and replaces the existing contact
sourcefn get_tag_items(&self) -> Result<Vec<TagItem>, MutinyError>
fn get_tag_items(&self) -> Result<Vec<TagItem>, MutinyError>
Gets all the existing tags (labels and contacts)