pub struct Contacts { /* private fields */ }Expand description
Contacts API resource - scoped to a specific contact list
All contact operations are performed within the context of a specific list.
Get a contacts instance by calling client.contacts(list_id).
§Example
use mailbreeze::MailBreeze;
#[tokio::main]
async fn main() -> mailbreeze::Result<()> {
let client = MailBreeze::new("your_api_key")?;
// Get contacts for a specific list
let contacts = client.contacts("list_123");
// Create a contact in this list
let contact = contacts.create(&mailbreeze::CreateContactParams {
email: "user@example.com".to_string(),
first_name: Some("John".to_string()),
..Default::default()
}).await?;
// List contacts in this list
let list = contacts.list(&Default::default()).await?;
Ok(())
}Implementations§
Source§impl Contacts
impl Contacts
pub fn new(client: HttpClient, list_id: impl Into<String>) -> Self
Sourcepub async fn create(&self, params: &CreateContactParams) -> Result<Contact>
pub async fn create(&self, params: &CreateContactParams) -> Result<Contact>
Create a new contact in the list
Sourcepub async fn update(
&self,
id: &str,
params: &UpdateContactParams,
) -> Result<Contact>
pub async fn update( &self, id: &str, params: &UpdateContactParams, ) -> Result<Contact>
Update a contact
Sourcepub async fn list(
&self,
params: &ListContactsParams,
) -> Result<ContactsResponse>
pub async fn list( &self, params: &ListContactsParams, ) -> Result<ContactsResponse>
List contacts in the list with optional filters
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Contacts
impl !RefUnwindSafe for Contacts
impl Send for Contacts
impl Sync for Contacts
impl Unpin for Contacts
impl !UnwindSafe for Contacts
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