@oursprivacy/platform-sdk 1.56.0 → 1.58.0

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 (180) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +15 -6
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +15 -6
  5. package/client.d.ts.map +1 -1
  6. package/client.js +9 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +9 -0
  9. package/client.mjs.map +1 -1
  10. package/internal/utils/log.d.mts.map +1 -1
  11. package/internal/utils/log.d.ts.map +1 -1
  12. package/internal/utils/log.js.map +1 -1
  13. package/internal/utils/log.mjs.map +1 -1
  14. package/package.json +4 -2
  15. package/resources/consent-settings.d.mts +90 -1
  16. package/resources/consent-settings.d.mts.map +1 -1
  17. package/resources/consent-settings.d.ts +90 -1
  18. package/resources/consent-settings.d.ts.map +1 -1
  19. package/resources/consent-settings.js +13 -0
  20. package/resources/consent-settings.js.map +1 -1
  21. package/resources/consent-settings.mjs +13 -0
  22. package/resources/consent-settings.mjs.map +1 -1
  23. package/resources/custom-domains.d.mts +10 -4
  24. package/resources/custom-domains.d.mts.map +1 -1
  25. package/resources/custom-domains.d.ts +10 -4
  26. package/resources/custom-domains.d.ts.map +1 -1
  27. package/resources/custom-domains.js +3 -2
  28. package/resources/custom-domains.js.map +1 -1
  29. package/resources/custom-domains.mjs +3 -2
  30. package/resources/custom-domains.mjs.map +1 -1
  31. package/resources/dashboards.d.mts +4737 -0
  32. package/resources/dashboards.d.mts.map +1 -0
  33. package/resources/dashboards.d.ts +4737 -0
  34. package/resources/dashboards.d.ts.map +1 -0
  35. package/resources/dashboards.js +124 -0
  36. package/resources/dashboards.js.map +1 -0
  37. package/resources/dashboards.mjs +120 -0
  38. package/resources/dashboards.mjs.map +1 -0
  39. package/resources/data-governance.d.mts +19 -26
  40. package/resources/data-governance.d.mts.map +1 -1
  41. package/resources/data-governance.d.ts +19 -26
  42. package/resources/data-governance.d.ts.map +1 -1
  43. package/resources/data-governance.js +14 -13
  44. package/resources/data-governance.js.map +1 -1
  45. package/resources/data-governance.mjs +14 -13
  46. package/resources/data-governance.mjs.map +1 -1
  47. package/resources/destinations.d.mts +7 -7
  48. package/resources/destinations.d.mts.map +1 -1
  49. package/resources/destinations.d.ts +7 -7
  50. package/resources/destinations.d.ts.map +1 -1
  51. package/resources/experiment-settings.d.mts +84 -24
  52. package/resources/experiment-settings.d.mts.map +1 -1
  53. package/resources/experiment-settings.d.ts +84 -24
  54. package/resources/experiment-settings.d.ts.map +1 -1
  55. package/resources/experiment-settings.js +9 -4
  56. package/resources/experiment-settings.js.map +1 -1
  57. package/resources/experiment-settings.mjs +9 -4
  58. package/resources/experiment-settings.mjs.map +1 -1
  59. package/resources/experiments.d.mts +40 -40
  60. package/resources/experiments.d.mts.map +1 -1
  61. package/resources/experiments.d.ts +40 -40
  62. package/resources/experiments.d.ts.map +1 -1
  63. package/resources/funnels.d.mts +64 -7
  64. package/resources/funnels.d.mts.map +1 -1
  65. package/resources/funnels.d.ts +64 -7
  66. package/resources/funnels.d.ts.map +1 -1
  67. package/resources/funnels.js +2 -1
  68. package/resources/funnels.js.map +1 -1
  69. package/resources/funnels.mjs +2 -1
  70. package/resources/funnels.mjs.map +1 -1
  71. package/resources/index.d.mts +6 -3
  72. package/resources/index.d.mts.map +1 -1
  73. package/resources/index.d.ts +6 -3
  74. package/resources/index.d.ts.map +1 -1
  75. package/resources/index.js +7 -1
  76. package/resources/index.js.map +1 -1
  77. package/resources/index.mjs +3 -0
  78. package/resources/index.mjs.map +1 -1
  79. package/resources/insights.d.mts +1152 -0
  80. package/resources/insights.d.mts.map +1 -0
  81. package/resources/insights.d.ts +1152 -0
  82. package/resources/insights.d.ts.map +1 -0
  83. package/resources/insights.js +81 -0
  84. package/resources/insights.js.map +1 -0
  85. package/resources/insights.mjs +77 -0
  86. package/resources/insights.mjs.map +1 -0
  87. package/resources/journey-flows.d.mts +214 -17
  88. package/resources/journey-flows.d.mts.map +1 -1
  89. package/resources/journey-flows.d.ts +214 -17
  90. package/resources/journey-flows.d.ts.map +1 -1
  91. package/resources/journey-flows.js +17 -13
  92. package/resources/journey-flows.js.map +1 -1
  93. package/resources/journey-flows.mjs +17 -13
  94. package/resources/journey-flows.mjs.map +1 -1
  95. package/resources/replay-settings.d.mts +3 -2
  96. package/resources/replay-settings.d.mts.map +1 -1
  97. package/resources/replay-settings.d.ts +3 -2
  98. package/resources/replay-settings.d.ts.map +1 -1
  99. package/resources/replay-settings.js +3 -2
  100. package/resources/replay-settings.js.map +1 -1
  101. package/resources/replay-settings.mjs +3 -2
  102. package/resources/replay-settings.mjs.map +1 -1
  103. package/resources/report-branding.d.mts +157 -0
  104. package/resources/report-branding.d.mts.map +1 -0
  105. package/resources/report-branding.d.ts +157 -0
  106. package/resources/report-branding.d.ts.map +1 -0
  107. package/resources/report-branding.js +39 -0
  108. package/resources/report-branding.js.map +1 -0
  109. package/resources/report-branding.mjs +35 -0
  110. package/resources/report-branding.mjs.map +1 -0
  111. package/resources/tag-manager-triggers.d.mts +46 -4
  112. package/resources/tag-manager-triggers.d.mts.map +1 -1
  113. package/resources/tag-manager-triggers.d.ts +46 -4
  114. package/resources/tag-manager-triggers.d.ts.map +1 -1
  115. package/resources/tag-manager-triggers.js +6 -4
  116. package/resources/tag-manager-triggers.js.map +1 -1
  117. package/resources/tag-manager-triggers.mjs +6 -4
  118. package/resources/tag-manager-triggers.mjs.map +1 -1
  119. package/resources/tag-manager-variables.d.mts +25 -13
  120. package/resources/tag-manager-variables.d.mts.map +1 -1
  121. package/resources/tag-manager-variables.d.ts +25 -13
  122. package/resources/tag-manager-variables.d.ts.map +1 -1
  123. package/resources/tag-manager-variables.js +9 -4
  124. package/resources/tag-manager-variables.js.map +1 -1
  125. package/resources/tag-manager-variables.mjs +9 -4
  126. package/resources/tag-manager-variables.mjs.map +1 -1
  127. package/resources/tag-managers.d.mts +17 -1
  128. package/resources/tag-managers.d.mts.map +1 -1
  129. package/resources/tag-managers.d.ts +17 -1
  130. package/resources/tag-managers.d.ts.map +1 -1
  131. package/resources/tag-managers.js +10 -0
  132. package/resources/tag-managers.js.map +1 -1
  133. package/resources/tag-managers.mjs +10 -0
  134. package/resources/tag-managers.mjs.map +1 -1
  135. package/resources/test-events.d.mts +18 -13
  136. package/resources/test-events.d.mts.map +1 -1
  137. package/resources/test-events.d.ts +18 -13
  138. package/resources/test-events.d.ts.map +1 -1
  139. package/resources/web-analytics.d.mts +91 -39
  140. package/resources/web-analytics.d.mts.map +1 -1
  141. package/resources/web-analytics.d.ts +91 -39
  142. package/resources/web-analytics.d.ts.map +1 -1
  143. package/resources/web-analytics.js +11 -0
  144. package/resources/web-analytics.js.map +1 -1
  145. package/resources/web-analytics.mjs +11 -0
  146. package/resources/web-analytics.mjs.map +1 -1
  147. package/resources/web-scanners.d.mts +3 -2
  148. package/resources/web-scanners.d.mts.map +1 -1
  149. package/resources/web-scanners.d.ts +3 -2
  150. package/resources/web-scanners.d.ts.map +1 -1
  151. package/resources/web-scanners.js +3 -2
  152. package/resources/web-scanners.js.map +1 -1
  153. package/resources/web-scanners.mjs +3 -2
  154. package/resources/web-scanners.mjs.map +1 -1
  155. package/src/client.ts +118 -3
  156. package/src/internal/utils/log.ts +1 -3
  157. package/src/resources/consent-settings.ts +117 -0
  158. package/src/resources/custom-domains.ts +14 -4
  159. package/src/resources/dashboards.ts +8757 -0
  160. package/src/resources/data-governance.ts +19 -26
  161. package/src/resources/destinations.ts +9 -2
  162. package/src/resources/experiment-settings.ts +84 -24
  163. package/src/resources/experiments.ts +40 -40
  164. package/src/resources/funnels.ts +64 -7
  165. package/src/resources/index.ts +54 -0
  166. package/src/resources/insights.ts +1976 -0
  167. package/src/resources/journey-flows.ts +214 -17
  168. package/src/resources/replay-settings.ts +3 -2
  169. package/src/resources/report-branding.ts +207 -0
  170. package/src/resources/tag-manager-triggers.ts +55 -4
  171. package/src/resources/tag-manager-variables.ts +25 -13
  172. package/src/resources/tag-managers.ts +21 -0
  173. package/src/resources/test-events.ts +18 -13
  174. package/src/resources/web-analytics.ts +137 -38
  175. package/src/resources/web-scanners.ts +3 -2
  176. package/src/version.ts +1 -1
  177. package/version.d.mts +1 -1
  178. package/version.d.ts +1 -1
  179. package/version.js +1 -1
  180. package/version.mjs +1 -1
@@ -0,0 +1,1976 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class Insights extends APIResource {
10
+ /**
11
+ * List saved Insights, most recently updated first. Supports cursor pagination and
12
+ * case-insensitive name/description search. Preserve unavailableCount and warnings
13
+ * when presenting partial lists. Requires API-key scope or current OAuth user
14
+ * permission: web-analytics:view, variables:find-custom
15
+ */
16
+ list(
17
+ query: InsightListParams | null | undefined = {},
18
+ options?: RequestOptions,
19
+ ): PagePromise<InsightListResponsesCursor, InsightListResponse> {
20
+ return this._client.getAPIList('/rest/v1/insights', Cursor<InsightListResponse>, { query, ...options });
21
+ }
22
+
23
+ /**
24
+ * Save an Insight report. Use GET /rest/v1/insights/capabilities to discover
25
+ * supported features and GET /rest/v1/insights/{id}/result to compute results.
26
+ * Requires API-key scope or current OAuth user permission: web-analytics:write,
27
+ * variables:find-custom
28
+ */
29
+ create(body: InsightCreateParams, options?: RequestOptions): APIPromise<InsightCreateResponse> {
30
+ return this._client.post('/rest/v1/insights', { body, ...options });
31
+ }
32
+
33
+ /**
34
+ * Get a saved Insight by id, including its revision, metric definition, date
35
+ * range, and chart settings. Requires API-key scope or current OAuth user
36
+ * permission: web-analytics:view, variables:find-custom
37
+ */
38
+ retrieve(id: string, options?: RequestOptions): APIPromise<InsightRetrieveResponse> {
39
+ return this._client.get(path`/rest/v1/insights/${id}`, options);
40
+ }
41
+
42
+ /**
43
+ * Update a saved Insight using expectedRevision. Omitted top-level fields remain
44
+ * unchanged; supplied definition, reportContext, and view replace the entire
45
+ * nested value. Null clears the description. Requires API-key scope or current
46
+ * OAuth user permission: web-analytics:write, variables:find-custom
47
+ */
48
+ update(id: string, body: InsightUpdateParams, options?: RequestOptions): APIPromise<InsightUpdateResponse> {
49
+ return this._client.patch(path`/rest/v1/insights/${id}`, { body, ...options });
50
+ }
51
+
52
+ /**
53
+ * Delete a saved Insight using expectedRevision. Reload the report before retrying
54
+ * a revision conflict. Requires API-key scope or current OAuth user permission:
55
+ * web-analytics:write, variables:find-custom
56
+ */
57
+ delete(
58
+ id: string,
59
+ params: InsightDeleteParams,
60
+ options?: RequestOptions,
61
+ ): APIPromise<InsightDeleteResponse> {
62
+ const { expectedRevision } = params;
63
+ return this._client.delete(path`/rest/v1/insights/${id}`, { query: { expectedRevision }, ...options });
64
+ }
65
+
66
+ /**
67
+ * Discover supported Insight metrics, intervals, date presets, visualizations,
68
+ * comparisons, and limits before creating a report. Requires API-key scope or
69
+ * current OAuth user permission: web-analytics:view, variables:find-custom
70
+ */
71
+ capabilities(options?: RequestOptions): APIPromise<InsightCapabilitiesResponse> {
72
+ return this._client.get('/rest/v1/insights/capabilities', options);
73
+ }
74
+
75
+ /**
76
+ * Compute a saved Insight using expectedRevision with optional date, smoothing,
77
+ * cumulative, and comparison overrides. Overrides do not change the saved report.
78
+ * Requires API-key scope or current OAuth user permission: web-analytics:view,
79
+ * variables:find-custom
80
+ */
81
+ results(
82
+ id: string,
83
+ query: InsightResultsParams,
84
+ options?: RequestOptions,
85
+ ): APIPromise<InsightResultsResponse> {
86
+ return this._client.get(path`/rest/v1/insights/${id}/result`, { query, ...options });
87
+ }
88
+
89
+ /**
90
+ * Compute an unsaved Insight preview from its metric definition and date range.
91
+ * JSON-encode input in the query string; maximum 16384 bytes before URL encoding.
92
+ * Requires API-key scope or current OAuth user permission: web-analytics:view,
93
+ * variables:find-custom
94
+ */
95
+ preview(query: InsightPreviewParams, options?: RequestOptions): APIPromise<InsightPreviewResponse> {
96
+ return this._client.get('/rest/v1/insights/preview', { query, ...options });
97
+ }
98
+ }
99
+
100
+ export type InsightListResponsesCursor = Cursor<InsightListResponse>;
101
+
102
+ export interface InsightListResponse {
103
+ id: string;
104
+
105
+ createdAt: string;
106
+
107
+ createdByUserId: string;
108
+
109
+ /**
110
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
111
+ * interval. Sum and average require a numeric event property. Filters use the
112
+ * analytics property catalog.
113
+ */
114
+ definition: InsightListResponse.Definition;
115
+
116
+ /**
117
+ * Display name for the saved Insight.
118
+ */
119
+ name: string;
120
+
121
+ /**
122
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
123
+ * 366 days.
124
+ */
125
+ reportContext: InsightListResponse.ReportContext;
126
+
127
+ revision: string;
128
+
129
+ updatedAt: string;
130
+
131
+ updatedByUserId: string;
132
+
133
+ /**
134
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
135
+ * view fields reset to their defaults.
136
+ */
137
+ view: InsightListResponse.View;
138
+
139
+ /**
140
+ * Optional description; null clears it.
141
+ */
142
+ description?: string | null;
143
+ }
144
+
145
+ export namespace InsightListResponse {
146
+ /**
147
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
148
+ * interval. Sum and average require a numeric event property. Filters use the
149
+ * analytics property catalog.
150
+ */
151
+ export interface Definition {
152
+ interval: 'day' | 'week' | 'month';
153
+
154
+ kind: 'insight';
155
+
156
+ metrics: Array<Definition.Metric>;
157
+
158
+ version: 1;
159
+
160
+ filter?: Definition.Filter;
161
+ }
162
+
163
+ export namespace Definition {
164
+ export interface Metric {
165
+ id: string;
166
+
167
+ aggregation: 'event_count' | 'unique_visitors' | 'sum' | 'average';
168
+
169
+ eventNames: Array<string>;
170
+
171
+ name: string;
172
+
173
+ filter?: Metric.Filter;
174
+
175
+ property?: Metric.Property;
176
+ }
177
+
178
+ export namespace Metric {
179
+ export interface Filter {
180
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
181
+
182
+ version: 1;
183
+ }
184
+
185
+ export namespace Filter {
186
+ export interface UnionMember0 {
187
+ children: Array<unknown>;
188
+
189
+ kind: 'and' | 'or';
190
+ }
191
+
192
+ export interface UnionMember1 {
193
+ child: unknown;
194
+
195
+ kind: 'not';
196
+ }
197
+
198
+ export interface UnionMember2 {
199
+ kind: 'predicate';
200
+
201
+ operator:
202
+ | 'eq'
203
+ | 'neq'
204
+ | 'gt'
205
+ | 'gte'
206
+ | 'lt'
207
+ | 'lte'
208
+ | 'contains'
209
+ | 'not_contains'
210
+ | 'contains_ci'
211
+ | 'not_contains_ci'
212
+ | 'starts_with'
213
+ | 'ends_with'
214
+ | 'in'
215
+ | 'not_in'
216
+ | 'exists'
217
+ | 'missing'
218
+ | 'is_null';
219
+
220
+ property: string;
221
+
222
+ path?: Array<string>;
223
+
224
+ type?: 'string' | 'number' | 'boolean';
225
+
226
+ value?: string | number | boolean | Array<string | number | boolean>;
227
+ }
228
+ }
229
+
230
+ export interface Property {
231
+ path: Array<string>;
232
+
233
+ property: 'event.properties';
234
+
235
+ type?: 'number';
236
+ }
237
+ }
238
+
239
+ export interface Filter {
240
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
241
+
242
+ version: 1;
243
+ }
244
+
245
+ export namespace Filter {
246
+ export interface UnionMember0 {
247
+ children: Array<unknown>;
248
+
249
+ kind: 'and' | 'or';
250
+ }
251
+
252
+ export interface UnionMember1 {
253
+ child: unknown;
254
+
255
+ kind: 'not';
256
+ }
257
+
258
+ export interface UnionMember2 {
259
+ kind: 'predicate';
260
+
261
+ operator:
262
+ | 'eq'
263
+ | 'neq'
264
+ | 'gt'
265
+ | 'gte'
266
+ | 'lt'
267
+ | 'lte'
268
+ | 'contains'
269
+ | 'not_contains'
270
+ | 'contains_ci'
271
+ | 'not_contains_ci'
272
+ | 'starts_with'
273
+ | 'ends_with'
274
+ | 'in'
275
+ | 'not_in'
276
+ | 'exists'
277
+ | 'missing'
278
+ | 'is_null';
279
+
280
+ property: string;
281
+
282
+ path?: Array<string>;
283
+
284
+ type?: 'string' | 'number' | 'boolean';
285
+
286
+ value?: string | number | boolean | Array<string | number | boolean>;
287
+ }
288
+ }
289
+ }
290
+
291
+ /**
292
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
293
+ * 366 days.
294
+ */
295
+ export interface ReportContext {
296
+ dateRange: ReportContext.UnionMember0 | ReportContext.UnionMember1;
297
+ }
298
+
299
+ export namespace ReportContext {
300
+ export interface UnionMember0 {
301
+ from: string;
302
+
303
+ to: string;
304
+
305
+ timeZone?: 'UTC';
306
+ }
307
+
308
+ export interface UnionMember1 {
309
+ preset:
310
+ | 'today'
311
+ | 'yesterday'
312
+ | 'last_7_days'
313
+ | 'last_30_days'
314
+ | 'last_90_days'
315
+ | 'last_12_months'
316
+ | 'week_to_date'
317
+ | 'month_to_date'
318
+ | 'year_to_date';
319
+
320
+ timeZone?: 'UTC';
321
+ }
322
+ }
323
+
324
+ /**
325
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
326
+ * view fields reset to their defaults.
327
+ */
328
+ export interface View {
329
+ cumulative?: boolean;
330
+
331
+ series?: Array<View.Series>;
332
+
333
+ smoothing?: 'none' | 'rolling_average';
334
+
335
+ smoothingWindow?: number;
336
+
337
+ stacked?: boolean;
338
+
339
+ tableSort?: View.TableSort;
340
+
341
+ visualization?: 'line' | 'column' | 'bar' | 'pie' | 'table' | 'metric';
342
+
343
+ yAxisScale?: 'linear' | 'log';
344
+ }
345
+
346
+ export namespace View {
347
+ export interface Series {
348
+ metricId: string;
349
+
350
+ color?: string;
351
+
352
+ hidden?: boolean;
353
+ }
354
+
355
+ export interface TableSort {
356
+ column: 'label' | 'range_value' | 'average';
357
+
358
+ direction: 'asc' | 'desc';
359
+ }
360
+ }
361
+ }
362
+
363
+ export interface InsightCreateResponse {
364
+ id: string;
365
+
366
+ createdAt: string;
367
+
368
+ createdByUserId: string;
369
+
370
+ /**
371
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
372
+ * interval. Sum and average require a numeric event property. Filters use the
373
+ * analytics property catalog.
374
+ */
375
+ definition: InsightCreateResponse.Definition;
376
+
377
+ /**
378
+ * Display name for the saved Insight.
379
+ */
380
+ name: string;
381
+
382
+ /**
383
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
384
+ * 366 days.
385
+ */
386
+ reportContext: InsightCreateResponse.ReportContext;
387
+
388
+ revision: string;
389
+
390
+ updatedAt: string;
391
+
392
+ updatedByUserId: string;
393
+
394
+ /**
395
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
396
+ * view fields reset to their defaults.
397
+ */
398
+ view: InsightCreateResponse.View;
399
+
400
+ /**
401
+ * Optional description; null clears it.
402
+ */
403
+ description?: string | null;
404
+ }
405
+
406
+ export namespace InsightCreateResponse {
407
+ /**
408
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
409
+ * interval. Sum and average require a numeric event property. Filters use the
410
+ * analytics property catalog.
411
+ */
412
+ export interface Definition {
413
+ interval: 'day' | 'week' | 'month';
414
+
415
+ kind: 'insight';
416
+
417
+ metrics: Array<Definition.Metric>;
418
+
419
+ version: 1;
420
+
421
+ filter?: Definition.Filter;
422
+ }
423
+
424
+ export namespace Definition {
425
+ export interface Metric {
426
+ id: string;
427
+
428
+ aggregation: 'event_count' | 'unique_visitors' | 'sum' | 'average';
429
+
430
+ eventNames: Array<string>;
431
+
432
+ name: string;
433
+
434
+ filter?: Metric.Filter;
435
+
436
+ property?: Metric.Property;
437
+ }
438
+
439
+ export namespace Metric {
440
+ export interface Filter {
441
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
442
+
443
+ version: 1;
444
+ }
445
+
446
+ export namespace Filter {
447
+ export interface UnionMember0 {
448
+ children: Array<unknown>;
449
+
450
+ kind: 'and' | 'or';
451
+ }
452
+
453
+ export interface UnionMember1 {
454
+ child: unknown;
455
+
456
+ kind: 'not';
457
+ }
458
+
459
+ export interface UnionMember2 {
460
+ kind: 'predicate';
461
+
462
+ operator:
463
+ | 'eq'
464
+ | 'neq'
465
+ | 'gt'
466
+ | 'gte'
467
+ | 'lt'
468
+ | 'lte'
469
+ | 'contains'
470
+ | 'not_contains'
471
+ | 'contains_ci'
472
+ | 'not_contains_ci'
473
+ | 'starts_with'
474
+ | 'ends_with'
475
+ | 'in'
476
+ | 'not_in'
477
+ | 'exists'
478
+ | 'missing'
479
+ | 'is_null';
480
+
481
+ property: string;
482
+
483
+ path?: Array<string>;
484
+
485
+ type?: 'string' | 'number' | 'boolean';
486
+
487
+ value?: string | number | boolean | Array<string | number | boolean>;
488
+ }
489
+ }
490
+
491
+ export interface Property {
492
+ path: Array<string>;
493
+
494
+ property: 'event.properties';
495
+
496
+ type?: 'number';
497
+ }
498
+ }
499
+
500
+ export interface Filter {
501
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
502
+
503
+ version: 1;
504
+ }
505
+
506
+ export namespace Filter {
507
+ export interface UnionMember0 {
508
+ children: Array<unknown>;
509
+
510
+ kind: 'and' | 'or';
511
+ }
512
+
513
+ export interface UnionMember1 {
514
+ child: unknown;
515
+
516
+ kind: 'not';
517
+ }
518
+
519
+ export interface UnionMember2 {
520
+ kind: 'predicate';
521
+
522
+ operator:
523
+ | 'eq'
524
+ | 'neq'
525
+ | 'gt'
526
+ | 'gte'
527
+ | 'lt'
528
+ | 'lte'
529
+ | 'contains'
530
+ | 'not_contains'
531
+ | 'contains_ci'
532
+ | 'not_contains_ci'
533
+ | 'starts_with'
534
+ | 'ends_with'
535
+ | 'in'
536
+ | 'not_in'
537
+ | 'exists'
538
+ | 'missing'
539
+ | 'is_null';
540
+
541
+ property: string;
542
+
543
+ path?: Array<string>;
544
+
545
+ type?: 'string' | 'number' | 'boolean';
546
+
547
+ value?: string | number | boolean | Array<string | number | boolean>;
548
+ }
549
+ }
550
+ }
551
+
552
+ /**
553
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
554
+ * 366 days.
555
+ */
556
+ export interface ReportContext {
557
+ dateRange: ReportContext.UnionMember0 | ReportContext.UnionMember1;
558
+ }
559
+
560
+ export namespace ReportContext {
561
+ export interface UnionMember0 {
562
+ from: string;
563
+
564
+ to: string;
565
+
566
+ timeZone?: 'UTC';
567
+ }
568
+
569
+ export interface UnionMember1 {
570
+ preset:
571
+ | 'today'
572
+ | 'yesterday'
573
+ | 'last_7_days'
574
+ | 'last_30_days'
575
+ | 'last_90_days'
576
+ | 'last_12_months'
577
+ | 'week_to_date'
578
+ | 'month_to_date'
579
+ | 'year_to_date';
580
+
581
+ timeZone?: 'UTC';
582
+ }
583
+ }
584
+
585
+ /**
586
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
587
+ * view fields reset to their defaults.
588
+ */
589
+ export interface View {
590
+ cumulative?: boolean;
591
+
592
+ series?: Array<View.Series>;
593
+
594
+ smoothing?: 'none' | 'rolling_average';
595
+
596
+ smoothingWindow?: number;
597
+
598
+ stacked?: boolean;
599
+
600
+ tableSort?: View.TableSort;
601
+
602
+ visualization?: 'line' | 'column' | 'bar' | 'pie' | 'table' | 'metric';
603
+
604
+ yAxisScale?: 'linear' | 'log';
605
+ }
606
+
607
+ export namespace View {
608
+ export interface Series {
609
+ metricId: string;
610
+
611
+ color?: string;
612
+
613
+ hidden?: boolean;
614
+ }
615
+
616
+ export interface TableSort {
617
+ column: 'label' | 'range_value' | 'average';
618
+
619
+ direction: 'asc' | 'desc';
620
+ }
621
+ }
622
+ }
623
+
624
+ export interface InsightRetrieveResponse {
625
+ id: string;
626
+
627
+ createdAt: string;
628
+
629
+ createdByUserId: string;
630
+
631
+ /**
632
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
633
+ * interval. Sum and average require a numeric event property. Filters use the
634
+ * analytics property catalog.
635
+ */
636
+ definition: InsightRetrieveResponse.Definition;
637
+
638
+ /**
639
+ * Display name for the saved Insight.
640
+ */
641
+ name: string;
642
+
643
+ /**
644
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
645
+ * 366 days.
646
+ */
647
+ reportContext: InsightRetrieveResponse.ReportContext;
648
+
649
+ revision: string;
650
+
651
+ updatedAt: string;
652
+
653
+ updatedByUserId: string;
654
+
655
+ /**
656
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
657
+ * view fields reset to their defaults.
658
+ */
659
+ view: InsightRetrieveResponse.View;
660
+
661
+ /**
662
+ * Optional description; null clears it.
663
+ */
664
+ description?: string | null;
665
+ }
666
+
667
+ export namespace InsightRetrieveResponse {
668
+ /**
669
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
670
+ * interval. Sum and average require a numeric event property. Filters use the
671
+ * analytics property catalog.
672
+ */
673
+ export interface Definition {
674
+ interval: 'day' | 'week' | 'month';
675
+
676
+ kind: 'insight';
677
+
678
+ metrics: Array<Definition.Metric>;
679
+
680
+ version: 1;
681
+
682
+ filter?: Definition.Filter;
683
+ }
684
+
685
+ export namespace Definition {
686
+ export interface Metric {
687
+ id: string;
688
+
689
+ aggregation: 'event_count' | 'unique_visitors' | 'sum' | 'average';
690
+
691
+ eventNames: Array<string>;
692
+
693
+ name: string;
694
+
695
+ filter?: Metric.Filter;
696
+
697
+ property?: Metric.Property;
698
+ }
699
+
700
+ export namespace Metric {
701
+ export interface Filter {
702
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
703
+
704
+ version: 1;
705
+ }
706
+
707
+ export namespace Filter {
708
+ export interface UnionMember0 {
709
+ children: Array<unknown>;
710
+
711
+ kind: 'and' | 'or';
712
+ }
713
+
714
+ export interface UnionMember1 {
715
+ child: unknown;
716
+
717
+ kind: 'not';
718
+ }
719
+
720
+ export interface UnionMember2 {
721
+ kind: 'predicate';
722
+
723
+ operator:
724
+ | 'eq'
725
+ | 'neq'
726
+ | 'gt'
727
+ | 'gte'
728
+ | 'lt'
729
+ | 'lte'
730
+ | 'contains'
731
+ | 'not_contains'
732
+ | 'contains_ci'
733
+ | 'not_contains_ci'
734
+ | 'starts_with'
735
+ | 'ends_with'
736
+ | 'in'
737
+ | 'not_in'
738
+ | 'exists'
739
+ | 'missing'
740
+ | 'is_null';
741
+
742
+ property: string;
743
+
744
+ path?: Array<string>;
745
+
746
+ type?: 'string' | 'number' | 'boolean';
747
+
748
+ value?: string | number | boolean | Array<string | number | boolean>;
749
+ }
750
+ }
751
+
752
+ export interface Property {
753
+ path: Array<string>;
754
+
755
+ property: 'event.properties';
756
+
757
+ type?: 'number';
758
+ }
759
+ }
760
+
761
+ export interface Filter {
762
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
763
+
764
+ version: 1;
765
+ }
766
+
767
+ export namespace Filter {
768
+ export interface UnionMember0 {
769
+ children: Array<unknown>;
770
+
771
+ kind: 'and' | 'or';
772
+ }
773
+
774
+ export interface UnionMember1 {
775
+ child: unknown;
776
+
777
+ kind: 'not';
778
+ }
779
+
780
+ export interface UnionMember2 {
781
+ kind: 'predicate';
782
+
783
+ operator:
784
+ | 'eq'
785
+ | 'neq'
786
+ | 'gt'
787
+ | 'gte'
788
+ | 'lt'
789
+ | 'lte'
790
+ | 'contains'
791
+ | 'not_contains'
792
+ | 'contains_ci'
793
+ | 'not_contains_ci'
794
+ | 'starts_with'
795
+ | 'ends_with'
796
+ | 'in'
797
+ | 'not_in'
798
+ | 'exists'
799
+ | 'missing'
800
+ | 'is_null';
801
+
802
+ property: string;
803
+
804
+ path?: Array<string>;
805
+
806
+ type?: 'string' | 'number' | 'boolean';
807
+
808
+ value?: string | number | boolean | Array<string | number | boolean>;
809
+ }
810
+ }
811
+ }
812
+
813
+ /**
814
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
815
+ * 366 days.
816
+ */
817
+ export interface ReportContext {
818
+ dateRange: ReportContext.UnionMember0 | ReportContext.UnionMember1;
819
+ }
820
+
821
+ export namespace ReportContext {
822
+ export interface UnionMember0 {
823
+ from: string;
824
+
825
+ to: string;
826
+
827
+ timeZone?: 'UTC';
828
+ }
829
+
830
+ export interface UnionMember1 {
831
+ preset:
832
+ | 'today'
833
+ | 'yesterday'
834
+ | 'last_7_days'
835
+ | 'last_30_days'
836
+ | 'last_90_days'
837
+ | 'last_12_months'
838
+ | 'week_to_date'
839
+ | 'month_to_date'
840
+ | 'year_to_date';
841
+
842
+ timeZone?: 'UTC';
843
+ }
844
+ }
845
+
846
+ /**
847
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
848
+ * view fields reset to their defaults.
849
+ */
850
+ export interface View {
851
+ cumulative?: boolean;
852
+
853
+ series?: Array<View.Series>;
854
+
855
+ smoothing?: 'none' | 'rolling_average';
856
+
857
+ smoothingWindow?: number;
858
+
859
+ stacked?: boolean;
860
+
861
+ tableSort?: View.TableSort;
862
+
863
+ visualization?: 'line' | 'column' | 'bar' | 'pie' | 'table' | 'metric';
864
+
865
+ yAxisScale?: 'linear' | 'log';
866
+ }
867
+
868
+ export namespace View {
869
+ export interface Series {
870
+ metricId: string;
871
+
872
+ color?: string;
873
+
874
+ hidden?: boolean;
875
+ }
876
+
877
+ export interface TableSort {
878
+ column: 'label' | 'range_value' | 'average';
879
+
880
+ direction: 'asc' | 'desc';
881
+ }
882
+ }
883
+ }
884
+
885
+ export interface InsightUpdateResponse {
886
+ id: string;
887
+
888
+ createdAt: string;
889
+
890
+ createdByUserId: string;
891
+
892
+ /**
893
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
894
+ * interval. Sum and average require a numeric event property. Filters use the
895
+ * analytics property catalog.
896
+ */
897
+ definition: InsightUpdateResponse.Definition;
898
+
899
+ /**
900
+ * Display name for the saved Insight.
901
+ */
902
+ name: string;
903
+
904
+ /**
905
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
906
+ * 366 days.
907
+ */
908
+ reportContext: InsightUpdateResponse.ReportContext;
909
+
910
+ revision: string;
911
+
912
+ updatedAt: string;
913
+
914
+ updatedByUserId: string;
915
+
916
+ /**
917
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
918
+ * view fields reset to their defaults.
919
+ */
920
+ view: InsightUpdateResponse.View;
921
+
922
+ /**
923
+ * Optional description; null clears it.
924
+ */
925
+ description?: string | null;
926
+ }
927
+
928
+ export namespace InsightUpdateResponse {
929
+ /**
930
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
931
+ * interval. Sum and average require a numeric event property. Filters use the
932
+ * analytics property catalog.
933
+ */
934
+ export interface Definition {
935
+ interval: 'day' | 'week' | 'month';
936
+
937
+ kind: 'insight';
938
+
939
+ metrics: Array<Definition.Metric>;
940
+
941
+ version: 1;
942
+
943
+ filter?: Definition.Filter;
944
+ }
945
+
946
+ export namespace Definition {
947
+ export interface Metric {
948
+ id: string;
949
+
950
+ aggregation: 'event_count' | 'unique_visitors' | 'sum' | 'average';
951
+
952
+ eventNames: Array<string>;
953
+
954
+ name: string;
955
+
956
+ filter?: Metric.Filter;
957
+
958
+ property?: Metric.Property;
959
+ }
960
+
961
+ export namespace Metric {
962
+ export interface Filter {
963
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
964
+
965
+ version: 1;
966
+ }
967
+
968
+ export namespace Filter {
969
+ export interface UnionMember0 {
970
+ children: Array<unknown>;
971
+
972
+ kind: 'and' | 'or';
973
+ }
974
+
975
+ export interface UnionMember1 {
976
+ child: unknown;
977
+
978
+ kind: 'not';
979
+ }
980
+
981
+ export interface UnionMember2 {
982
+ kind: 'predicate';
983
+
984
+ operator:
985
+ | 'eq'
986
+ | 'neq'
987
+ | 'gt'
988
+ | 'gte'
989
+ | 'lt'
990
+ | 'lte'
991
+ | 'contains'
992
+ | 'not_contains'
993
+ | 'contains_ci'
994
+ | 'not_contains_ci'
995
+ | 'starts_with'
996
+ | 'ends_with'
997
+ | 'in'
998
+ | 'not_in'
999
+ | 'exists'
1000
+ | 'missing'
1001
+ | 'is_null';
1002
+
1003
+ property: string;
1004
+
1005
+ path?: Array<string>;
1006
+
1007
+ type?: 'string' | 'number' | 'boolean';
1008
+
1009
+ value?: string | number | boolean | Array<string | number | boolean>;
1010
+ }
1011
+ }
1012
+
1013
+ export interface Property {
1014
+ path: Array<string>;
1015
+
1016
+ property: 'event.properties';
1017
+
1018
+ type?: 'number';
1019
+ }
1020
+ }
1021
+
1022
+ export interface Filter {
1023
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
1024
+
1025
+ version: 1;
1026
+ }
1027
+
1028
+ export namespace Filter {
1029
+ export interface UnionMember0 {
1030
+ children: Array<unknown>;
1031
+
1032
+ kind: 'and' | 'or';
1033
+ }
1034
+
1035
+ export interface UnionMember1 {
1036
+ child: unknown;
1037
+
1038
+ kind: 'not';
1039
+ }
1040
+
1041
+ export interface UnionMember2 {
1042
+ kind: 'predicate';
1043
+
1044
+ operator:
1045
+ | 'eq'
1046
+ | 'neq'
1047
+ | 'gt'
1048
+ | 'gte'
1049
+ | 'lt'
1050
+ | 'lte'
1051
+ | 'contains'
1052
+ | 'not_contains'
1053
+ | 'contains_ci'
1054
+ | 'not_contains_ci'
1055
+ | 'starts_with'
1056
+ | 'ends_with'
1057
+ | 'in'
1058
+ | 'not_in'
1059
+ | 'exists'
1060
+ | 'missing'
1061
+ | 'is_null';
1062
+
1063
+ property: string;
1064
+
1065
+ path?: Array<string>;
1066
+
1067
+ type?: 'string' | 'number' | 'boolean';
1068
+
1069
+ value?: string | number | boolean | Array<string | number | boolean>;
1070
+ }
1071
+ }
1072
+ }
1073
+
1074
+ /**
1075
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
1076
+ * 366 days.
1077
+ */
1078
+ export interface ReportContext {
1079
+ dateRange: ReportContext.UnionMember0 | ReportContext.UnionMember1;
1080
+ }
1081
+
1082
+ export namespace ReportContext {
1083
+ export interface UnionMember0 {
1084
+ from: string;
1085
+
1086
+ to: string;
1087
+
1088
+ timeZone?: 'UTC';
1089
+ }
1090
+
1091
+ export interface UnionMember1 {
1092
+ preset:
1093
+ | 'today'
1094
+ | 'yesterday'
1095
+ | 'last_7_days'
1096
+ | 'last_30_days'
1097
+ | 'last_90_days'
1098
+ | 'last_12_months'
1099
+ | 'week_to_date'
1100
+ | 'month_to_date'
1101
+ | 'year_to_date';
1102
+
1103
+ timeZone?: 'UTC';
1104
+ }
1105
+ }
1106
+
1107
+ /**
1108
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
1109
+ * view fields reset to their defaults.
1110
+ */
1111
+ export interface View {
1112
+ cumulative?: boolean;
1113
+
1114
+ series?: Array<View.Series>;
1115
+
1116
+ smoothing?: 'none' | 'rolling_average';
1117
+
1118
+ smoothingWindow?: number;
1119
+
1120
+ stacked?: boolean;
1121
+
1122
+ tableSort?: View.TableSort;
1123
+
1124
+ visualization?: 'line' | 'column' | 'bar' | 'pie' | 'table' | 'metric';
1125
+
1126
+ yAxisScale?: 'linear' | 'log';
1127
+ }
1128
+
1129
+ export namespace View {
1130
+ export interface Series {
1131
+ metricId: string;
1132
+
1133
+ color?: string;
1134
+
1135
+ hidden?: boolean;
1136
+ }
1137
+
1138
+ export interface TableSort {
1139
+ column: 'label' | 'range_value' | 'average';
1140
+
1141
+ direction: 'asc' | 'desc';
1142
+ }
1143
+ }
1144
+ }
1145
+
1146
+ export interface InsightDeleteResponse {
1147
+ id: string;
1148
+
1149
+ deleted: true;
1150
+
1151
+ deletedRevision: string;
1152
+ }
1153
+
1154
+ export interface InsightCapabilitiesResponse {
1155
+ definitionVersion: 1;
1156
+
1157
+ maxDateRangeDays: 366;
1158
+
1159
+ maxEventNamesPerMetric: 10;
1160
+
1161
+ maxMetrics: 10;
1162
+
1163
+ maxSmoothingWindow: 30;
1164
+
1165
+ minSmoothingWindow: 2;
1166
+
1167
+ supportedAggregations: Array<'event_count' | 'unique_visitors' | 'sum' | 'average'>;
1168
+
1169
+ supportedAxisScales: Array<'linear' | 'log'>;
1170
+
1171
+ supportedComparisons: Array<'previous_period' | 'previous_year' | 'custom'>;
1172
+
1173
+ supportedCumulativeAggregations: Array<'event_count' | 'unique_visitors' | 'sum' | 'average'>;
1174
+
1175
+ supportedDatePresets: Array<
1176
+ | 'today'
1177
+ | 'yesterday'
1178
+ | 'last_7_days'
1179
+ | 'last_30_days'
1180
+ | 'last_90_days'
1181
+ | 'last_12_months'
1182
+ | 'week_to_date'
1183
+ | 'month_to_date'
1184
+ | 'year_to_date'
1185
+ >;
1186
+
1187
+ supportedIntervals: Array<'day' | 'week' | 'month'>;
1188
+
1189
+ supportedSmoothing: Array<'none' | 'rolling_average'>;
1190
+
1191
+ supportedVisualizations: Array<'line' | 'column' | 'bar' | 'pie' | 'table' | 'metric'>;
1192
+
1193
+ supportsBreakdowns: false;
1194
+
1195
+ supportsComparisons: true;
1196
+
1197
+ supportsMetricFilter: true;
1198
+
1199
+ supportsNonUtcTimeZones: false;
1200
+
1201
+ supportsNumericProperty: true;
1202
+
1203
+ supportsReportFilter: true;
1204
+ }
1205
+
1206
+ export interface InsightResultsResponse {
1207
+ engine: 'clickhouse';
1208
+
1209
+ /**
1210
+ * Saved report identifier; null for previews.
1211
+ */
1212
+ reportId: string | null;
1213
+
1214
+ /**
1215
+ * Saved report revision; null for previews.
1216
+ */
1217
+ revision: string | null;
1218
+
1219
+ scope: InsightResultsResponse.Scope;
1220
+
1221
+ semanticVersion: 1;
1222
+
1223
+ series: Array<InsightResultsResponse.Series>;
1224
+
1225
+ sourceLimitations: Array<string>;
1226
+
1227
+ sourcePolicy: string;
1228
+
1229
+ sourceRevision?: string | null;
1230
+ }
1231
+
1232
+ export namespace InsightResultsResponse {
1233
+ export interface Scope {
1234
+ cumulative: boolean;
1235
+
1236
+ executedAt: string;
1237
+
1238
+ from: string;
1239
+
1240
+ interval: 'day' | 'week' | 'month';
1241
+
1242
+ sourceCompleteness: 'unknown';
1243
+
1244
+ timeZone: 'UTC';
1245
+
1246
+ to: string;
1247
+
1248
+ comparison?: Scope.Comparison | null;
1249
+ }
1250
+
1251
+ export namespace Scope {
1252
+ export interface Comparison {
1253
+ from: string;
1254
+
1255
+ kind: 'previous_period' | 'previous_year' | 'custom';
1256
+
1257
+ to: string;
1258
+ }
1259
+ }
1260
+
1261
+ export interface Series {
1262
+ aggregation: 'event_count' | 'unique_visitors' | 'sum' | 'average';
1263
+
1264
+ breakdownValues: Array<Series.BreakdownValue>;
1265
+
1266
+ comparison: 'previous_period' | 'previous_year' | 'custom' | null;
1267
+
1268
+ key: string;
1269
+
1270
+ label: string;
1271
+
1272
+ metricId: string;
1273
+
1274
+ points: Array<Series.Point>;
1275
+
1276
+ rangeValue: number | null;
1277
+ }
1278
+
1279
+ export namespace Series {
1280
+ export interface BreakdownValue {
1281
+ property: string;
1282
+
1283
+ value: string | null;
1284
+ }
1285
+
1286
+ export interface Point {
1287
+ bucketEnd: string;
1288
+
1289
+ bucketStart: string;
1290
+
1291
+ cumulative: number | null;
1292
+
1293
+ isPartial: boolean;
1294
+
1295
+ raw: number | null;
1296
+
1297
+ smoothed: number | null;
1298
+ }
1299
+ }
1300
+ }
1301
+
1302
+ export interface InsightPreviewResponse {
1303
+ engine: 'clickhouse';
1304
+
1305
+ /**
1306
+ * Saved report identifier; null for previews.
1307
+ */
1308
+ reportId: string | null;
1309
+
1310
+ /**
1311
+ * Saved report revision; null for previews.
1312
+ */
1313
+ revision: string | null;
1314
+
1315
+ scope: InsightPreviewResponse.Scope;
1316
+
1317
+ semanticVersion: 1;
1318
+
1319
+ series: Array<InsightPreviewResponse.Series>;
1320
+
1321
+ sourceLimitations: Array<string>;
1322
+
1323
+ sourcePolicy: string;
1324
+
1325
+ sourceRevision?: string | null;
1326
+ }
1327
+
1328
+ export namespace InsightPreviewResponse {
1329
+ export interface Scope {
1330
+ cumulative: boolean;
1331
+
1332
+ executedAt: string;
1333
+
1334
+ from: string;
1335
+
1336
+ interval: 'day' | 'week' | 'month';
1337
+
1338
+ sourceCompleteness: 'unknown';
1339
+
1340
+ timeZone: 'UTC';
1341
+
1342
+ to: string;
1343
+
1344
+ comparison?: Scope.Comparison | null;
1345
+ }
1346
+
1347
+ export namespace Scope {
1348
+ export interface Comparison {
1349
+ from: string;
1350
+
1351
+ kind: 'previous_period' | 'previous_year' | 'custom';
1352
+
1353
+ to: string;
1354
+ }
1355
+ }
1356
+
1357
+ export interface Series {
1358
+ aggregation: 'event_count' | 'unique_visitors' | 'sum' | 'average';
1359
+
1360
+ breakdownValues: Array<Series.BreakdownValue>;
1361
+
1362
+ comparison: 'previous_period' | 'previous_year' | 'custom' | null;
1363
+
1364
+ key: string;
1365
+
1366
+ label: string;
1367
+
1368
+ metricId: string;
1369
+
1370
+ points: Array<Series.Point>;
1371
+
1372
+ rangeValue: number | null;
1373
+ }
1374
+
1375
+ export namespace Series {
1376
+ export interface BreakdownValue {
1377
+ property: string;
1378
+
1379
+ value: string | null;
1380
+ }
1381
+
1382
+ export interface Point {
1383
+ bucketEnd: string;
1384
+
1385
+ bucketStart: string;
1386
+
1387
+ cumulative: number | null;
1388
+
1389
+ isPartial: boolean;
1390
+
1391
+ raw: number | null;
1392
+
1393
+ smoothed: number | null;
1394
+ }
1395
+ }
1396
+ }
1397
+
1398
+ export interface InsightListParams extends CursorParams {
1399
+ /**
1400
+ * Case-insensitive search in the name and description.
1401
+ */
1402
+ search?: string;
1403
+ }
1404
+
1405
+ export interface InsightCreateParams {
1406
+ /**
1407
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
1408
+ * interval. Sum and average require a numeric event property. Filters use the
1409
+ * analytics property catalog.
1410
+ */
1411
+ definition: InsightCreateParams.Definition;
1412
+
1413
+ /**
1414
+ * Display name for the saved Insight.
1415
+ */
1416
+ name: string;
1417
+
1418
+ /**
1419
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
1420
+ * 366 days.
1421
+ */
1422
+ reportContext: InsightCreateParams.ReportContext;
1423
+
1424
+ /**
1425
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
1426
+ * view fields reset to their defaults.
1427
+ */
1428
+ view: InsightCreateParams.View;
1429
+
1430
+ /**
1431
+ * Optional description; null clears it.
1432
+ */
1433
+ description?: string | null;
1434
+ }
1435
+
1436
+ export namespace InsightCreateParams {
1437
+ /**
1438
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
1439
+ * interval. Sum and average require a numeric event property. Filters use the
1440
+ * analytics property catalog.
1441
+ */
1442
+ export interface Definition {
1443
+ interval: 'day' | 'week' | 'month';
1444
+
1445
+ kind: 'insight';
1446
+
1447
+ metrics: Array<Definition.Metric>;
1448
+
1449
+ version: 1;
1450
+
1451
+ filter?: Definition.Filter;
1452
+ }
1453
+
1454
+ export namespace Definition {
1455
+ export interface Metric {
1456
+ id: string;
1457
+
1458
+ aggregation: 'event_count' | 'unique_visitors' | 'sum' | 'average';
1459
+
1460
+ eventNames: Array<string>;
1461
+
1462
+ name: string;
1463
+
1464
+ filter?: Metric.Filter;
1465
+
1466
+ property?: Metric.Property;
1467
+ }
1468
+
1469
+ export namespace Metric {
1470
+ export interface Filter {
1471
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
1472
+
1473
+ version: 1;
1474
+ }
1475
+
1476
+ export namespace Filter {
1477
+ export interface UnionMember0 {
1478
+ children: Array<unknown>;
1479
+
1480
+ kind: 'and' | 'or';
1481
+ }
1482
+
1483
+ export interface UnionMember1 {
1484
+ child: unknown;
1485
+
1486
+ kind: 'not';
1487
+ }
1488
+
1489
+ export interface UnionMember2 {
1490
+ kind: 'predicate';
1491
+
1492
+ operator:
1493
+ | 'eq'
1494
+ | 'neq'
1495
+ | 'gt'
1496
+ | 'gte'
1497
+ | 'lt'
1498
+ | 'lte'
1499
+ | 'contains'
1500
+ | 'not_contains'
1501
+ | 'contains_ci'
1502
+ | 'not_contains_ci'
1503
+ | 'starts_with'
1504
+ | 'ends_with'
1505
+ | 'in'
1506
+ | 'not_in'
1507
+ | 'exists'
1508
+ | 'missing'
1509
+ | 'is_null';
1510
+
1511
+ property: string;
1512
+
1513
+ path?: Array<string>;
1514
+
1515
+ type?: 'string' | 'number' | 'boolean';
1516
+
1517
+ value?: string | number | boolean | Array<string | number | boolean>;
1518
+ }
1519
+ }
1520
+
1521
+ export interface Property {
1522
+ path: Array<string>;
1523
+
1524
+ property: 'event.properties';
1525
+
1526
+ type?: 'number';
1527
+ }
1528
+ }
1529
+
1530
+ export interface Filter {
1531
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
1532
+
1533
+ version: 1;
1534
+ }
1535
+
1536
+ export namespace Filter {
1537
+ export interface UnionMember0 {
1538
+ children: Array<unknown>;
1539
+
1540
+ kind: 'and' | 'or';
1541
+ }
1542
+
1543
+ export interface UnionMember1 {
1544
+ child: unknown;
1545
+
1546
+ kind: 'not';
1547
+ }
1548
+
1549
+ export interface UnionMember2 {
1550
+ kind: 'predicate';
1551
+
1552
+ operator:
1553
+ | 'eq'
1554
+ | 'neq'
1555
+ | 'gt'
1556
+ | 'gte'
1557
+ | 'lt'
1558
+ | 'lte'
1559
+ | 'contains'
1560
+ | 'not_contains'
1561
+ | 'contains_ci'
1562
+ | 'not_contains_ci'
1563
+ | 'starts_with'
1564
+ | 'ends_with'
1565
+ | 'in'
1566
+ | 'not_in'
1567
+ | 'exists'
1568
+ | 'missing'
1569
+ | 'is_null';
1570
+
1571
+ property: string;
1572
+
1573
+ path?: Array<string>;
1574
+
1575
+ type?: 'string' | 'number' | 'boolean';
1576
+
1577
+ value?: string | number | boolean | Array<string | number | boolean>;
1578
+ }
1579
+ }
1580
+ }
1581
+
1582
+ /**
1583
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
1584
+ * 366 days.
1585
+ */
1586
+ export interface ReportContext {
1587
+ dateRange: ReportContext.UnionMember0 | ReportContext.UnionMember1;
1588
+ }
1589
+
1590
+ export namespace ReportContext {
1591
+ export interface UnionMember0 {
1592
+ from: string;
1593
+
1594
+ to: string;
1595
+
1596
+ timeZone?: 'UTC';
1597
+ }
1598
+
1599
+ export interface UnionMember1 {
1600
+ preset:
1601
+ | 'today'
1602
+ | 'yesterday'
1603
+ | 'last_7_days'
1604
+ | 'last_30_days'
1605
+ | 'last_90_days'
1606
+ | 'last_12_months'
1607
+ | 'week_to_date'
1608
+ | 'month_to_date'
1609
+ | 'year_to_date';
1610
+
1611
+ timeZone?: 'UTC';
1612
+ }
1613
+ }
1614
+
1615
+ /**
1616
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
1617
+ * view fields reset to their defaults.
1618
+ */
1619
+ export interface View {
1620
+ cumulative?: boolean;
1621
+
1622
+ series?: Array<View.Series>;
1623
+
1624
+ smoothing?: 'none' | 'rolling_average';
1625
+
1626
+ smoothingWindow?: number;
1627
+
1628
+ stacked?: boolean;
1629
+
1630
+ tableSort?: View.TableSort;
1631
+
1632
+ visualization?: 'line' | 'column' | 'bar' | 'pie' | 'table' | 'metric';
1633
+
1634
+ yAxisScale?: 'linear' | 'log';
1635
+ }
1636
+
1637
+ export namespace View {
1638
+ export interface Series {
1639
+ metricId: string;
1640
+
1641
+ color?: string;
1642
+
1643
+ hidden?: boolean;
1644
+ }
1645
+
1646
+ export interface TableSort {
1647
+ column: 'label' | 'range_value' | 'average';
1648
+
1649
+ direction: 'asc' | 'desc';
1650
+ }
1651
+ }
1652
+ }
1653
+
1654
+ export interface InsightUpdateParams {
1655
+ /**
1656
+ * Revision returned by get/list or the last write. A stale revision returns 409;
1657
+ * reload before retrying.
1658
+ */
1659
+ expectedRevision: string;
1660
+
1661
+ /**
1662
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
1663
+ * interval. Sum and average require a numeric event property. Filters use the
1664
+ * analytics property catalog.
1665
+ */
1666
+ definition?: InsightUpdateParams.Definition;
1667
+
1668
+ /**
1669
+ * Optional description; null clears it.
1670
+ */
1671
+ description?: string | null;
1672
+
1673
+ /**
1674
+ * Display name for the saved Insight.
1675
+ */
1676
+ name?: string;
1677
+
1678
+ /**
1679
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
1680
+ * 366 days.
1681
+ */
1682
+ reportContext?: InsightUpdateParams.ReportContext;
1683
+
1684
+ /**
1685
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
1686
+ * view fields reset to their defaults.
1687
+ */
1688
+ view?: InsightUpdateParams.View;
1689
+ }
1690
+
1691
+ export namespace InsightUpdateParams {
1692
+ /**
1693
+ * Version 1 Insight definition: one to ten metrics and a day, week, or month
1694
+ * interval. Sum and average require a numeric event property. Filters use the
1695
+ * analytics property catalog.
1696
+ */
1697
+ export interface Definition {
1698
+ interval: 'day' | 'week' | 'month';
1699
+
1700
+ kind: 'insight';
1701
+
1702
+ metrics: Array<Definition.Metric>;
1703
+
1704
+ version: 1;
1705
+
1706
+ filter?: Definition.Filter;
1707
+ }
1708
+
1709
+ export namespace Definition {
1710
+ export interface Metric {
1711
+ id: string;
1712
+
1713
+ aggregation: 'event_count' | 'unique_visitors' | 'sum' | 'average';
1714
+
1715
+ eventNames: Array<string>;
1716
+
1717
+ name: string;
1718
+
1719
+ filter?: Metric.Filter;
1720
+
1721
+ property?: Metric.Property;
1722
+ }
1723
+
1724
+ export namespace Metric {
1725
+ export interface Filter {
1726
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
1727
+
1728
+ version: 1;
1729
+ }
1730
+
1731
+ export namespace Filter {
1732
+ export interface UnionMember0 {
1733
+ children: Array<unknown>;
1734
+
1735
+ kind: 'and' | 'or';
1736
+ }
1737
+
1738
+ export interface UnionMember1 {
1739
+ child: unknown;
1740
+
1741
+ kind: 'not';
1742
+ }
1743
+
1744
+ export interface UnionMember2 {
1745
+ kind: 'predicate';
1746
+
1747
+ operator:
1748
+ | 'eq'
1749
+ | 'neq'
1750
+ | 'gt'
1751
+ | 'gte'
1752
+ | 'lt'
1753
+ | 'lte'
1754
+ | 'contains'
1755
+ | 'not_contains'
1756
+ | 'contains_ci'
1757
+ | 'not_contains_ci'
1758
+ | 'starts_with'
1759
+ | 'ends_with'
1760
+ | 'in'
1761
+ | 'not_in'
1762
+ | 'exists'
1763
+ | 'missing'
1764
+ | 'is_null';
1765
+
1766
+ property: string;
1767
+
1768
+ path?: Array<string>;
1769
+
1770
+ type?: 'string' | 'number' | 'boolean';
1771
+
1772
+ value?: string | number | boolean | Array<string | number | boolean>;
1773
+ }
1774
+ }
1775
+
1776
+ export interface Property {
1777
+ path: Array<string>;
1778
+
1779
+ property: 'event.properties';
1780
+
1781
+ type?: 'number';
1782
+ }
1783
+ }
1784
+
1785
+ export interface Filter {
1786
+ filter: Filter.UnionMember0 | Filter.UnionMember1 | Filter.UnionMember2;
1787
+
1788
+ version: 1;
1789
+ }
1790
+
1791
+ export namespace Filter {
1792
+ export interface UnionMember0 {
1793
+ children: Array<unknown>;
1794
+
1795
+ kind: 'and' | 'or';
1796
+ }
1797
+
1798
+ export interface UnionMember1 {
1799
+ child: unknown;
1800
+
1801
+ kind: 'not';
1802
+ }
1803
+
1804
+ export interface UnionMember2 {
1805
+ kind: 'predicate';
1806
+
1807
+ operator:
1808
+ | 'eq'
1809
+ | 'neq'
1810
+ | 'gt'
1811
+ | 'gte'
1812
+ | 'lt'
1813
+ | 'lte'
1814
+ | 'contains'
1815
+ | 'not_contains'
1816
+ | 'contains_ci'
1817
+ | 'not_contains_ci'
1818
+ | 'starts_with'
1819
+ | 'ends_with'
1820
+ | 'in'
1821
+ | 'not_in'
1822
+ | 'exists'
1823
+ | 'missing'
1824
+ | 'is_null';
1825
+
1826
+ property: string;
1827
+
1828
+ path?: Array<string>;
1829
+
1830
+ type?: 'string' | 'number' | 'boolean';
1831
+
1832
+ value?: string | number | boolean | Array<string | number | boolean>;
1833
+ }
1834
+ }
1835
+ }
1836
+
1837
+ /**
1838
+ * UTC date range using either a preset or inclusive from/to calendar dates, up to
1839
+ * 366 days.
1840
+ */
1841
+ export interface ReportContext {
1842
+ dateRange: ReportContext.UnionMember0 | ReportContext.UnionMember1;
1843
+ }
1844
+
1845
+ export namespace ReportContext {
1846
+ export interface UnionMember0 {
1847
+ from: string;
1848
+
1849
+ to: string;
1850
+
1851
+ timeZone?: 'UTC';
1852
+ }
1853
+
1854
+ export interface UnionMember1 {
1855
+ preset:
1856
+ | 'today'
1857
+ | 'yesterday'
1858
+ | 'last_7_days'
1859
+ | 'last_30_days'
1860
+ | 'last_90_days'
1861
+ | 'last_12_months'
1862
+ | 'week_to_date'
1863
+ | 'month_to_date'
1864
+ | 'year_to_date';
1865
+
1866
+ timeZone?: 'UTC';
1867
+ }
1868
+ }
1869
+
1870
+ /**
1871
+ * Complete chart settings. Replaces the saved view when supplied on PATCH; omitted
1872
+ * view fields reset to their defaults.
1873
+ */
1874
+ export interface View {
1875
+ cumulative?: boolean;
1876
+
1877
+ series?: Array<View.Series>;
1878
+
1879
+ smoothing?: 'none' | 'rolling_average';
1880
+
1881
+ smoothingWindow?: number;
1882
+
1883
+ stacked?: boolean;
1884
+
1885
+ tableSort?: View.TableSort;
1886
+
1887
+ visualization?: 'line' | 'column' | 'bar' | 'pie' | 'table' | 'metric';
1888
+
1889
+ yAxisScale?: 'linear' | 'log';
1890
+ }
1891
+
1892
+ export namespace View {
1893
+ export interface Series {
1894
+ metricId: string;
1895
+
1896
+ color?: string;
1897
+
1898
+ hidden?: boolean;
1899
+ }
1900
+
1901
+ export interface TableSort {
1902
+ column: 'label' | 'range_value' | 'average';
1903
+
1904
+ direction: 'asc' | 'desc';
1905
+ }
1906
+ }
1907
+ }
1908
+
1909
+ export interface InsightDeleteParams {
1910
+ /**
1911
+ * Revision returned by get/list or the last write. A stale revision returns 409;
1912
+ * reload before retrying.
1913
+ */
1914
+ expectedRevision: string;
1915
+ }
1916
+
1917
+ export interface InsightResultsParams {
1918
+ /**
1919
+ * Revision returned by get/list or the last write. A stale revision returns 409;
1920
+ * reload before retrying.
1921
+ */
1922
+ expectedRevision: string;
1923
+
1924
+ /**
1925
+ * Compare with the previous period, previous year, or a custom starting date.
1926
+ * JSON-encoded in the REST query string; never saved.
1927
+ */
1928
+ comparison?: string;
1929
+
1930
+ /**
1931
+ * Omit or send null to use the saved cumulative setting; true or false overrides
1932
+ * it for this query.
1933
+ */
1934
+ cumulativeOverride?: boolean | null;
1935
+
1936
+ /**
1937
+ * Complete date range override for this query. JSON-encoded in the REST query
1938
+ * string; does not change the saved report.
1939
+ */
1940
+ reportContextOverride?: string;
1941
+
1942
+ /**
1943
+ * Omit to use saved smoothing, send null to disable it, or supply a window of 2–30
1944
+ * buckets.
1945
+ */
1946
+ smoothingWindowOverride?: number | null;
1947
+ }
1948
+
1949
+ export interface InsightPreviewParams {
1950
+ /**
1951
+ * Object with required definition and reportContext, plus optional
1952
+ * smoothingWindow, cumulative, and comparison. Chart view settings belong to saved
1953
+ * reports. JSON-encode input in the REST query string; maximum 16384 bytes.
1954
+ */
1955
+ input: string;
1956
+ }
1957
+
1958
+ export declare namespace Insights {
1959
+ export {
1960
+ type InsightListResponse as InsightListResponse,
1961
+ type InsightCreateResponse as InsightCreateResponse,
1962
+ type InsightRetrieveResponse as InsightRetrieveResponse,
1963
+ type InsightUpdateResponse as InsightUpdateResponse,
1964
+ type InsightDeleteResponse as InsightDeleteResponse,
1965
+ type InsightCapabilitiesResponse as InsightCapabilitiesResponse,
1966
+ type InsightResultsResponse as InsightResultsResponse,
1967
+ type InsightPreviewResponse as InsightPreviewResponse,
1968
+ type InsightListResponsesCursor as InsightListResponsesCursor,
1969
+ type InsightListParams as InsightListParams,
1970
+ type InsightCreateParams as InsightCreateParams,
1971
+ type InsightUpdateParams as InsightUpdateParams,
1972
+ type InsightDeleteParams as InsightDeleteParams,
1973
+ type InsightResultsParams as InsightResultsParams,
1974
+ type InsightPreviewParams as InsightPreviewParams,
1975
+ };
1976
+ }