@iblai/iblai-api 4.470.0-ai → 4.471.0-ai

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -110,7 +110,7 @@ class CancelablePromise {
110
110
 
111
111
  const OpenAPI = {
112
112
  BASE: 'https://base.manager.iblai.app',
113
- VERSION: '4.470.0-ai-plus',
113
+ VERSION: '4.471.0-ai-plus',
114
114
  WITH_CREDENTIALS: false,
115
115
  CREDENTIALS: 'include',
116
116
  TOKEN: undefined,
@@ -50092,6 +50092,1387 @@ class V1AgentsService {
50092
50092
  }
50093
50093
  }
50094
50094
 
50095
+ class V1AnalyticsService {
50096
+ /**
50097
+ * Retrieve LLM usage costs for a specific mentor
50098
+ * Requires the `iblai-org` and `iblai-user` context headers.
50099
+ *
50100
+ * Retrieve LLM usage costs for a specific mentor.
50101
+ *
50102
+ * This endpoint returns data on the total cost of LLM usage for a specific mentor
50103
+ * within a specified date range. The cost is calculated by summing the costs
50104
+ * of all observations associated with traces from the tenant's sessions.
50105
+ *
50106
+ * Args:
50107
+ * request: The HTTP request containing filter query parameters.
50108
+ * org: Organization key identifier.
50109
+ * mentor_unique_id: User key identifier.
50110
+ *
50111
+ * Returns:
50112
+ * Response: Total LLM usage cost for the specified tenant.
50113
+ *
50114
+ * Raises:
50115
+ * NotFound: If the specified organization does not exist.
50116
+ * BadRequest: If the provided parameters are invalid.
50117
+ *
50118
+ * Query Parameters:
50119
+ * start_date (str): Start date for filtering (YYYY-MM-DD) - required.
50120
+ * end_date (str): End date for filtering (YYYY-MM-DD) - required.
50121
+ * @returns Cost
50122
+ * @throws ApiError
50123
+ */
50124
+ static v1AnalyticsAgentsCostRetrieve({
50125
+ agentId,
50126
+ endDate,
50127
+ startDate
50128
+ }) {
50129
+ return request(OpenAPI, {
50130
+ method: 'GET',
50131
+ url: '/v1/analytics/agents/{agent_id}/cost',
50132
+ path: {
50133
+ 'agent_id': agentId
50134
+ },
50135
+ query: {
50136
+ 'end_date': endDate,
50137
+ 'start_date': startDate
50138
+ },
50139
+ errors: {
50140
+ 400: `Invalid parameters`,
50141
+ 404: `Organization not found`
50142
+ }
50143
+ });
50144
+ }
50145
+ /**
50146
+ * Retrieve average message counts per session over time
50147
+ * Requires the `iblai-org` and `iblai-user` context headers.
50148
+ *
50149
+ * Retrieve average message counts per session over time.
50150
+ *
50151
+ * This endpoint returns data on the average number of messages exchanged in each
50152
+ * conversation session within a specified date range, with options for filtering
50153
+ * by mentor and aggregating by different time periods (hourly, daily, weekly).
50154
+ *
50155
+ * Args:
50156
+ * request: The HTTP request containing filter query parameters.
50157
+ * org: Organization key identifier.
50158
+ *
50159
+ * Returns:
50160
+ * Response: Time series of average message counts and session totals.
50161
+ *
50162
+ * Raises:
50163
+ * NotFound: If the specified organization does not exist.
50164
+ * BadRequest: If the provided parameters are invalid.
50165
+ *
50166
+ * Query Parameters:
50167
+ * start_date (str): Start date for filtering (YYYY-MM-DD) - required.
50168
+ * end_date (str): End date for filtering (YYYY-MM-DD) - required.
50169
+ * mentor_id (str): Filter by mentor unique ID.
50170
+ * aggregation (str): Time aggregation level (hourly, daily, weekly) - default: daily.
50171
+ * @returns MessageStatistics
50172
+ * @throws ApiError
50173
+ */
50174
+ static v1AnalyticsAverageMessagesPerSessionList({
50175
+ endDate,
50176
+ startDate,
50177
+ aggregation = 'daily',
50178
+ groupBy = 'day',
50179
+ mentorId
50180
+ }) {
50181
+ return request(OpenAPI, {
50182
+ method: 'GET',
50183
+ url: '/v1/analytics/average-messages-per-session',
50184
+ query: {
50185
+ 'aggregation': aggregation,
50186
+ 'end_date': endDate,
50187
+ 'group_by': groupBy,
50188
+ 'mentor_id': mentorId,
50189
+ 'start_date': startDate
50190
+ },
50191
+ errors: {
50192
+ 400: `Invalid parameters`,
50193
+ 404: `Organization not found`
50194
+ }
50195
+ });
50196
+ }
50197
+ /**
50198
+ * Requires the `iblai-org` and `iblai-user` context headers.
50199
+ *
50200
+ * API viewset for retrieving and filtering chat message history.
50201
+ *
50202
+ * This viewset provides endpoints for retrieving chat message history
50203
+ * within an organization, with extensive filtering options by date range,
50204
+ * user, topic, mentor, and sentiment.
50205
+ *
50206
+ * Permissions:
50207
+ * - Restricted to platform administrators only
50208
+ * @returns PaginatedConversationsList
50209
+ * @throws ApiError
50210
+ */
50211
+ static v1AnalyticsChatHistoryList({
50212
+ endDate,
50213
+ filterUserId,
50214
+ mentor,
50215
+ messagesAfter,
50216
+ sentiment,
50217
+ sessionId,
50218
+ startDate,
50219
+ topics,
50220
+ page,
50221
+ pageSize
50222
+ }) {
50223
+ return request(OpenAPI, {
50224
+ method: 'GET',
50225
+ url: '/v1/analytics/chat-history',
50226
+ query: {
50227
+ 'end_date': endDate,
50228
+ 'filter_user_id': filterUserId,
50229
+ 'mentor': mentor,
50230
+ 'messages_after': messagesAfter,
50231
+ 'sentiment': sentiment,
50232
+ 'session_id': sessionId,
50233
+ 'start_date': startDate,
50234
+ 'topics': topics,
50235
+ 'page': page,
50236
+ 'page_size': pageSize
50237
+ }
50238
+ });
50239
+ }
50240
+ /**
50241
+ * Retrieve filter options for chat message history
50242
+ * Requires the `iblai-org` and `iblai-user` context headers.
50243
+ *
50244
+ * Retrieve filter options for chat message history.
50245
+ *
50246
+ * This endpoint returns data on available filter options for the chat message
50247
+ * history endpoint, including topics, date ranges (weekly or monthly),
50248
+ * sentiments, and users who have chat history.
50249
+ *
50250
+ * Args:
50251
+ * request: The HTTP request containing query parameters.
50252
+ * org: Organization key identifier.
50253
+ *
50254
+ * Returns:
50255
+ * Response: Available filter options for chat message history.
50256
+ *
50257
+ * Raises:
50258
+ * NotFound: If the specified organization does not exist.
50259
+ *
50260
+ * Query Parameters:
50261
+ * monthly_range (bool): Whether to return monthly or weekly date ranges.
50262
+ * mentor_id (str): Filter users by those who have chatted with a specific mentor.
50263
+ * @returns ChatHistoryFilterData
50264
+ * @throws ApiError
50265
+ */
50266
+ static v1AnalyticsChatHistoryFilterRetrieve({
50267
+ endDate,
50268
+ mentorId,
50269
+ monthlyRange = false,
50270
+ startDate
50271
+ }) {
50272
+ return request(OpenAPI, {
50273
+ method: 'GET',
50274
+ url: '/v1/analytics/chat-history-filter',
50275
+ query: {
50276
+ 'end_date': endDate,
50277
+ 'mentor_id': mentorId,
50278
+ 'monthly_range': monthlyRange,
50279
+ 'start_date': startDate
50280
+ },
50281
+ errors: {
50282
+ 404: `Organization not found`
50283
+ }
50284
+ });
50285
+ }
50286
+ /**
50287
+ * Get Content Analytics
50288
+ * Requires the `iblai-org` context header.
50289
+ *
50290
+ *
50291
+ * Retrieve aggregated analytics for catalog content (courses, programs, pathways, skills).
50292
+ *
50293
+ * Returns both summary statistics and paginated list of content items with individual analytics.
50294
+ * When a platform_key is provided, results are filtered to show only content consumed by
50295
+ * learners associated with that platform.
50296
+ *
50297
+ * **RBAC Requirements:**
50298
+ * - Requires: Analytics Viewer role (Ibl.Analytics/Core/read) or Tenant Admin role (Ibl.*)
50299
+ *
50300
+ * **Metrics supported:**
50301
+ * - `course` or `courses`: Course analytics with time spent
50302
+ * - `program` or `programs`: Program analytics
50303
+ * - `pathway` or `pathways`: Pathway analytics
50304
+ * - `skill` or `skills`: Skill analytics
50305
+ *
50306
+ * **Platform Filtering:**
50307
+ * - Without platform_key: Shows global analytics across all platforms
50308
+ * - With platform_key: Shows analytics filtered by platform learners only
50309
+ *
50310
+ * **Time Spent Analytics:**
50311
+ * - Platform-level: Total time spent across all content and average per learner
50312
+ * - Course-level: Total time spent per course and average per enrolled learner
50313
+ * - Time values are provided in seconds for precision
50314
+ * - Overtime: Time series data showing platform time spent over last 7 days (courses only, and include_overtime=true)
50315
+ *
50316
+ * **External Content:**
50317
+ * - Content not owned by the requesting platform but used by its learners is marked as "external"
50318
+ * - External content has limited metadata exposure for privacy
50319
+ *
50320
+ * @returns ContentResponse
50321
+ * @throws ApiError
50322
+ */
50323
+ static v1AnalyticsContentRetrieve({
50324
+ metric,
50325
+ dateFilter = 'today',
50326
+ endDate,
50327
+ granularity = 'hour',
50328
+ includeOvertime = false,
50329
+ mentorUniqueId,
50330
+ search,
50331
+ sortBy = 'enrollments',
50332
+ startDate,
50333
+ usergroupIds,
50334
+ page,
50335
+ pageSize
50336
+ }) {
50337
+ return request(OpenAPI, {
50338
+ method: 'GET',
50339
+ url: '/v1/analytics/content',
50340
+ query: {
50341
+ 'date_filter': dateFilter,
50342
+ 'end_date': endDate,
50343
+ 'granularity': granularity,
50344
+ 'include_overtime': includeOvertime,
50345
+ 'mentor_unique_id': mentorUniqueId,
50346
+ 'metric': metric,
50347
+ 'search': search,
50348
+ 'sort_by': sortBy,
50349
+ 'start_date': startDate,
50350
+ 'usergroup_ids': usergroupIds,
50351
+ 'page': page,
50352
+ 'page_size': pageSize
50353
+ }
50354
+ });
50355
+ }
50356
+ /**
50357
+ * Get Content Details
50358
+ * Requires the `iblai-org` context header.
50359
+ *
50360
+ * Retrieve detailed analytics for a specific content item including summary statistics, learner-level data, and optional time series information.
50361
+ * @returns ContentDetailsResponse
50362
+ * @throws ApiError
50363
+ */
50364
+ static v1AnalyticsContentDetailsRetrieve({
50365
+ contentId,
50366
+ metric,
50367
+ dateFilter = 'today',
50368
+ endDate,
50369
+ mentorUniqueId,
50370
+ search,
50371
+ startDate,
50372
+ timeMetric,
50373
+ usergroupIds,
50374
+ page,
50375
+ pageSize
50376
+ }) {
50377
+ return request(OpenAPI, {
50378
+ method: 'GET',
50379
+ url: '/v1/analytics/content/details/{content_id}',
50380
+ path: {
50381
+ 'content_id': contentId
50382
+ },
50383
+ query: {
50384
+ 'date_filter': dateFilter,
50385
+ 'end_date': endDate,
50386
+ 'mentor_unique_id': mentorUniqueId,
50387
+ 'metric': metric,
50388
+ 'search': search,
50389
+ 'start_date': startDate,
50390
+ 'time_metric': timeMetric,
50391
+ 'usergroup_ids': usergroupIds,
50392
+ 'page': page,
50393
+ 'page_size': pageSize
50394
+ }
50395
+ });
50396
+ }
50397
+ /**
50398
+ * Retrieve conversation volume data over time
50399
+ * Requires the `iblai-org` and `iblai-user` context headers.
50400
+ *
50401
+ * Retrieve conversation volume data over time.
50402
+ *
50403
+ * This endpoint returns data on the number of conversations that occurred
50404
+ * within a specified date range, with options for different time aggregations
50405
+ * (hourly, daily, weekly). Results can be filtered by mentor.
50406
+ *
50407
+ * Args:
50408
+ * request: The HTTP request containing filter query parameters.
50409
+ * org: Organization key identifier.
50410
+ * user_id: User identifier (not used in the implementation).
50411
+ *
50412
+ * Returns:
50413
+ * Response: Time series data of conversation counts.
50414
+ *
50415
+ * Raises:
50416
+ * NotFound: If the specified organization does not exist.
50417
+ * BadRequest: If the provided parameters are invalid.
50418
+ *
50419
+ * Query Parameters:
50420
+ * start_date (str): Start date for filtering (YYYY-MM-DD) - required.
50421
+ * end_date (str): End date for filtering (YYYY-MM-DD) - required.
50422
+ * mentor_id (str): Filter by mentor unique ID.
50423
+ * aggregation (str): Time aggregation level (hourly, daily, weekly) - default: daily.
50424
+ * @returns ConversationVolume
50425
+ * @throws ApiError
50426
+ */
50427
+ static v1AnalyticsConversationList({
50428
+ endDate,
50429
+ startDate,
50430
+ aggregation = 'daily',
50431
+ mentorId
50432
+ }) {
50433
+ return request(OpenAPI, {
50434
+ method: 'GET',
50435
+ url: '/v1/analytics/conversation',
50436
+ query: {
50437
+ 'aggregation': aggregation,
50438
+ 'end_date': endDate,
50439
+ 'mentor_id': mentorId,
50440
+ 'start_date': startDate
50441
+ },
50442
+ errors: {
50443
+ 400: `Invalid parameters`,
50444
+ 404: `Organization not found`
50445
+ }
50446
+ });
50447
+ }
50448
+ /**
50449
+ * Retrieve the model costs for a tenant
50450
+ * Requires the `iblai-org` and `iblai-user` context headers.
50451
+ *
50452
+ * Retrieve the model costs for a tenant
50453
+ *
50454
+ * Filter parameters for period are start_date and enddate
50455
+ *
50456
+ * Accessible to tenant Admins only.
50457
+ * @returns ModelCost
50458
+ * @throws ApiError
50459
+ */
50460
+ static v1AnalyticsCostsModelRetrieve({
50461
+ endDate,
50462
+ startDate
50463
+ }) {
50464
+ return request(OpenAPI, {
50465
+ method: 'GET',
50466
+ url: '/v1/analytics/costs/model',
50467
+ query: {
50468
+ 'end_date': endDate,
50469
+ 'start_date': startDate
50470
+ }
50471
+ });
50472
+ }
50473
+ /**
50474
+ * Retrieve LLM usage costs aggregated by user
50475
+ * Requires the `iblai-org` and `iblai-user` context headers.
50476
+ *
50477
+ * Retrieve LLM usage costs aggregated by user.
50478
+ *
50479
+ * This endpoint returns data on the total cost of LLM usage for each user
50480
+ * within a specified date range, with pagination support. The costs are
50481
+ * calculated by summing the costs of all observations associated with
50482
+ * traces from the user's sessions.
50483
+ *
50484
+ * Args:
50485
+ * request: The HTTP request containing filter query parameters.
50486
+ * org: Organization key identifier.
50487
+ *
50488
+ * Returns:
50489
+ * Response: Paginated list of users with their total LLM usage costs.
50490
+ *
50491
+ * Raises:
50492
+ * NotFound: If the specified organization does not exist.
50493
+ * BadRequest: If the provided parameters are invalid.
50494
+ *
50495
+ * Query Parameters:
50496
+ * start_date (str): Start date for filtering (YYYY-MM-DD) - required.
50497
+ * end_date (str): End date for filtering (YYYY-MM-DD) - required.
50498
+ * limit (int): Number of results per page - default: 10.
50499
+ * offset (int): Offset for pagination - default: 0.
50500
+ * @returns LLMTracesListResponse
50501
+ * @throws ApiError
50502
+ */
50503
+ static v1AnalyticsCostsPerUserRetrieve({
50504
+ endDate,
50505
+ startDate
50506
+ }) {
50507
+ return request(OpenAPI, {
50508
+ method: 'GET',
50509
+ url: '/v1/analytics/costs/per-user',
50510
+ query: {
50511
+ 'end_date': endDate,
50512
+ 'start_date': startDate
50513
+ },
50514
+ errors: {
50515
+ 400: `Invalid parameters`,
50516
+ 404: `Organization not found`
50517
+ }
50518
+ });
50519
+ }
50520
+ /**
50521
+ * Financial Analytics API - Get comprehensive cost metrics with comparison analysis
50522
+ * Requires the `iblai-org` context header.
50523
+ *
50524
+ * Financial Analytics API - Get comprehensive cost metrics with comparison analysis.
50525
+ *
50526
+ * This endpoint provides period-based cost analysis (not cumulative) with support for:
50527
+ * - Multiple time granularities and metrics
50528
+ * - Cross-dimensional filtering
50529
+ * - Percentage change vs comparison periods
50530
+ * - Forward-filled time series
50531
+ *
50532
+ * **Examples:**
50533
+ *
50534
+ * **Basic Weekly Costs:**
50535
+ * ```
50536
+ * GET /api/analytics/financial/?metric=weekly_costs&comparison_days=10
50537
+ * ```
50538
+ *
50539
+ * **Platform & Mentor Filtered:**
50540
+ * ```
50541
+ * # Get total costs for a specific platform and agent
50542
+ * GET /api/analytics/financial/?metric=total_costs&platform_key=web-app&mentor_unique_id=mentor-123&comparison_days=14
50543
+ * ```
50544
+ *
50545
+ * **Monthly Costs by Provider:**
50546
+ * ```
50547
+ * GET /api/analytics/financial/?metric=monthly_costs&provider=openai&granularity=month&comparison_days=30
50548
+ * ```
50549
+ *
50550
+ * **Daily Costs for Specific User:**
50551
+ * ```
50552
+ * GET /api/analytics/financial/?metric=total_costs&username=user-456&granularity=day&start_date=2025-01-15&end_date=2025-01-21&comparison_days=7
50553
+ * ```
50554
+ *
50555
+ *
50556
+ * **Response Structure:**
50557
+ * ```json
50558
+ * {
50559
+ * "metric": "weekly_costs",
50560
+ * "value": 12.47,
50561
+ * "percentage_change": 8.5,
50562
+ * "overtime": [
50563
+ * {"date": "2025-01-06", "value": 2.89},
50564
+ * {"date": "2025-01-13", "value": 3.12}
50565
+ * ],
50566
+ * "period_info": {
50567
+ * "start_date": "2025-01-01",
50568
+ * "end_date": "2025-01-31",
50569
+ * "period_days": 31
50570
+ * },
50571
+ * "comparison_info": {
50572
+ * "previous_period_value": 11.50,
50573
+ * ...
50574
+ * }
50575
+ * }
50576
+ * ```
50577
+ * @returns BaseFinanceResponse Successful financial metrics response with period-based cost data
50578
+ * @throws ApiError
50579
+ */
50580
+ static v1AnalyticsFinancialRetrieve({
50581
+ metric,
50582
+ comparisonDays,
50583
+ dateFilter = 'today',
50584
+ endDate,
50585
+ fillMethod = 'zero',
50586
+ granularity = 'day',
50587
+ llmModel,
50588
+ mentorUniqueId,
50589
+ provider,
50590
+ showOvertime = true,
50591
+ startDate,
50592
+ usergroupIds,
50593
+ username
50594
+ }) {
50595
+ return request(OpenAPI, {
50596
+ method: 'GET',
50597
+ url: '/v1/analytics/financial',
50598
+ query: {
50599
+ 'comparison_days': comparisonDays,
50600
+ 'date_filter': dateFilter,
50601
+ 'end_date': endDate,
50602
+ 'fill_method': fillMethod,
50603
+ 'granularity': granularity,
50604
+ 'llm_model': llmModel,
50605
+ 'mentor_unique_id': mentorUniqueId,
50606
+ 'metric': metric,
50607
+ 'provider': provider,
50608
+ 'show_overtime': showOvertime,
50609
+ 'start_date': startDate,
50610
+ 'usergroup_ids': usergroupIds,
50611
+ 'username': username
50612
+ },
50613
+ errors: {
50614
+ 400: `Bad Request - Invalid query parameters`,
50615
+ 403: `Forbidden - Insufficient permissions`,
50616
+ 500: `Internal Server Error`
50617
+ }
50618
+ });
50619
+ }
50620
+ /**
50621
+ * LLM cost/usage analytics
50622
+ * Requires the `iblai-org` context header.
50623
+ *
50624
+ * Platform-scoped analytics for LLM **cost, token usage, latency, and counts**. One endpoint serves three resources selected by the `resource` param:
50625
+ *
50626
+ * - `metrics` (default) — aggregate measures with optional `group_by` (type|model|tags|environment) and `granularity` (day|week|month) time series.
50627
+ * - `observations` — row-level generation drill-down, page-paginated; pass `observation_id` to fetch one observation.
50628
+ * - `traces` — trace list (per-user/per-session drill-down the metrics resource cannot group by); pass `trace_id` to fetch one trace.
50629
+ *
50630
+ * **Tenant isolation:** every *list* query is scoped to the validated request platform via a server-injected `metadata.platform_key` filter. Get-by-id (`trace_id`/`observation_id`) takes only the id, so ownership is verified after the fetch and a cross-tenant record returns **404** (never 403) so its existence is not leaked. The client `platform_key` is used only for RBAC validation, never to scope the upstream call — the analytics store is project-scoped across all tenants.
50631
+ *
50632
+ * **Access:** platform admins see the whole tenant. Non-admins may read **only their own usage** — the `userId` filter is clamped to the caller, so a self-access request can never return tenant-wide aggregates. A non-admin who omits `username` defaults to their own rows; passing another user's `username` is rejected (403). Watchers and mentor owners keep the broader scope their RBAC grants already allow.
50633
+ *
50634
+ * **Default time frame:** when no date params are given the query defaults to `date_filter=today` (start=end=today). Widen it with `date_filter=7d|30d|90d`, `date_filter=all_time` for full history, or `date_filter=custom` plus `start_date`/`end_date`.
50635
+ *
50636
+ * **Measures** (csv `measures`): total_cost, input_tokens, output_tokens, total_tokens, count, latency. **Aggregation** applies to every measure: sum|avg|count|min|max|p50|p75|p90|p95|p99.
50637
+ *
50638
+ * **Per-mentor ranking:** the metrics resource cannot group by custom metadata, so use `group_by=tags` — traces carry both `platform_key:<key>` and `mentor_id:<id>` tags, so with the platform filter applied each tag bucket collapses to one mentor. Parse `mentor_id:` out of the returned `tags` array.
50639
+ *
50640
+ * **Recipes**
50641
+ * ```
50642
+ * # Total spend today (tenant-wide)
50643
+ * GET ?platform_key=acme&resource=metrics&measures=total_cost
50644
+ *
50645
+ * # Cost + tokens + calls per service, last 30 days
50646
+ * GET ?platform_key=acme&resource=metrics&measures=total_cost,total_tokens,count&group_by=type&date_filter=30d
50647
+ *
50648
+ * # Cost per model over a custom range
50649
+ * GET ?platform_key=acme&resource=metrics&measures=total_cost&group_by=model&date_filter=custom&start_date=2025-01-01&end_date=2025-01-31
50650
+ *
50651
+ * # Per-mentor cost ranking
50652
+ * GET ?platform_key=acme&resource=metrics&measures=total_cost&group_by=tags
50653
+ *
50654
+ * # Daily cost time series
50655
+ * GET ?platform_key=acme&resource=metrics&measures=total_cost&granularity=day&date_filter=30d
50656
+ *
50657
+ * # Latency percentiles for the chat service
50658
+ * GET ?platform_key=acme&resource=metrics&measures=latency&aggregation=p95&trace_name=chat
50659
+ *
50660
+ * # One learner's spend
50661
+ * GET ?platform_key=acme&resource=metrics&measures=total_cost&username=alice
50662
+ *
50663
+ * # Row-level drill-down for a trace
50664
+ * GET ?platform_key=acme&resource=observations&trace_id=abc123&page=1&limit=50
50665
+ *
50666
+ * # Fetch a single observation
50667
+ * GET ?platform_key=acme&resource=observations&observation_id=obs123
50668
+ *
50669
+ * # Recent traces for one learner (newest first)
50670
+ * GET ?platform_key=acme&resource=traces&username=alice&order_by=timestamp&direction=desc&limit=50
50671
+ *
50672
+ * # All traces in one conversation/session
50673
+ * GET ?platform_key=acme&resource=traces&session_id=sess123
50674
+ *
50675
+ * # Fetch a single trace
50676
+ * GET ?platform_key=acme&resource=traces&trace_id=abc123
50677
+ * ```
50678
+ *
50679
+ * **Limits:** `limit` caps rows (default 50, max 1000). `group_by` cannot use userId/sessionId/mentor_id (the upstream store rejects them); those are filter-only. The metrics query requires bounded timestamps, so `date_filter=all_time` is served from a fixed 2020-01-01 lower bound through today (wide enough to cover all ingested history).
50680
+ * @returns LlmUsageAnalyticsResponse Metrics rows or paginated observation records.
50681
+ * @throws ApiError
50682
+ */
50683
+ static v1AnalyticsLlmUsageRetrieve({
50684
+ aggregation = 'sum',
50685
+ dateFilter = 'today',
50686
+ direction = 'desc',
50687
+ endDate,
50688
+ granularity,
50689
+ groupBy,
50690
+ limit = 50,
50691
+ llmModel,
50692
+ measures,
50693
+ mentorUniqueId,
50694
+ observationId,
50695
+ orderBy,
50696
+ page = 1,
50697
+ resource = 'metrics',
50698
+ sessionId,
50699
+ startDate,
50700
+ traceId,
50701
+ traceName,
50702
+ usergroupIds,
50703
+ username,
50704
+ view = 'observations'
50705
+ }) {
50706
+ return request(OpenAPI, {
50707
+ method: 'GET',
50708
+ url: '/v1/analytics/llm-usage',
50709
+ query: {
50710
+ 'aggregation': aggregation,
50711
+ 'date_filter': dateFilter,
50712
+ 'direction': direction,
50713
+ 'end_date': endDate,
50714
+ 'granularity': granularity,
50715
+ 'group_by': groupBy,
50716
+ 'limit': limit,
50717
+ 'llm_model': llmModel,
50718
+ 'measures': measures,
50719
+ 'mentor_unique_id': mentorUniqueId,
50720
+ 'observation_id': observationId,
50721
+ 'order_by': orderBy,
50722
+ 'page': page,
50723
+ 'resource': resource,
50724
+ 'session_id': sessionId,
50725
+ 'start_date': startDate,
50726
+ 'trace_id': traceId,
50727
+ 'trace_name': traceName,
50728
+ 'usergroup_ids': usergroupIds,
50729
+ 'username': username,
50730
+ 'view': view
50731
+ },
50732
+ errors: {
50733
+ 400: `Bad Request – invalid query params or a value outside the allowed vocabulary.`,
50734
+ 403: `Forbidden – caller lacks analytics access to this platform, or requested a mentor-scoped observation drill-down (not supported).`,
50735
+ 404: `Not Found – the requested \`trace_id\`/\`observation_id\` does not exist or belongs to another tenant (existence is not leaked, so cross-tenant get-by-id returns 404 not 403).`,
50736
+ 500: `Internal Server Error`,
50737
+ 502: `Bad Gateway – the upstream analytics provider was unreachable or returned an error.`
50738
+ }
50739
+ });
50740
+ }
50741
+ /**
50742
+ * Requires the `iblai-org` and `iblai-user` context headers.
50743
+ *
50744
+ * API viewset for retrieving a user's chat message history.
50745
+ *
50746
+ * Permissions:
50747
+ * - Any authenticated user can access their own data
50748
+ * - Tenant admins (with an analytics policy) and watchers can access the
50749
+ * data of users they are authorized for via RBAC
50750
+ * - Other cross-user access is denied
50751
+ * @returns PaginatedConversationsList
50752
+ * @throws ApiError
50753
+ */
50754
+ static v1AnalyticsMeChatHistoryList({
50755
+ endDate,
50756
+ mentor,
50757
+ messagesAfter,
50758
+ sentiment,
50759
+ sessionId,
50760
+ startDate,
50761
+ topics,
50762
+ page,
50763
+ pageSize
50764
+ }) {
50765
+ return request(OpenAPI, {
50766
+ method: 'GET',
50767
+ url: '/v1/analytics/me/chat-history',
50768
+ query: {
50769
+ 'end_date': endDate,
50770
+ 'mentor': mentor,
50771
+ 'messages_after': messagesAfter,
50772
+ 'sentiment': sentiment,
50773
+ 'session_id': sessionId,
50774
+ 'start_date': startDate,
50775
+ 'topics': topics,
50776
+ 'page': page,
50777
+ 'page_size': pageSize
50778
+ }
50779
+ });
50780
+ }
50781
+ /**
50782
+ * Retrieve filter options for the target user's chat message history
50783
+ * Requires the `iblai-org` and `iblai-user` context headers.
50784
+ *
50785
+ * Retrieve filter options for the target user's chat message history.
50786
+ * @returns UserChatHistoryFilterData
50787
+ * @throws ApiError
50788
+ */
50789
+ static v1AnalyticsMeChatHistoryFilterRetrieve({
50790
+ endDate,
50791
+ mentorId,
50792
+ monthlyRange = false,
50793
+ startDate
50794
+ }) {
50795
+ return request(OpenAPI, {
50796
+ method: 'GET',
50797
+ url: '/v1/analytics/me/chat-history-filter',
50798
+ query: {
50799
+ 'end_date': endDate,
50800
+ 'mentor_id': mentorId,
50801
+ 'monthly_range': monthlyRange,
50802
+ 'start_date': startDate
50803
+ },
50804
+ errors: {
50805
+ 403: `Cannot access another user's data`,
50806
+ 404: `Organization not found`
50807
+ }
50808
+ });
50809
+ }
50810
+ /**
50811
+ * List user chat history reports
50812
+ * Requires the `iblai-org` and `iblai-user` context headers.
50813
+ *
50814
+ * List all chat history reports created by the user.
50815
+ * @returns UserReportListResponse
50816
+ * @throws ApiError
50817
+ */
50818
+ static v1AnalyticsMeChatHistoryReportRetrieve() {
50819
+ return request(OpenAPI, {
50820
+ method: 'GET',
50821
+ url: '/v1/analytics/me/chat-history-report'
50822
+ });
50823
+ }
50824
+ /**
50825
+ * Get user report status
50826
+ * Requires the `iblai-org` and `iblai-user` context headers.
50827
+ *
50828
+ * Get the status of a user's own chat history report.
50829
+ * @returns ReportCreate
50830
+ * @throws ApiError
50831
+ */
50832
+ static v1AnalyticsMeChatHistoryReportRetrieve2({
50833
+ taskId
50834
+ }) {
50835
+ return request(OpenAPI, {
50836
+ method: 'GET',
50837
+ url: '/v1/analytics/me/chat-history-report/{task_id}',
50838
+ path: {
50839
+ 'task_id': taskId
50840
+ }
50841
+ });
50842
+ }
50843
+ /**
50844
+ * Download user chat history report
50845
+ * Requires the `iblai-org` and `iblai-user` context headers.
50846
+ *
50847
+ * Download a completed user chat history report as CSV or JSON.
50848
+ * @returns any No response body
50849
+ * @throws ApiError
50850
+ */
50851
+ static v1AnalyticsMeChatHistoryReportDownloadRetrieve({
50852
+ taskId,
50853
+ columns,
50854
+ format = 'csv'
50855
+ }) {
50856
+ return request(OpenAPI, {
50857
+ method: 'GET',
50858
+ url: '/v1/analytics/me/chat-history-report/{task_id}/download',
50859
+ path: {
50860
+ 'task_id': taskId
50861
+ },
50862
+ query: {
50863
+ 'columns': columns,
50864
+ 'format': format
50865
+ }
50866
+ });
50867
+ }
50868
+ /**
50869
+ * Requires the `iblai-org` and `iblai-user` context headers.
50870
+ *
50871
+ * API viewset for retrieving a user's chat message history.
50872
+ *
50873
+ * Permissions:
50874
+ * - Any authenticated user can access their own data
50875
+ * - Tenant admins (with an analytics policy) and watchers can access the
50876
+ * data of users they are authorized for via RBAC
50877
+ * - Other cross-user access is denied
50878
+ * @returns Conversations
50879
+ * @throws ApiError
50880
+ */
50881
+ static v1AnalyticsMeChatHistoryRetrieve({
50882
+ id,
50883
+ endDate,
50884
+ mentor,
50885
+ messagesAfter,
50886
+ sentiment,
50887
+ sessionId,
50888
+ startDate,
50889
+ topics
50890
+ }) {
50891
+ return request(OpenAPI, {
50892
+ method: 'GET',
50893
+ url: '/v1/analytics/me/chat-history/{id}',
50894
+ path: {
50895
+ 'id': id
50896
+ },
50897
+ query: {
50898
+ 'end_date': endDate,
50899
+ 'mentor': mentor,
50900
+ 'messages_after': messagesAfter,
50901
+ 'sentiment': sentiment,
50902
+ 'session_id': sessionId,
50903
+ 'start_date': startDate,
50904
+ 'topics': topics
50905
+ }
50906
+ });
50907
+ }
50908
+ /**
50909
+ * Retrieve the most discussed topics over time
50910
+ * Requires the `iblai-org` and `iblai-user` context headers.
50911
+ *
50912
+ * Retrieve the most discussed topics over time.
50913
+ *
50914
+ * This endpoint returns data on the frequency of topics discussed in conversations
50915
+ * within a specified date range, with options for filtering by mentor and
50916
+ * aggregating by different time periods (hourly, daily, weekly).
50917
+ *
50918
+ * Args:
50919
+ * request: The HTTP request containing filter query parameters.
50920
+ * org: Organization key identifier.
50921
+ *
50922
+ * Returns:
50923
+ * Response: List of topics with their conversation counts, ordered by frequency.
50924
+ *
50925
+ * Raises:
50926
+ * NotFound: If the specified organization does not exist.
50927
+ * BadRequest: If the provided parameters are invalid.
50928
+ *
50929
+ * Query Parameters:
50930
+ * start_date (str): Start date for filtering (YYYY-MM-DD) - required.
50931
+ * end_date (str): End date for filtering (YYYY-MM-DD) - required.
50932
+ * mentor_id (str): Filter by mentor unique ID.
50933
+ * aggregation (str): Time aggregation level (hourly, daily, weekly) - default: daily.
50934
+ * @returns TopicRecord
50935
+ * @throws ApiError
50936
+ */
50937
+ static v1AnalyticsMostDiscussedTopicsList({
50938
+ endDate,
50939
+ startDate,
50940
+ aggregation = 'daily',
50941
+ groupBy = 'day',
50942
+ mentorId
50943
+ }) {
50944
+ return request(OpenAPI, {
50945
+ method: 'GET',
50946
+ url: '/v1/analytics/most-discussed-topics',
50947
+ query: {
50948
+ 'aggregation': aggregation,
50949
+ 'end_date': endDate,
50950
+ 'group_by': groupBy,
50951
+ 'mentor_id': mentorId,
50952
+ 'start_date': startDate
50953
+ },
50954
+ errors: {
50955
+ 400: `Invalid parameters`,
50956
+ 404: `Organization not found`
50957
+ }
50958
+ });
50959
+ }
50960
+ /**
50961
+ * Retrieve LLM usage costs for a specific tenant
50962
+ * Requires the `iblai-org` and `iblai-user` context headers.
50963
+ *
50964
+ * Retrieve LLM usage costs for a specific tenant.
50965
+ *
50966
+ * This endpoint returns data on the total cost of LLM usage for a specific tenant
50967
+ * within a specified date range. The cost is calculated by summing the costs
50968
+ * of all observations associated with traces from the tenant's sessions.
50969
+ *
50970
+ * Args:
50971
+ * request: The HTTP request containing filter query parameters.
50972
+ * org: Organization key identifier.
50973
+ *
50974
+ * Returns:
50975
+ * Response: Total LLM usage cost for the specified tenant.
50976
+ *
50977
+ * Raises:
50978
+ * NotFound: If the specified organization does not exist.
50979
+ * BadRequest: If the provided parameters are invalid.
50980
+ *
50981
+ * Query Parameters:
50982
+ * start_date (str): Start date for filtering (YYYY-MM-DD) - required.
50983
+ * end_date (str): End date for filtering (YYYY-MM-DD) - required.
50984
+ * @returns Cost
50985
+ * @throws ApiError
50986
+ */
50987
+ static v1AnalyticsOrgCostRetrieve({
50988
+ endDate,
50989
+ startDate
50990
+ }) {
50991
+ return request(OpenAPI, {
50992
+ method: 'GET',
50993
+ url: '/v1/analytics/org-cost',
50994
+ query: {
50995
+ 'end_date': endDate,
50996
+ 'start_date': startDate
50997
+ },
50998
+ errors: {
50999
+ 400: `Invalid parameters`,
51000
+ 404: `Organization not found`
51001
+ }
51002
+ });
51003
+ }
51004
+ /**
51005
+ * Retrieve an overview of key analytics metrics
51006
+ * Requires the `iblai-org` and `iblai-user` context headers.
51007
+ *
51008
+ * Retrieve an overview of key analytics metrics.
51009
+ *
51010
+ * This endpoint returns a comprehensive overview of key analytics metrics
51011
+ * for an organization, including:
51012
+ * - Conversation volume: Total sessions and month-over-month change
51013
+ * - Users: Total unique users and month-over-month change
51014
+ * - Topics: Total unique topics and month-over-month change
51015
+ * - User ratings: Total ratings and month-over-month change
51016
+ *
51017
+ * Results can be filtered by mentor.
51018
+ *
51019
+ * Args:
51020
+ * request: The HTTP request containing filter query parameters.
51021
+ * org: Organization key identifier.
51022
+ * user_id: User identifier (not used in the implementation).
51023
+ *
51024
+ * Returns:
51025
+ * Response: Overview of key analytics metrics with month-over-month changes.
51026
+ *
51027
+ * Raises:
51028
+ * NotFound: If the specified organization does not exist.
51029
+ *
51030
+ * Query Parameters:
51031
+ * mentor_id (str): Filter analytics by mentor unique ID.
51032
+ * @returns AnalyticsOverview
51033
+ * @throws ApiError
51034
+ */
51035
+ static v1AnalyticsOverviewSummaryRetrieve({
51036
+ groupBy = 'day',
51037
+ mentorId
51038
+ }) {
51039
+ return request(OpenAPI, {
51040
+ method: 'GET',
51041
+ url: '/v1/analytics/overview-summary',
51042
+ query: {
51043
+ 'group_by': groupBy,
51044
+ 'mentor_id': mentorId
51045
+ },
51046
+ errors: {
51047
+ 404: `Organization not found`
51048
+ }
51049
+ });
51050
+ }
51051
+ /**
51052
+ * Retrieve trends of registered users over time
51053
+ * Requires the `iblai-org` and `iblai-user` context headers.
51054
+ *
51055
+ * Retrieve trends of registered users over time.
51056
+ *
51057
+ * This endpoint returns data on the number of new user registrations
51058
+ * within a specified date range, with options for different time aggregations
51059
+ * (hourly, daily, weekly, monthly). The data is backfilled to ensure
51060
+ * continuous time series even for periods with zero registrations.
51061
+ *
51062
+ * Args:
51063
+ * request: The HTTP request containing filter query parameters.
51064
+ * org: Organization key identifier.
51065
+ *
51066
+ * Returns:
51067
+ * Response: Time series of user registration counts.
51068
+ *
51069
+ * Raises:
51070
+ * NotFound: If the specified organization does not exist.
51071
+ * BadRequest: If the provided parameters are invalid.
51072
+ *
51073
+ * Query Parameters:
51074
+ * start_date (str): Start date for filtering (YYYY-MM-DD) - required.
51075
+ * end_date (str): End date for filtering (YYYY-MM-DD) - required.
51076
+ * aggregation (str): Time aggregation level (hourly, daily, weekly, monthly) - default: daily.
51077
+ * @returns TrendEntry
51078
+ * @throws ApiError
51079
+ */
51080
+ static v1AnalyticsRegisteredUsersTrendList({
51081
+ endDate,
51082
+ startDate,
51083
+ aggregation = 'daily',
51084
+ groupBy = 'day'
51085
+ }) {
51086
+ return request(OpenAPI, {
51087
+ method: 'GET',
51088
+ url: '/v1/analytics/registered-users-trend',
51089
+ query: {
51090
+ 'aggregation': aggregation,
51091
+ 'end_date': endDate,
51092
+ 'group_by': groupBy,
51093
+ 'start_date': startDate
51094
+ },
51095
+ errors: {
51096
+ 400: `Invalid parameters`,
51097
+ 404: `Organization not found`
51098
+ }
51099
+ });
51100
+ }
51101
+ /**
51102
+ * Update time spent tracking data from client-side events
51103
+ * Requires the `iblai-org` context header.
51104
+ *
51105
+ * Update time spent tracking data from client-side events.
51106
+ *
51107
+ * This endpoint receives time spent data collected on the client side and
51108
+ * stores it in the analytics database. Authentication is optional - the API
51109
+ * supports both authenticated and anonymous requests.
51110
+ *
51111
+ * Methods:
51112
+ * POST: Submit time spent tracking data
51113
+ *
51114
+ * Authentication:
51115
+ * Optional - supports both authenticated and anonymous requests.
51116
+ * - Authenticated requests: User ID is associated with the record
51117
+ * - Anonymous requests: Records are stored with null user_id
51118
+ *
51119
+ * Returns:
51120
+ * A response indicating success or failure:
51121
+ * {
51122
+ * "success": true|false,
51123
+ * "message": "Error message if failed" (optional)
51124
+ * }
51125
+ *
51126
+ * Error Responses:
51127
+ * 400 Bad Request: If the request data is invalid or the API is disabled
51128
+ *
51129
+ * Notes:
51130
+ * This API must be enabled via the ENABLE_TIME_SPENT_UPDATE_API setting.
51131
+ * @returns TimeSpentUpdateResponse
51132
+ * @throws ApiError
51133
+ */
51134
+ static v1AnalyticsTimeUpdateCreate({
51135
+ requestBody
51136
+ }) {
51137
+ return request(OpenAPI, {
51138
+ method: 'POST',
51139
+ url: '/v1/analytics/time/update',
51140
+ body: requestBody,
51141
+ mediaType: 'application/json'
51142
+ });
51143
+ }
51144
+ /**
51145
+ * Retrieve the most engaged students based on chat message count
51146
+ * Requires the `iblai-org` and `iblai-user` context headers.
51147
+ *
51148
+ * Retrieve the most engaged students based on chat message count.
51149
+ *
51150
+ * This endpoint returns data on the top 20 students with the highest number of
51151
+ * chat messages, with optional filtering by mentor and date range.
51152
+ *
51153
+ * Args:
51154
+ * request: The HTTP request containing filter query parameters.
51155
+ * org: Organization key identifier.
51156
+ * user_id: User identifier (not used in the implementation).
51157
+ *
51158
+ * Returns:
51159
+ * Response: List of top students with their chat message counts.
51160
+ *
51161
+ * Raises:
51162
+ * NotFound: If the specified organization does not exist.
51163
+ * BadRequest: If the provided parameters are invalid.
51164
+ *
51165
+ * Query Parameters:
51166
+ * mentor_id (str): Filter by mentor unique ID.
51167
+ * start_date (str): Start date for filtering (YYYY-MM-DD).
51168
+ * end_date (str): End date for filtering (YYYY-MM-DD).
51169
+ * @returns StudentChatMessage
51170
+ * @throws ApiError
51171
+ */
51172
+ static v1AnalyticsTopUsersByChatMessagesList({
51173
+ groupBy = 'day'
51174
+ }) {
51175
+ return request(OpenAPI, {
51176
+ method: 'GET',
51177
+ url: '/v1/analytics/top-users-by-chat-messages',
51178
+ query: {
51179
+ 'group_by': groupBy
51180
+ },
51181
+ errors: {
51182
+ 400: `Invalid parameters`,
51183
+ 404: `Organization not found`
51184
+ }
51185
+ });
51186
+ }
51187
+ /**
51188
+ * Retrieve aggregated topic statistics
51189
+ * Requires the `iblai-org` and `iblai-user` context headers.
51190
+ *
51191
+ * Retrieve aggregated topic statistics.
51192
+ *
51193
+ * This endpoint returns statistical information about topics within an organization,
51194
+ * including total topics, new topics, and percentage changes compared to the
51195
+ * previous month. Results can be filtered by mentor.
51196
+ *
51197
+ * Args:
51198
+ * request: The HTTP request containing filter query parameters.
51199
+ * org: Organization key identifier.
51200
+ *
51201
+ * Returns:
51202
+ * Response: Statistical information about topics.
51203
+ *
51204
+ * Raises:
51205
+ * NotFound: If the specified organization or mentor does not exist.
51206
+ *
51207
+ * Query Parameters:
51208
+ * mentor_id (str): Filter statistics by mentor unique ID.
51209
+ * @returns TopicStatisticsResponse
51210
+ * @throws ApiError
51211
+ */
51212
+ static v1AnalyticsTopicOverviewRetrieve({
51213
+ mentorId
51214
+ }) {
51215
+ return request(OpenAPI, {
51216
+ method: 'GET',
51217
+ url: '/v1/analytics/topic-overview',
51218
+ query: {
51219
+ 'mentor_id': mentorId
51220
+ },
51221
+ errors: {
51222
+ 404: `Organization or mentor not found`
51223
+ }
51224
+ });
51225
+ }
51226
+ /**
51227
+ * Retrieve paginated statistics about topics
51228
+ * Requires the `iblai-org` and `iblai-user` context headers.
51229
+ *
51230
+ * Retrieve paginated statistics about topics.
51231
+ *
51232
+ * This endpoint returns detailed statistics about topics, including:
51233
+ * - Number of conversations related to each topic
51234
+ * - Total message count for each topic
51235
+ * - Average sentiment of conversations about each topic
51236
+ * - Average user rating for conversations about each topic
51237
+ *
51238
+ * Results can be filtered by mentor and date range, and are paginated.
51239
+ *
51240
+ * Args:
51241
+ * request: The HTTP request containing filter query parameters.
51242
+ * org: Organization key identifier.
51243
+ *
51244
+ * Returns:
51245
+ * Response: Paginated list of topic statistics.
51246
+ *
51247
+ * Raises:
51248
+ * NotFound: If the specified organization or mentor does not exist.
51249
+ * BadRequest: If the provided parameters are invalid.
51250
+ *
51251
+ * Query Parameters:
51252
+ * start_date (str): Start date for filtering (YYYY-MM-DD).
51253
+ * end_date (str): End date for filtering (YYYY-MM-DD).
51254
+ * mentor_id (str): Filter by mentor unique ID.
51255
+ * page (int): Page number for pagination - default: 1.
51256
+ * page_size (int): Number of results per page - default: 20.
51257
+ * @returns PaginatedTopicStatisticsResponse
51258
+ * @throws ApiError
51259
+ */
51260
+ static v1AnalyticsTopicStatisticsRetrieve({
51261
+ endDate,
51262
+ groupBy = 'day',
51263
+ mentorId,
51264
+ startDate,
51265
+ page,
51266
+ pageSize
51267
+ }) {
51268
+ return request(OpenAPI, {
51269
+ method: 'GET',
51270
+ url: '/v1/analytics/topic-statistics',
51271
+ query: {
51272
+ 'end_date': endDate,
51273
+ 'group_by': groupBy,
51274
+ 'mentor_id': mentorId,
51275
+ 'start_date': startDate,
51276
+ 'page': page,
51277
+ 'page_size': pageSize
51278
+ },
51279
+ errors: {
51280
+ 400: `Invalid parameters`,
51281
+ 404: `Organization or mentor not found`
51282
+ }
51283
+ });
51284
+ }
51285
+ /**
51286
+ * Retrieve a summary of the most frequent topics
51287
+ * Requires the `iblai-org` and `iblai-user` context headers.
51288
+ *
51289
+ * Retrieve a summary of the most frequent topics.
51290
+ *
51291
+ * This endpoint returns a summary of the top 10 topics discussed in chat sessions,
51292
+ * ordered by conversation count. Results can be filtered by mentor and date range.
51293
+ *
51294
+ * Args:
51295
+ * request: The HTTP request containing filter query parameters.
51296
+ * org: Organization key identifier.
51297
+ *
51298
+ * Returns:
51299
+ * Response: A list of the top 10 topics with their conversation counts.
51300
+ *
51301
+ * Raises:
51302
+ * NotFound: If the specified organization does not exist.
51303
+ * BadRequest: If the provided date format is invalid.
51304
+ *
51305
+ * Query Parameters:
51306
+ * mentor_id (str): Filter by mentor unique ID.
51307
+ * start_date (str): Start date for filtering (YYYY-MM-DD).
51308
+ * end_date (str): End date for filtering (YYYY-MM-DD).
51309
+ * @returns TopicSummaryView
51310
+ * @throws ApiError
51311
+ */
51312
+ static v1AnalyticsTopicsSummaryList({
51313
+ endDate,
51314
+ startDate
51315
+ }) {
51316
+ return request(OpenAPI, {
51317
+ method: 'GET',
51318
+ url: '/v1/analytics/topics/summary',
51319
+ query: {
51320
+ 'end_date': endDate,
51321
+ 'start_date': startDate
51322
+ },
51323
+ errors: {
51324
+ 400: `Invalid date format`,
51325
+ 404: `Organization not found`
51326
+ }
51327
+ });
51328
+ }
51329
+ /**
51330
+ * Retrieve user cohort trends over time
51331
+ * Requires the `iblai-org` and `iblai-user` context headers.
51332
+ *
51333
+ * Retrieve user cohort trends over time.
51334
+ *
51335
+ * This endpoint returns data on the distribution of new versus veteran users
51336
+ * over time, with options for different time aggregations and filtering by mentor.
51337
+ * New users are those who registered within the specified date range, while
51338
+ * veteran users are those who registered before the date range but were active
51339
+ * during it.
51340
+ *
51341
+ * Args:
51342
+ * request: The HTTP request containing filter query parameters.
51343
+ * org: Organization key identifier.
51344
+ *
51345
+ * Returns:
51346
+ * Response: Time series of new and veteran user counts.
51347
+ *
51348
+ * Raises:
51349
+ * NotFound: If the specified organization does not exist.
51350
+ * BadRequest: If the provided parameters are invalid.
51351
+ *
51352
+ * Query Parameters:
51353
+ * start_date (str): Start date for filtering (YYYY-MM-DD) - required.
51354
+ * end_date (str): End date for filtering (YYYY-MM-DD) - required.
51355
+ * aggregation (str): Time aggregation level (hourly, daily, weekly) - default: daily.
51356
+ * mentor_id (str): Filter by mentor unique ID.
51357
+ * @returns UserTrendByPeriod
51358
+ * @throws ApiError
51359
+ */
51360
+ static v1AnalyticsUserCohortsOverTimeRetrieve({
51361
+ endDate,
51362
+ startDate,
51363
+ aggregation = 'daily',
51364
+ mentorId
51365
+ }) {
51366
+ return request(OpenAPI, {
51367
+ method: 'GET',
51368
+ url: '/v1/analytics/user-cohorts-over-time',
51369
+ query: {
51370
+ 'aggregation': aggregation,
51371
+ 'end_date': endDate,
51372
+ 'mentor_id': mentorId,
51373
+ 'start_date': startDate
51374
+ },
51375
+ errors: {
51376
+ 400: `Invalid parameters`,
51377
+ 404: `Organization not found`
51378
+ }
51379
+ });
51380
+ }
51381
+ /**
51382
+ * Retrieve comprehensive user metrics
51383
+ * Requires the `iblai-org` and `iblai-user` context headers.
51384
+ *
51385
+ * Retrieve comprehensive user metrics.
51386
+ *
51387
+ * This endpoint returns data on various user metrics with month-over-month
51388
+ * change calculations:
51389
+ * - Registered users: Total users registered on the platform
51390
+ * - New users: Users who joined in the current month
51391
+ * - Unique users: Distinct users who have had sessions
51392
+ * - Veteran users: Users who have been active for at least 6 months
51393
+ *
51394
+ * Results can be filtered by mentor.
51395
+ *
51396
+ * Args:
51397
+ * request: The HTTP request containing filter query parameters.
51398
+ * org: Organization key identifier.
51399
+ *
51400
+ * Returns:
51401
+ * Response: Comprehensive user metrics with month-over-month changes.
51402
+ *
51403
+ * Raises:
51404
+ * NotFound: If the specified organization does not exist.
51405
+ *
51406
+ * Query Parameters:
51407
+ * mentor_id (str): Filter metrics by mentor unique ID.
51408
+ * @returns UserMetricsResponse
51409
+ * @throws ApiError
51410
+ */
51411
+ static v1AnalyticsUserMetricsRetrieve({
51412
+ groupBy = 'day',
51413
+ mentorId
51414
+ }) {
51415
+ return request(OpenAPI, {
51416
+ method: 'GET',
51417
+ url: '/v1/analytics/user-metrics',
51418
+ query: {
51419
+ 'group_by': groupBy,
51420
+ 'mentor_id': mentorId
51421
+ },
51422
+ errors: {
51423
+ 404: `Organization not found`
51424
+ }
51425
+ });
51426
+ }
51427
+ /**
51428
+ * Retrieve user distribution data for pie charts
51429
+ * Requires the `iblai-org` and `iblai-user` context headers.
51430
+ *
51431
+ * Retrieve user distribution data for pie charts.
51432
+ *
51433
+ * This endpoint returns data on the distribution of new versus returning users
51434
+ * within a specified date range, including both counts and percentages,
51435
+ * suitable for pie chart visualization.
51436
+ *
51437
+ * Args:
51438
+ * request: The HTTP request containing filter query parameters.
51439
+ * org: Organization key identifier.
51440
+ *
51441
+ * Returns:
51442
+ * Response: Distribution of new versus returning users with counts and percentages.
51443
+ *
51444
+ * Raises:
51445
+ * NotFound: If the specified organization does not exist.
51446
+ * BadRequest: If the provided parameters are invalid.
51447
+ *
51448
+ * Query Parameters:
51449
+ * start_date (str): Start date for filtering (YYYY-MM-DD) - required.
51450
+ * end_date (str): End date for filtering (YYYY-MM-DD) - required.
51451
+ * mentor_id (str): Filter by mentor unique ID.
51452
+ * @returns PieChartData
51453
+ * @throws ApiError
51454
+ */
51455
+ static v1AnalyticsUserMetricsPieChartRetrieve({
51456
+ endDate,
51457
+ startDate,
51458
+ mentorId
51459
+ }) {
51460
+ return request(OpenAPI, {
51461
+ method: 'GET',
51462
+ url: '/v1/analytics/user-metrics-pie-chart',
51463
+ query: {
51464
+ 'end_date': endDate,
51465
+ 'mentor_id': mentorId,
51466
+ 'start_date': startDate
51467
+ },
51468
+ errors: {
51469
+ 400: `Invalid parameters`,
51470
+ 404: `Organization not found`
51471
+ }
51472
+ });
51473
+ }
51474
+ }
51475
+
50095
51476
  class V1AuditLogsService {
50096
51477
  /**
50097
51478
  * List platform audit logs
@@ -51874,6 +53255,7 @@ exports.ScimService = ScimService;
51874
53255
  exports.SearchService = SearchService;
51875
53256
  exports.SkillsService = SkillsService;
51876
53257
  exports.V1AgentsService = V1AgentsService;
53258
+ exports.V1AnalyticsService = V1AnalyticsService;
51877
53259
  exports.V1AuditLogsService = V1AuditLogsService;
51878
53260
  exports.V1ChannelsService = V1ChannelsService;
51879
53261
  exports.V1ChatService = V1ChatService;