featurebase-node 0.14.0 → 0.14.2

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.d.mts +12 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +12 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +21 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +21 -1
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/audit-logs.d.mts +233 -0
  12. package/resources/audit-logs.d.mts.map +1 -0
  13. package/resources/audit-logs.d.ts +233 -0
  14. package/resources/audit-logs.d.ts.map +1 -0
  15. package/resources/audit-logs.js +122 -0
  16. package/resources/audit-logs.js.map +1 -0
  17. package/resources/audit-logs.mjs +118 -0
  18. package/resources/audit-logs.mjs.map +1 -0
  19. package/resources/help-center/articles.d.mts +248 -11
  20. package/resources/help-center/articles.d.mts.map +1 -1
  21. package/resources/help-center/articles.d.ts +248 -11
  22. package/resources/help-center/articles.d.ts.map +1 -1
  23. package/resources/help-center/articles.js +78 -0
  24. package/resources/help-center/articles.js.map +1 -1
  25. package/resources/help-center/articles.mjs +78 -0
  26. package/resources/help-center/articles.mjs.map +1 -1
  27. package/resources/help-center/help-center.d.mts +2 -2
  28. package/resources/help-center/help-center.d.mts.map +1 -1
  29. package/resources/help-center/help-center.d.ts +2 -2
  30. package/resources/help-center/help-center.d.ts.map +1 -1
  31. package/resources/help-center/help-center.js.map +1 -1
  32. package/resources/help-center/help-center.mjs.map +1 -1
  33. package/resources/help-center/index.d.mts +1 -1
  34. package/resources/help-center/index.d.mts.map +1 -1
  35. package/resources/help-center/index.d.ts +1 -1
  36. package/resources/help-center/index.d.ts.map +1 -1
  37. package/resources/help-center/index.js.map +1 -1
  38. package/resources/help-center/index.mjs.map +1 -1
  39. package/resources/index.d.mts +2 -0
  40. package/resources/index.d.mts.map +1 -1
  41. package/resources/index.d.ts +2 -0
  42. package/resources/index.d.ts.map +1 -1
  43. package/resources/index.js +5 -1
  44. package/resources/index.js.map +1 -1
  45. package/resources/index.mjs +2 -0
  46. package/resources/index.mjs.map +1 -1
  47. package/resources/organization/admins.d.mts +10 -0
  48. package/resources/organization/admins.d.mts.map +1 -1
  49. package/resources/organization/admins.d.ts +10 -0
  50. package/resources/organization/admins.d.ts.map +1 -1
  51. package/resources/organization/admins.js +2 -0
  52. package/resources/organization/admins.js.map +1 -1
  53. package/resources/organization/admins.mjs +2 -0
  54. package/resources/organization/admins.mjs.map +1 -1
  55. package/resources/reports.d.mts +720 -0
  56. package/resources/reports.d.mts.map +1 -0
  57. package/resources/reports.d.ts +720 -0
  58. package/resources/reports.d.ts.map +1 -0
  59. package/resources/reports.js +241 -0
  60. package/resources/reports.js.map +1 -0
  61. package/resources/reports.mjs +237 -0
  62. package/resources/reports.mjs.map +1 -0
  63. package/resources/users/contacts/contacts.d.mts +2 -2
  64. package/resources/users/contacts/contacts.d.ts +2 -2
  65. package/resources/users/contacts/contacts.js +1 -1
  66. package/resources/users/contacts/contacts.mjs +1 -1
  67. package/resources/webhooks.d.mts +5 -3
  68. package/resources/webhooks.d.mts.map +1 -1
  69. package/resources/webhooks.d.ts +5 -3
  70. package/resources/webhooks.d.ts.map +1 -1
  71. package/resources/webhooks.js +2 -0
  72. package/resources/webhooks.js.map +1 -1
  73. package/resources/webhooks.mjs +2 -0
  74. package/resources/webhooks.mjs.map +1 -1
  75. package/src/client.ts +73 -1
  76. package/src/resources/audit-logs.ts +609 -0
  77. package/src/resources/help-center/articles.ts +380 -10
  78. package/src/resources/help-center/help-center.ts +8 -0
  79. package/src/resources/help-center/index.ts +4 -0
  80. package/src/resources/index.ts +26 -0
  81. package/src/resources/organization/admins.ts +12 -0
  82. package/src/resources/reports.ts +1025 -0
  83. package/src/resources/users/contacts/contacts.ts +2 -2
  84. package/src/resources/webhooks.ts +5 -0
  85. package/src/version.ts +1 -1
  86. package/version.d.mts +1 -1
  87. package/version.d.ts +1 -1
  88. package/version.js +1 -1
  89. package/version.mjs +1 -1
@@ -0,0 +1,720 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import * as ReportsAPI from "./reports.js";
3
+ import { APIPromise } from "../core/api-promise.js";
4
+ import { RequestOptions } from "../internal/request-options.js";
5
+ /**
6
+ * Query your workspace analytics: conversation volume, response times, CSAT, SLA compliance, teammate performance, AI agent resolutions and more. Start with the datasets catalog to discover metrics and attributes, then run queries with filters, grouping and period comparison.
7
+ */
8
+ export declare class Reports extends APIResource {
9
+ /**
10
+ * Returns the reporting catalog: every dataset available to your workspace with
11
+ * its metrics and attributes.
12
+ *
13
+ * This is the discovery endpoint for the reporting API — read it before building
14
+ * query payloads:
15
+ *
16
+ * - **Metrics** carry the `metric` IDs accepted by `POST /v2/reports/query`, plus
17
+ * each metric's `allowedAggregations`, unit, and whether it supports
18
+ * office-hours restriction and period comparison.
19
+ * - **Attributes** carry the `fieldId`s accepted in filter rules and the attribute
20
+ * IDs accepted as `groupBy` / `segmentBy`, plus each attribute's
21
+ * `allowedOperators` and value type. Attributes with `staticOptions` list their
22
+ * full value set inline; other filterable attributes resolve values via
23
+ * `POST /v2/reports/filter-values`.
24
+ *
25
+ * The catalog includes your workspace's custom conversation/ticket attributes
26
+ * where applicable, so it can differ between workspaces.
27
+ *
28
+ * ### Version Availability
29
+ *
30
+ * This endpoint is only available in API version 2026-01-01.nova and newer, and
31
+ * only for workspaces with the Reports product enabled (404 otherwise).
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const response = await client.reports.listDatasets();
36
+ * ```
37
+ */
38
+ listDatasets(params?: ReportListDatasetsParams | null | undefined, options?: RequestOptions): APIPromise<ReportListDatasetsResponse>;
39
+ /**
40
+ * Executes an ad-hoc reporting query: one metric + aggregation over a date range,
41
+ * with optional filters, grouping, segmentation and period-over-period comparison.
42
+ *
43
+ * ### Building a query
44
+ *
45
+ * 1. Pick a `metric` and `aggregation` from the datasets catalog
46
+ * (`GET /v2/reports/datasets`). Counts use `count`; duration metrics support
47
+ * `sum`, `avg`, `median`, `min`, `max`, `range` and `percentile` (pass
48
+ * `percentile: 95` for p95); rate metrics use `value`.
49
+ * 2. Set the reporting window with `startDate` / `endDate` (ISO 8601) and a
50
+ * `granularity` (`hour`, `day`, `week`, `month`) for the returned time series.
51
+ * Reporting data is available from **July 12, 2026**. Windows ending earlier
52
+ * are rejected; crossing windows are clamped to that boundary in the requested
53
+ * timezone.
54
+ * 3. Optionally narrow with `filters` — a rule
55
+ * (`{ "kind": "rule", "fieldId": "...", "operator": "in", "value": [...] }`) or
56
+ * an `and`/`or` group of rules. Attribute IDs and allowed operators come from
57
+ * the catalog.
58
+ * 4. Optionally break results down with `groupBy` (primary dimension) and
59
+ * `segmentBy` (secondary dimension).
60
+ * 5. Optionally pass `compareStartDate` / `compareEndDate` to get `previousValue`
61
+ * / `deltaPercent` alongside every data point.
62
+ *
63
+ * ### Example
64
+ *
65
+ * ```json
66
+ * {
67
+ * "metric": "new_conversations",
68
+ * "aggregation": "count",
69
+ * "startDate": "2026-07-12",
70
+ * "endDate": "2026-07-15",
71
+ * "granularity": "day",
72
+ * "groupBy": "conversation.channel",
73
+ * "filters": {
74
+ * "kind": "rule",
75
+ * "fieldId": "conversation.state",
76
+ * "operator": "is",
77
+ * "value": "closed"
78
+ * }
79
+ * }
80
+ * ```
81
+ *
82
+ * ### Response shape
83
+ *
84
+ * - `value` — the aggregate across the whole window
85
+ * - `timeSeries` — one datum per granularity bucket
86
+ * - `groupedData` / `segmentData` — present when `groupBy` / `segmentBy` were
87
+ * requested
88
+ * - `flowData` — present for `view: "sankey"` (Overview conversation-flow metrics)
89
+ * - `meta` — echo of the resolved metric, dataset, unit and aggregation
90
+ *
91
+ * ### Special views
92
+ *
93
+ * - `view: "hourly_heatmap"` buckets by day-of-week × hour-of-day (use with volume
94
+ * metrics)
95
+ * - `view: "sankey"` returns conversation flow edges (Overview metrics only)
96
+ *
97
+ * ### Version Availability
98
+ *
99
+ * This endpoint is only available in API version 2026-01-01.nova and newer, and
100
+ * only for workspaces with the Reports product enabled (404 otherwise).
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const response = await client.reports.query({
105
+ * aggregation: 'count',
106
+ * endDate: '2026-07-15',
107
+ * granularity: 'day',
108
+ * metric: 'new_conversations',
109
+ * startDate: '2026-07-12',
110
+ * });
111
+ * ```
112
+ */
113
+ query(params: ReportQueryParams, options?: RequestOptions): APIPromise<ReportQueryResponse>;
114
+ /**
115
+ * Returns the available values for a filterable attribute — use it to build valid
116
+ * `filters` rules for `POST /v2/reports/query`.
117
+ *
118
+ * Works for attributes whose values live in your workspace data (tags, teammates,
119
+ * teams, companies, plans, countries, ...). Attributes with `staticOptions` in the
120
+ * catalog don't need this endpoint — their value set is already inline.
121
+ *
122
+ * - `query` narrows results by search string
123
+ * - `selectedValues` resolves labels for values you already hold (returned
124
+ * alongside search results)
125
+ *
126
+ * ### Example
127
+ *
128
+ * ```json
129
+ * { "fieldId": "conversation.tags", "query": "bill", "limit": 20 }
130
+ * ```
131
+ *
132
+ * ### Version Availability
133
+ *
134
+ * This endpoint is only available in API version 2026-01-01.nova and newer, and
135
+ * only for workspaces with the Reports product enabled (404 otherwise).
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * const response = await client.reports.lookupFilterValues({
140
+ * fieldId: 'conversation.tags',
141
+ * });
142
+ * ```
143
+ */
144
+ lookupFilterValues(params: ReportLookupFilterValuesParams, options?: RequestOptions): APIPromise<ReportLookupFilterValuesResponse>;
145
+ /**
146
+ * Returns the paginated row-level records behind a metric — either the whole
147
+ * reporting window, or one specific data point from a previous
148
+ * `POST /v2/reports/query` response.
149
+ *
150
+ * Send the **same** `metric`, date range, `granularity`, `filters`, `groupBy` /
151
+ * `segmentBy` and `view` as the query you're drilling into, plus
152
+ * `dataPointFilters` selecting the data point:
153
+ *
154
+ * - `timeBucket` — a `date` from the time series
155
+ * - `groupValue` / `segmentValue` — a `group` / `segment` value from grouped data
156
+ * - `dayOfWeek` + `hourOfDay` — a heatmap cell (`hourly_heatmap` view)
157
+ * - `flowPathId` or `sourceNodeId` + `targetNodeId` — a flow edge (`sankey` view)
158
+ *
159
+ * Pass `dataPointFilters: {}` to list all rows behind the metric for the window.
160
+ *
161
+ * Results are paginated with `page` / `pageSize` (max 200 per page);
162
+ * `availableColumns` describes every column the dataset can return and
163
+ * `defaultColumnIds` the recommended subset. Rows are keyed by column ID; identity
164
+ * cells (teammates, contacts) are objects with `id` + `label`.
165
+ *
166
+ * ### Version Availability
167
+ *
168
+ * This endpoint is only available in API version 2026-01-01.nova and newer, and
169
+ * only for workspaces with the Reports product enabled (404 otherwise).
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * const response = await client.reports.drillIn({
174
+ * endDate: 'xxxxxxxxxx',
175
+ * granularity: 'day',
176
+ * metric: 'new_conversations',
177
+ * startDate: 'xxxxxxxxxx',
178
+ * });
179
+ * ```
180
+ */
181
+ drillIn(params: ReportDrillInParams, options?: RequestOptions): APIPromise<ReportDrillInResponse>;
182
+ }
183
+ export interface ReportAttribute {
184
+ /**
185
+ * Attribute ID — use as `fieldId` in filter rules and as `groupBy` / `segmentBy`
186
+ * in query requests.
187
+ */
188
+ id: string;
189
+ allowedOperators: Array<'is' | 'is_not' | 'in' | 'not_in' | 'contains' | 'not_contains' | 'gte' | 'lte' | 'between' | 'exists' | 'not_exists' | 'is_member_of' | 'is_not_member_of'>;
190
+ category: string;
191
+ description: string;
192
+ name: string;
193
+ /**
194
+ * Whether the filter uses the latest mutable state, an immutable historical
195
+ * action/snapshot, or a metric-dependent mapping.
196
+ */
197
+ semantics: 'current_state' | 'historical_action' | 'historical_snapshot' | 'dynamic_metric_mapped';
198
+ /**
199
+ * Whether the attribute can be used in `filters` rules.
200
+ */
201
+ supportsFilter: boolean;
202
+ /**
203
+ * Whether the attribute can be used as `groupBy` / `segmentBy`.
204
+ */
205
+ supportsGroupBy: boolean;
206
+ /**
207
+ * Whether `POST /v2/reports/filter-values` can list this attribute's values.
208
+ */
209
+ supportsValueLookup: boolean;
210
+ valueType: 'string' | 'number' | 'boolean' | 'date' | 'enum' | 'id';
211
+ multiValue?: boolean;
212
+ /**
213
+ * Fixed value set for enum-like attributes. Attributes without static options
214
+ * resolve values via `POST /v2/reports/filter-values`.
215
+ */
216
+ staticOptions?: Array<ReportAttributeOption>;
217
+ }
218
+ export interface ReportAttributeOption {
219
+ label: string;
220
+ value: string;
221
+ }
222
+ export interface ReportDataset {
223
+ id: string;
224
+ attributes: Array<ReportAttribute>;
225
+ description: string;
226
+ metrics: Array<ReportMetric>;
227
+ name: string;
228
+ }
229
+ export interface ReportFilterExpression {
230
+ /**
231
+ * Rules and/or nested groups of rules. Groups may nest up to 6 levels at runtime;
232
+ * 100 rules max per expression.
233
+ */
234
+ children: Array<ReportFilterRule | ReportFilterExpression.ReportFilterGroup>;
235
+ kind: 'group';
236
+ /**
237
+ * Group operator: `and` (all match) or `or` (any match).
238
+ */
239
+ op: 'and' | 'or';
240
+ }
241
+ export declare namespace ReportFilterExpression {
242
+ interface ReportFilterGroup {
243
+ children: Array<ReportsAPI.ReportFilterRule>;
244
+ kind: 'group';
245
+ /**
246
+ * Group operator: `and` (all match) or `or` (any match).
247
+ */
248
+ op: 'and' | 'or';
249
+ }
250
+ }
251
+ export interface ReportFilterRule {
252
+ /**
253
+ * Attribute ID to filter on (e.g. `conversation.channel`). Discover attribute IDs
254
+ * via `GET /v2/reports/datasets`.
255
+ */
256
+ fieldId: string;
257
+ kind: 'rule';
258
+ /**
259
+ * Comparison operator. Each attribute supports a subset of operators — see the
260
+ * `allowedOperators` field in the `GET /v2/reports/datasets` catalog.
261
+ */
262
+ operator: 'is' | 'is_not' | 'in' | 'not_in' | 'contains' | 'not_contains' | 'gte' | 'lte' | 'between' | 'exists' | 'not_exists' | 'is_member_of' | 'is_not_member_of';
263
+ /**
264
+ * Value to compare against. Scalar for `is`, `is_not`, `contains`, `not_contains`,
265
+ * `gte`, `lte` (ISO date strings for date attributes); non-empty array for `in`,
266
+ * `not_in`, `is_member_of`, `is_not_member_of`; 2-element array for `between`;
267
+ * omit for `exists` / `not_exists`.
268
+ */
269
+ value?: string | number | boolean | Array<string | number | boolean>;
270
+ }
271
+ export interface ReportGroupedDatum {
272
+ /**
273
+ * Raw group value (e.g. an ID). Use `groupLabel` for display.
274
+ */
275
+ group: string;
276
+ value: number;
277
+ groupLabel?: string;
278
+ previousValue?: number;
279
+ segments?: Array<ReportSegmentDatum>;
280
+ }
281
+ export interface ReportMetric {
282
+ /**
283
+ * Metric ID — use as `metric` in query requests.
284
+ */
285
+ id: string;
286
+ allowedAggregations: Array<'count' | 'sum' | 'avg' | 'median' | 'min' | 'max' | 'range' | 'percentile' | 'value'>;
287
+ description: string;
288
+ name: string;
289
+ /**
290
+ * Attribute IDs this specific metric accepts in filter expressions.
291
+ */
292
+ supportedFilterAttributeIds: Array<string>;
293
+ /**
294
+ * Attribute IDs this specific metric accepts as `groupBy` or `segmentBy`.
295
+ */
296
+ supportedGroupByDimensions: Array<string>;
297
+ /**
298
+ * Which `view` values `POST /v2/reports/query` accepts for this metric. Most
299
+ * metrics support `standard` and `hourly_heatmap`; conversation-flow metrics are
300
+ * `sankey`-only.
301
+ */
302
+ supportedViews: Array<'standard' | 'hourly_heatmap' | 'sankey'>;
303
+ supportsOfficeHours: boolean;
304
+ supportsPeriodComparison: boolean;
305
+ type: 'count' | 'percentage' | 'duration' | 'number';
306
+ unit: 'count' | 'percentage' | 'duration_ms' | 'number';
307
+ }
308
+ export interface ReportSegmentDatum {
309
+ segment: string;
310
+ value: number;
311
+ previousValue?: number;
312
+ segmentLabel?: string;
313
+ }
314
+ export interface ReportTimeSeriesDatum {
315
+ /**
316
+ * Time bucket start (ISO 8601).
317
+ */
318
+ date: string;
319
+ value: number;
320
+ /**
321
+ * Value for the same bucket in the comparison window, when requested.
322
+ */
323
+ previousValue?: number;
324
+ segments?: Array<ReportSegmentDatum>;
325
+ }
326
+ export interface ReportDrillInResponse {
327
+ availableColumns: Array<ReportDrillInResponse.AvailableColumn>;
328
+ defaultColumnIds: Array<string>;
329
+ meta: ReportDrillInResponse.Meta;
330
+ object: 'report_drill_in_result';
331
+ page: number;
332
+ pageSize: number;
333
+ /**
334
+ * One record per underlying row, keyed by column ID.
335
+ */
336
+ rows: Array<{
337
+ [key: string]: string | number | boolean | Array<string> | ReportDrillInResponse.ReportDrillInIdentityCell | null;
338
+ }>;
339
+ timezone: string;
340
+ total: number;
341
+ }
342
+ export declare namespace ReportDrillInResponse {
343
+ interface AvailableColumn {
344
+ /**
345
+ * Column ID (an attribute ID or `metric.value`).
346
+ */
347
+ id: string;
348
+ name: string;
349
+ valueType: string;
350
+ category?: string;
351
+ }
352
+ interface Meta {
353
+ datasetId: string;
354
+ metricId: string;
355
+ }
356
+ interface ReportDrillInIdentityCell {
357
+ id: string;
358
+ kind: 'identity';
359
+ label: string;
360
+ avatarUrl?: string;
361
+ color?: string;
362
+ }
363
+ }
364
+ export interface ReportListDatasetsResponse {
365
+ data: Array<ReportDataset>;
366
+ object: 'list';
367
+ }
368
+ export interface ReportLookupFilterValuesResponse {
369
+ data: Array<ReportAttributeOption>;
370
+ object: 'list';
371
+ }
372
+ export interface ReportQueryResponse {
373
+ meta: ReportQueryResponse.Meta;
374
+ object: 'report_query_result';
375
+ /**
376
+ * Aggregated value across the whole reporting window.
377
+ */
378
+ value: number;
379
+ /**
380
+ * Percentage change vs the comparison window.
381
+ */
382
+ deltaPercent?: number;
383
+ flowData?: Array<ReportQueryResponse.FlowData>;
384
+ groupedData?: Array<ReportGroupedDatum>;
385
+ /**
386
+ * Aggregated value for the comparison window, when requested.
387
+ */
388
+ previousValue?: number;
389
+ segmentData?: Array<ReportSegmentDatum>;
390
+ table?: ReportQueryResponse.Table;
391
+ timeSeries?: Array<ReportTimeSeriesDatum>;
392
+ }
393
+ export declare namespace ReportQueryResponse {
394
+ interface Meta {
395
+ /**
396
+ * Aggregation function applied to the metric. Each metric supports a subset of
397
+ * aggregations — see the `allowedAggregations` field in the
398
+ * `GET /v2/reports/datasets` catalog.
399
+ */
400
+ aggregation: 'count' | 'sum' | 'avg' | 'median' | 'min' | 'max' | 'range' | 'percentile' | 'value';
401
+ datasetId: string;
402
+ granularity: string;
403
+ metric: string;
404
+ officeHoursOnly: boolean;
405
+ unit: 'count' | 'percentage' | 'duration_ms' | 'number';
406
+ groupBy?: string;
407
+ segmentBy?: string;
408
+ }
409
+ interface FlowData {
410
+ metricId: string;
411
+ pathId: string;
412
+ source: string;
413
+ sourceLabel: string;
414
+ target: string;
415
+ targetLabel: string;
416
+ value: number;
417
+ colorKey?: string;
418
+ percentage?: number;
419
+ sortOrder?: number;
420
+ }
421
+ interface Table {
422
+ columns: Array<Table.Column>;
423
+ key: string;
424
+ mode: 'aggregate' | 'records';
425
+ page: number;
426
+ pageSize: number;
427
+ rows: Array<Table.Row>;
428
+ totalRows: number;
429
+ sort?: Table.Sort;
430
+ summaryRows?: Array<Table.SummaryRow>;
431
+ }
432
+ namespace Table {
433
+ interface Column {
434
+ id: string;
435
+ kind: 'dimension' | 'metric' | 'record_attribute';
436
+ label: string;
437
+ sortable: boolean;
438
+ unit: 'count' | 'percentage' | 'duration_ms' | 'number' | 'text' | 'datetime';
439
+ align?: 'left' | 'right';
440
+ sticky?: boolean;
441
+ summary?: 'sum' | 'weighted_rate' | 'none';
442
+ valueType?: string;
443
+ }
444
+ interface Row {
445
+ id: string;
446
+ cells: {
447
+ [key: string]: Row.Cells;
448
+ };
449
+ }
450
+ namespace Row {
451
+ interface Cells {
452
+ display: string;
453
+ denominator?: number;
454
+ numerator?: number;
455
+ raw?: unknown;
456
+ sortValue?: string | number | null;
457
+ value?: unknown;
458
+ }
459
+ }
460
+ interface Sort {
461
+ columnId: string;
462
+ direction: 'asc' | 'desc';
463
+ }
464
+ interface SummaryRow {
465
+ id: string;
466
+ cells: {
467
+ [key: string]: SummaryRow.Cells;
468
+ };
469
+ }
470
+ namespace SummaryRow {
471
+ interface Cells {
472
+ display: string;
473
+ denominator?: number;
474
+ numerator?: number;
475
+ raw?: unknown;
476
+ sortValue?: string | number | null;
477
+ value?: unknown;
478
+ }
479
+ }
480
+ }
481
+ }
482
+ export interface ReportListDatasetsParams {
483
+ /**
484
+ * API version for this request. Defaults to your organization's configured API
485
+ * version if not specified.
486
+ */
487
+ 'Featurebase-Version'?: '2026-01-01.nova' | '2025-12-12.clover';
488
+ }
489
+ export interface ReportQueryParams {
490
+ /**
491
+ * Body param: Aggregation function applied to the metric. Each metric supports a
492
+ * subset of aggregations — see the `allowedAggregations` field in the
493
+ * `GET /v2/reports/datasets` catalog.
494
+ */
495
+ aggregation: 'count' | 'sum' | 'avg' | 'median' | 'min' | 'max' | 'range' | 'percentile' | 'value';
496
+ /**
497
+ * Body param: End of the reporting window (ISO 8601 date or datetime, inclusive).
498
+ * Windows ending before 2026-07-12 are rejected.
499
+ */
500
+ endDate: string;
501
+ /**
502
+ * Body param: Time bucket size for the returned time series.
503
+ */
504
+ granularity: 'hour' | 'day' | 'week' | 'month';
505
+ /**
506
+ * Body param: Metric ID to query (e.g. `new_conversations`). Discover metric IDs
507
+ * via `GET /v2/reports/datasets`.
508
+ */
509
+ metric: string;
510
+ /**
511
+ * Body param: Start of the reporting window (ISO 8601 date or datetime,
512
+ * inclusive). Reporting data is available from 2026-07-12; crossing windows are
513
+ * clamped to that boundary.
514
+ */
515
+ startDate: string;
516
+ /**
517
+ * Body param: End of the comparison window. Must be paired with
518
+ * `compareStartDate`.
519
+ */
520
+ compareEndDate?: string;
521
+ /**
522
+ * Body param: Start of the comparison window for period-over-period deltas. Must
523
+ * be paired with `compareEndDate`.
524
+ */
525
+ compareStartDate?: string;
526
+ /**
527
+ * Body param: Filter expression: a single rule, or an `and`/`or` group combining
528
+ * rules and nested groups. Attribute IDs and their allowed operators come from
529
+ * `GET /v2/reports/datasets`.
530
+ */
531
+ filters?: ReportFilterRule | ReportFilterExpression;
532
+ /**
533
+ * Body param: Attribute ID to group results by (e.g. `conversation.channel`). See
534
+ * `supportsGroupBy` in the catalog.
535
+ */
536
+ groupBy?: string;
537
+ /**
538
+ * Body param: Restrict time-based metrics to configured office hours. Only
539
+ * supported by some metrics (see `supportsOfficeHours` in the catalog).
540
+ */
541
+ officeHoursOnly?: boolean;
542
+ /**
543
+ * Body param: Percentile (1-100) — required when `aggregation` is `percentile`.
544
+ */
545
+ percentile?: number;
546
+ /**
547
+ * Body param: Attribute ID for secondary segmentation within each group or time
548
+ * bucket.
549
+ */
550
+ segmentBy?: string;
551
+ /**
552
+ * Body param: IANA timezone for date bucketing (e.g. `America/New_York`). Defaults
553
+ * to UTC.
554
+ */
555
+ timezone?: string;
556
+ /**
557
+ * Body param: Result shape. `standard` returns a time series (plus grouped/segment
558
+ * data when requested), `hourly_heatmap` buckets by day-of-week × hour-of-day,
559
+ * `sankey` returns conversation flow data. Each metric lists its `supportedViews`
560
+ * in the `GET /v2/reports/datasets` catalog.
561
+ */
562
+ view?: 'standard' | 'hourly_heatmap' | 'sankey';
563
+ /**
564
+ * Header param: API version for this request. Defaults to your organization's
565
+ * configured API version if not specified.
566
+ */
567
+ 'Featurebase-Version'?: '2026-01-01.nova' | '2025-12-12.clover';
568
+ }
569
+ export interface ReportLookupFilterValuesParams {
570
+ /**
571
+ * Body param: Attribute ID to look up values for (must have
572
+ * `valueSource: "remote_search"` or static options in the catalog).
573
+ */
574
+ fieldId: string;
575
+ /**
576
+ * Body param: Maximum number of options to return (1-50, default 20).
577
+ */
578
+ limit?: number;
579
+ /**
580
+ * Body param: Optional search string to narrow the returned options.
581
+ */
582
+ query?: string;
583
+ /**
584
+ * Body param: Already-selected values to resolve labels for (returned alongside
585
+ * search results).
586
+ */
587
+ selectedValues?: Array<string>;
588
+ /**
589
+ * Header param: API version for this request. Defaults to your organization's
590
+ * configured API version if not specified.
591
+ */
592
+ 'Featurebase-Version'?: '2026-01-01.nova' | '2025-12-12.clover';
593
+ }
594
+ export interface ReportDrillInParams {
595
+ /**
596
+ * Body param
597
+ */
598
+ endDate: string;
599
+ /**
600
+ * Body param: Time bucket size for the returned time series.
601
+ */
602
+ granularity: 'hour' | 'day' | 'week' | 'month';
603
+ /**
604
+ * Body param: Metric ID the drill-in belongs to.
605
+ */
606
+ metric: string;
607
+ /**
608
+ * Body param
609
+ */
610
+ startDate: string;
611
+ /**
612
+ * Body param: Narrows the drill-in to one data point from a previous query (time
613
+ * bucket, group value, heatmap cell, or flow edge). Pass `{}` to list all
614
+ * underlying rows.
615
+ */
616
+ dataPointFilters?: ReportDrillInParams.DataPointFilters;
617
+ /**
618
+ * Body param: Filter expression: a single rule, or an `and`/`or` group combining
619
+ * rules and nested groups. Attribute IDs and their allowed operators come from
620
+ * `GET /v2/reports/datasets`.
621
+ */
622
+ filters?: ReportFilterRule | ReportFilterExpression;
623
+ /**
624
+ * Body param
625
+ */
626
+ groupBy?: string;
627
+ /**
628
+ * Body param
629
+ */
630
+ officeHoursOnly?: boolean;
631
+ /**
632
+ * Body param: Page number (1-based).
633
+ */
634
+ page?: number;
635
+ /**
636
+ * Body param: Rows per page (1-200, default 25).
637
+ */
638
+ pageSize?: number;
639
+ /**
640
+ * Body param
641
+ */
642
+ segmentBy?: string;
643
+ /**
644
+ * Body param: A metric ID from the datasets catalog. Use when the originating
645
+ * chart aggregates several metrics to pick which one the drill-in follows.
646
+ * Defaults to `metric`.
647
+ */
648
+ selectedMetricId?: string;
649
+ /**
650
+ * Body param
651
+ */
652
+ sort?: Array<ReportDrillInParams.Sort>;
653
+ /**
654
+ * Body param
655
+ */
656
+ timezone?: string;
657
+ /**
658
+ * Body param: Result shape. `standard` returns a time series (plus grouped/segment
659
+ * data when requested), `hourly_heatmap` buckets by day-of-week × hour-of-day,
660
+ * `sankey` returns conversation flow data. Each metric lists its `supportedViews`
661
+ * in the `GET /v2/reports/datasets` catalog.
662
+ */
663
+ view?: 'standard' | 'hourly_heatmap' | 'sankey';
664
+ /**
665
+ * Header param: API version for this request. Defaults to your organization's
666
+ * configured API version if not specified.
667
+ */
668
+ 'Featurebase-Version'?: '2026-01-01.nova' | '2025-12-12.clover';
669
+ }
670
+ export declare namespace ReportDrillInParams {
671
+ /**
672
+ * Narrows the drill-in to one data point from a previous query (time bucket, group
673
+ * value, heatmap cell, or flow edge). Pass `{}` to list all underlying rows.
674
+ */
675
+ interface DataPointFilters {
676
+ /**
677
+ * Day of week (1 = Monday … 7 = Sunday) — for `hourly_heatmap` views.
678
+ */
679
+ dayOfWeek?: number;
680
+ /**
681
+ * Flow path ID — for `sankey` views.
682
+ */
683
+ flowPathId?: string;
684
+ /**
685
+ * Group value to drill into (a `group` value from `groupedData`).
686
+ */
687
+ groupValue?: string;
688
+ /**
689
+ * Hour of day (0-23) — for `hourly_heatmap` views.
690
+ */
691
+ hourOfDay?: number;
692
+ /**
693
+ * Segment value to drill into (a `segment` value from segment data).
694
+ */
695
+ segmentValue?: string;
696
+ /**
697
+ * Flow source node ID — for `sankey` views.
698
+ */
699
+ sourceNodeId?: string;
700
+ /**
701
+ * Flow target node ID — for `sankey` views.
702
+ */
703
+ targetNodeId?: string;
704
+ /**
705
+ * Time bucket to drill into (a `date` value from the query time series).
706
+ */
707
+ timeBucket?: string;
708
+ }
709
+ interface Sort {
710
+ direction: 'asc' | 'desc';
711
+ /**
712
+ * Column ID to sort by (an attribute ID or `metric.value`).
713
+ */
714
+ fieldId: string;
715
+ }
716
+ }
717
+ export declare namespace Reports {
718
+ export { type ReportAttribute as ReportAttribute, type ReportAttributeOption as ReportAttributeOption, type ReportDataset as ReportDataset, type ReportFilterExpression as ReportFilterExpression, type ReportFilterRule as ReportFilterRule, type ReportGroupedDatum as ReportGroupedDatum, type ReportMetric as ReportMetric, type ReportSegmentDatum as ReportSegmentDatum, type ReportTimeSeriesDatum as ReportTimeSeriesDatum, type ReportDrillInResponse as ReportDrillInResponse, type ReportListDatasetsResponse as ReportListDatasetsResponse, type ReportLookupFilterValuesResponse as ReportLookupFilterValuesResponse, type ReportQueryResponse as ReportQueryResponse, type ReportListDatasetsParams as ReportListDatasetsParams, type ReportQueryParams as ReportQueryParams, type ReportLookupFilterValuesParams as ReportLookupFilterValuesParams, type ReportDrillInParams as ReportDrillInParams, };
719
+ }
720
+ //# sourceMappingURL=reports.d.ts.map