1 个稳定版本

1.0.0 2024年1月23日

#2057网页编程

MIT 许可证

82KB
1.5K SLoC

loops_sdk rust

这是 Loops API 的 OpenAPI 规范。

身份验证

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

检索您账户的定制联系人属性列表。

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

通过 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

将联系人添加到您的受众中。

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

通过 emailuserId 删除联系人。

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

向 Loops 发送事件以触发电子邮件。
如果提供的 email 联系人不存在,则会创建一个新的。

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

向联系人发送交易性电子邮件。

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

通过 emailuserId 更新联系人。
如果您想更新联系人的电子邮件地址,联系人首先需要一个 userId 值。然后您可以提交包含 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
    .put_contacts_update(PutContactsUpdateRequest {
        data: ContactRequest {
            email: "string".to_string(),
            ..Default::default()
        },
    });

依赖项

~4–19MB
~254K SLoC