Skip to content

support fetching user insights reports#84

Merged
andrew-propelauth merged 4 commits into
mainfrom
feat/user-insights-api
Apr 21, 2026
Merged

support fetching user insights reports#84
andrew-propelauth merged 4 commits into
mainfrom
feat/user-insights-api

Conversation

@mrmauer
Copy link
Copy Markdown
Contributor

@mrmauer mrmauer commented Feb 13, 2026

Tests

Tested w/ an example app.

After PR

now you can...

let top_inviters_page = auth.user_insights().fetch_user_top_inviter_report(
    TopInviterReportInterval::ThirtyDays,
    ReportPagination {
        page_size: Some(10), // default 10 for all report fetches
        page_number: Some(0), // defaults 0 for all report fetches
    }
).await?;

let champions_page = auth.user_insights().fetch_user_champion_report(
    ChampionReportInterval::ThirtyDays,
    ReportPagination::default(),
).await?;

let user_churn_page = auth.user_insights().fetch_user_churn_report(
    ChurnReportInterval::SevenDays,
    ReportPagination::default(),
).await?;

let user_reengagement_page = auth.user_insights().fetch_user_reengagement_report(
    ReengagementReportInterval::Weekly,
    ReportPagination::default(),
).await?;

let org_churn_page = auth.user_insights().fetch_org_churn_report(
    ChurnReportInterval::ThirtyDays,
    ReportPagination::default(),
).await?;

let org_reengagement_page = auth.user_insights().fetch_org_reengagement_report(
    ReengagementReportInterval::Weekly,
    ReportPagination::default(),
).await?;

let org_growth_page = auth.user_insights().fetch_org_growth_report(
    GrowthReportInterval::ThirtyDays,
    ReportPagination::default(),
).await?;

let org_attrition_page = auth.user_insights().fetch_org_attrition_report(
    AttritionReportInterval::ThirtyDays,
    ReportPagination::default(),
).await?;

let timeseries_of_daily_signups = auth.user_insights().fetch_chart_metric_data(
    ChartMetric::Signups,
    FetchChartDataQuery {
        cadence: Some(ChartMetricCadence::Daily), // defaults to daily if not provided,
        start_date: Some("2026-01-01".to_string()), // defaults to 30 days ago if not provided
        ..Default::default(), // end_date defaults to today, but the most recently available results will be yesterday
    },
).await?;

Note: the start_date and end_date fields take raw strings to avoid the messiness of re-exporting time/chrono/other crates. This way the user can use whichever date/time tooling they want and we'll still format pre-fetch. A decent alternative is re-exporting a time::Date that's aliased...

Copy link
Copy Markdown
Contributor

@andrew-propelauth andrew-propelauth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@andrew-propelauth andrew-propelauth merged commit 4e50f30 into main Apr 21, 2026
1 check passed
@andrew-propelauth andrew-propelauth deleted the feat/user-insights-api branch April 21, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants