InsionInsion
Rust

List records

Filter organization records and traverse cursor-based result pages.

list_records takes a ListRecordsQueryRequest builder. Every filter is optional, making an empty built request a valid unfiltered first page.

let query = ListRecordsQueryRequest::builder()
    .limit(50)
    .entity("post")
    .status(GetApiV1RecordsRequestStatus::Flagged)
    .build()?;
let page = client.list_records(&query, None).await?;

for record in &page.data {
    println!("{} {}", record.id, record.client_id);
}

Signature and filters

async fn list_records(
    &self,
    request: &ListRecordsQueryRequest,
    options: Option<RequestOptions>,
) -> Result<ListRecordsResponse, ApiError>

The query builder supports limit, starting_after, ending_before, client_id, user, entity, and status. Status is the typed GetApiV1RecordsRequestStatus enum. starting_after and ending_before are mutually exclusive and both require an Insion record ID, not a client_id.

Pagination and returned records

ListRecordsResponse has data and has_more. A record contains its Insion id, external client_id, entity/name, metadata, optional moderation state, timestamps, moderation_pending, and associated user when available. Continue forward while has_more is true, using the last record ID:

let next = ListRecordsQueryRequest::builder()
    .limit(50)
    .starting_after(page.data.last().expect("has_more page should contain data").id.clone())
    .build()?;

Keep all other filters identical across pages. Do not combine forward and backward cursors in one request.

On this page