pub struct CustomersApi { /* private fields */ }
Expand description
Create and manage [Customer] profiles and sync CRM systems with Square.
Implementations§
Source§impl CustomersApi
impl CustomersApi
pub fn new(config: Configuration, client: HttpClient) -> Self
Sourcepub async fn create_customer(
&self,
body: &CreateCustomerRequest,
) -> Result<CreateCustomerResponse, ApiError>
pub async fn create_customer( &self, body: &CreateCustomerRequest, ) -> Result<CreateCustomerResponse, ApiError>
Creates a new [Customer] for a business.
You must provide at least one of the following values in your request to this endpoint:
given_name
family_name
company_name
email_address
phone_number
Sourcepub async fn retrieve_customer(
&self,
customer_id: &str,
) -> Result<RetrieveCustomerResponse, ApiError>
pub async fn retrieve_customer( &self, customer_id: &str, ) -> Result<RetrieveCustomerResponse, ApiError>
Returns details for a single [Customer].
Sourcepub async fn delete_customer(
&self,
customer_id: &str,
) -> Result<DeleteCustomerResponse, ApiError>
pub async fn delete_customer( &self, customer_id: &str, ) -> Result<DeleteCustomerResponse, ApiError>
Deletes a [Customer] profile from a business.
This operation also unlinks any associated cards on file.
As a best practice, you should include the version field in the request to enable optimistic concurrency control. The value must be set to the current version of the customer profile.
To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
Sourcepub async fn search_customers(
&self,
body: &SearchCustomersRequest,
) -> Result<SearchCustomersResponse, ApiError>
pub async fn search_customers( &self, body: &SearchCustomersRequest, ) -> Result<SearchCustomersResponse, ApiError>
Searches the [Customer] profiles associated with a Square account using a supported query filter.
Calling SearchCustomers
without any explicit query filter returns all customer profiles
ordered alphabetically based on given_name
and family_name
.
Under normal operating conditions, newly created or updated customer profiles become available for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated profiles can take closer to one minute or longer, especially during network incidents and outages.
Sourcepub async fn list_customers(
&self,
params: &ListCustomersParameters,
) -> Result<ListCustomersResponse, ApiError>
pub async fn list_customers( &self, params: &ListCustomersParameters, ) -> Result<ListCustomersResponse, ApiError>
Lists [Customer] profiles associated with a Square account.
Under normal operating conditions, newly created or updated customer profiles become available for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated profiles can take closer to one minute or longer, especially during network incidents and outages.
Sourcepub async fn update_customer(
&self,
customer_id: &str,
body: &UpdateCustomerRequest,
) -> Result<UpdateCustomerResponse, ApiError>
pub async fn update_customer( &self, customer_id: &str, body: &UpdateCustomerRequest, ) -> Result<UpdateCustomerResponse, ApiError>
Updates a [Customer] profile.
To change an attribute, specify the new value. To remove an attribute, specify the value as an empty string or empty object.
As a best practice, you should include the version
field in the request to enable
optimistic
concurrency
control. The value must be set to the current version of the customer profile.
To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.
You cannot use this endpoint to change cards on file. To make changes, use the Cards API or Gift Cards API.