Skip to main content

Crate loops_so

Crate loops_so 

Source
Expand description

Unofficial Rust SDK for Loops.so, the email platform for SaaS.

Two layers:

use loops_so::{ConfigureOptions, TransactionalOptions};

// Or set the LOOPS_API_KEY environment variable.
loops_so::configure(ConfigureOptions::new().api_key("your_api_key"));
let client = loops_so::get_client()?;

let variables = client.get_transactional_variables("clfq6dinn000yl70fgwwyp82l").await?;
client
    .send_transactional_email(
        "clfq6dinn000yl70fgwwyp82l",
        "user@example.com",
        TransactionalOptions::new()
            .data_variable("firstName", "Jane")
            .data_variable("inviteLink", "https://myapp.com/invite/abc123"),
    )
    .await?;

Re-exports§

pub use responses::Contact;
pub use responses::TransactionalEmail;
pub use responses::TransactionalEmailPagination;
pub use responses::TransactionalEmailsResponse;

Modules§

generated
Code generated from the Loops OpenAPI spec. Never edit by hand: just regenerate replaces the whole directory.
responses
Hand-written response models for endpoints whose generated model is too loose to be useful.
routes
The named table of every Loops endpoint LoopsClient calls.
testing
A mock Loops API for testing code that uses this crate.

Structs§

ConfigureOptions
The settings to change in a configure call. Unset fields keep their current value.
ContactFields
Contact fields for create_contact and upsert_contact. Unset fields are left out of the request.
DeleteNodeOptions
Optional parts of delete_workflow_node.
EmailMessageUpdate
Changes for update_email_message. Unset fields are left unchanged.
EventOptions
Optional parts of send_event.
LoopsClient
High-level client for the Loops API.
LoopsClientBuilder
Builds a LoopsClient. Every setting left unset falls back to the process-wide defaults from configure.
LoopsConfig
The process-wide defaults LoopsClient falls back to.
Page
Pagination for the list endpoints.
PreviewOptions
Values used to render preview_email_message.
TransactionalOptions
Optional parts of send_transactional_email.

Enums§

ContactId
How a contact is identified: by email, by user ID, or both.
EmailFormat
How an email message renders.
LoopsError
Every way a LoopsClient call can fail.
NodePlacement
Where create_workflow_node inserts the new node.

Constants§

API_KEY_ENV_VAR
The environment variable read when no API key was configured.
DEFAULT_BASE_URL
The base URL of the Loops API. The /v1 version segment is part of each endpoint path, not of the base URL.
LOOPS_API_VERSION
The info.version of the shipped spec. just generate rewrites it together with the spec and the generated code.
OPENAPI_SPEC
The shipped OpenAPI spec, as YAML.

Functions§

configure
Change the process-wide defaults. Only the fields set on options change.
get_client
The process-wide client, created from the configure defaults on first use.
get_config
The current process-wide defaults, with the API key falling back to the LOOPS_API_KEY environment variable.
openapi_spec_path
Filesystem path of the shipped OpenAPI spec inside the crate sources.
reset_client
Drop the process-wide client so the next get_client builds a fresh one. Call it after configure, or in test teardown.

Type Aliases§

Result
Result alias used throughout the SDK.