pub struct Customers { /* private fields */ }Expand description
Customer operations interface.
Implementations§
Source§impl Customers
impl Customers
Sourcepub fn create(&self, input: CreateCustomer) -> Result<Customer>
pub fn create(&self, input: CreateCustomer) -> Result<Customer>
Create a new customer.
§Example
let customer = commerce.customers().create(CreateCustomer {
email: "alice@example.com".into(),
first_name: "Alice".into(),
last_name: "Smith".into(),
phone: Some("+1-555-0123".into()),
..Default::default()
})?;Sourcepub fn update(&self, id: CustomerId, input: UpdateCustomer) -> Result<Customer>
pub fn update(&self, id: CustomerId, input: UpdateCustomer) -> Result<Customer>
Update a customer.
Sourcepub fn list(&self, filter: CustomerFilter) -> Result<Vec<Customer>>
pub fn list(&self, filter: CustomerFilter) -> Result<Vec<Customer>>
List customers with optional filtering.
Sourcepub fn delete(&self, id: CustomerId) -> Result<()>
pub fn delete(&self, id: CustomerId) -> Result<()>
Delete a customer (soft delete).
Sourcepub fn add_address(
&self,
input: CreateCustomerAddress,
) -> Result<CustomerAddress>
pub fn add_address( &self, input: CreateCustomerAddress, ) -> Result<CustomerAddress>
Add an address for a customer.
Sourcepub fn get_addresses(
&self,
customer_id: CustomerId,
) -> Result<Vec<CustomerAddress>>
pub fn get_addresses( &self, customer_id: CustomerId, ) -> Result<Vec<CustomerAddress>>
Get all addresses for a customer.
Sourcepub fn update_address(
&self,
address_id: Uuid,
input: CreateCustomerAddress,
) -> Result<CustomerAddress>
pub fn update_address( &self, address_id: Uuid, input: CreateCustomerAddress, ) -> Result<CustomerAddress>
Update an address.
Sourcepub fn delete_address(&self, address_id: Uuid) -> Result<()>
pub fn delete_address(&self, address_id: Uuid) -> Result<()>
Delete an address.
Sourcepub fn set_default_address(
&self,
customer_id: CustomerId,
address_id: Uuid,
address_type: AddressType,
) -> Result<()>
pub fn set_default_address( &self, customer_id: CustomerId, address_id: Uuid, address_type: AddressType, ) -> Result<()>
Set a default address for a customer.
Sourcepub fn count(&self, filter: CustomerFilter) -> Result<u64>
pub fn count(&self, filter: CustomerFilter) -> Result<u64>
Count customers matching a filter.
Sourcepub fn find_or_create(&self, input: CreateCustomer) -> Result<Customer>
pub fn find_or_create(&self, input: CreateCustomer) -> Result<Customer>
Find or create a customer by email.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Customers
impl !UnwindSafe for Customers
impl Freeze for Customers
impl Send for Customers
impl Sync for Customers
impl Unpin for Customers
impl UnsafeUnpin for Customers
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