# loops_sdk rust This is the OpenAPI Spec for the [Loops API](https://loops.so/docs/api). # Authentication ```rust use loops_sdk::Client; let client = Client::default().with_api_key(&std::env::var("API_TOKEN").expect("API token not defined")); ``` # get_contacts_custom_fields Retrieve a list of your account's custom contact properties. ```rust use loops_sdk::Client; let client = Client::default() .with_api_key(&std::env::var("API_TOKEN").expect("API token not defined")); let response = client.get_contacts_custom_fields(); ``` # get_contacts_find Search for a contact by `email`. ```rust use loops_sdk::Client; use loops_sdk::request_types::*; let client = Client::default() .with_api_key(&std::env::var("API_TOKEN").expect("API token not defined")); let response = client .get_contacts_find(GetContactsFindRequest { email: "string".to_string(), }); ``` # post_contacts_create Add a contact to your audience. ```rust use loops_sdk::Client; use loops_sdk::request_types::*; use loops_sdk::schemas::*; let client = Client::default() .with_api_key(&std::env::var("API_TOKEN").expect("API token not defined")); let response = client .post_contacts_create(PostContactsCreateRequest { data: ContactRequest { email: "string".to_string(), ..Default::default() }, }); ``` # post_contacts_delete Delete a contact by `email` or `userId`. ```rust use loops_sdk::Client; use loops_sdk::request_types::*; use loops_sdk::schemas::*; let client = Client::default() .with_api_key(&std::env::var("API_TOKEN").expect("API token not defined")); let response = client .post_contacts_delete(PostContactsDeleteRequest { data: ContactDeleteRequest { ..Default::default() }, }); ``` # post_events_send Send events to trigger emails in Loops.
If a contact with the provided `email` doesn't exist, one will be created. ```rust use loops_sdk::Client; use loops_sdk::request_types::*; use loops_sdk::schemas::*; let client = Client::default() .with_api_key(&std::env::var("API_TOKEN").expect("API token not defined")); let response = client .post_events_send(PostEventsSendRequest { data: EventRequest { event_name: "string".to_string(), ..Default::default() }, }); ``` # post_transactional Send a transactional email to a contact. ```rust use loops_sdk::Client; use loops_sdk::request_types::*; use loops_sdk::schemas::*; let client = Client::default() .with_api_key(&std::env::var("API_TOKEN").expect("API token not defined")); let response = client .post_transactional(PostTransactionalRequest { data: TransactionalRequest { email: "string".to_string(), transactional_id: "string".to_string(), ..Default::default() }, }); ``` # put_contacts_update Update a contact by `email` or `userId`.
If you want to update a contact’s email address, the contact will first need a `userId` value. You can then make a request containing the userId field along with an updated email address. ```rust use loops_sdk::Client; use loops_sdk::request_types::*; use loops_sdk::schemas::*; let client = Client::default() .with_api_key(&std::env::var("API_TOKEN").expect("API token not defined")); let response = client .put_contacts_update(PutContactsUpdateRequest { data: ContactRequest { email: "string".to_string(), ..Default::default() }, }); ```