1 stable release
1.0.0 | Jan 23, 2024 |
---|
#456 in #sdk
82KB
1.5K
SLoC
loops_sdk rust
This is the OpenAPI Spec for the Loops API.
Authentication
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.
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
.
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.
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
.
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.
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.
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.
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()
},
});
Dependencies
~4–16MB
~225K SLoC