Skip to content

support fetching user insights reports#84

Open
mrmauer wants to merge 3 commits intomainfrom
feat/user-insights-api
Open

support fetching user insights reports#84
mrmauer wants to merge 3 commits intomainfrom
feat/user-insights-api

Conversation

@mrmauer
Copy link
Contributor

@mrmauer mrmauer commented Feb 13, 2026

Tests

TKTK

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...

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.

1 participant