loops_sdk

Crates.ioloops_sdk
lib.rsloops_sdk
version1.0.0
sourcesrc
created_at2024-01-23 22:48:28.34421
updated_at2024-01-23 22:48:28.34421
descriptionRust API bindings - loops_sdk
homepage
repository
max_upload_size
id1111293
size81,516
Patrick Kelly (pk8189)

documentation

README

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()
        },
    });
Commit count: 0

cargo fmt