@oursprivacy/platform-sdk 1.22.0 → 1.24.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 (95) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +17 -14
  3. package/client.d.mts +12 -9
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +12 -9
  6. package/client.d.ts.map +1 -1
  7. package/client.js +6 -3
  8. package/client.js.map +1 -1
  9. package/client.mjs +6 -3
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/allowed-events.d.mts +206 -5
  13. package/resources/allowed-events.d.mts.map +1 -1
  14. package/resources/allowed-events.d.ts +206 -5
  15. package/resources/allowed-events.d.ts.map +1 -1
  16. package/resources/allowed-events.js +48 -4
  17. package/resources/allowed-events.js.map +1 -1
  18. package/resources/allowed-events.mjs +48 -4
  19. package/resources/allowed-events.mjs.map +1 -1
  20. package/resources/consent-analytics.d.mts +57 -0
  21. package/resources/consent-analytics.d.mts.map +1 -0
  22. package/resources/consent-analytics.d.ts +57 -0
  23. package/resources/consent-analytics.d.ts.map +1 -0
  24. package/resources/consent-analytics.js +22 -0
  25. package/resources/consent-analytics.js.map +1 -0
  26. package/resources/consent-analytics.mjs +18 -0
  27. package/resources/consent-analytics.mjs.map +1 -0
  28. package/resources/consent-settings.d.mts +198 -1
  29. package/resources/consent-settings.d.mts.map +1 -1
  30. package/resources/consent-settings.d.ts +198 -1
  31. package/resources/consent-settings.d.ts.map +1 -1
  32. package/resources/consent-settings.js +40 -0
  33. package/resources/consent-settings.js.map +1 -1
  34. package/resources/consent-settings.mjs +40 -0
  35. package/resources/consent-settings.mjs.map +1 -1
  36. package/resources/data-governance.d.mts +793 -0
  37. package/resources/data-governance.d.mts.map +1 -0
  38. package/resources/data-governance.d.ts +793 -0
  39. package/resources/data-governance.d.ts.map +1 -0
  40. package/resources/data-governance.js +70 -0
  41. package/resources/data-governance.js.map +1 -0
  42. package/resources/data-governance.mjs +66 -0
  43. package/resources/data-governance.mjs.map +1 -0
  44. package/resources/default-mappings.d.mts +60 -3
  45. package/resources/default-mappings.d.mts.map +1 -1
  46. package/resources/default-mappings.d.ts +60 -3
  47. package/resources/default-mappings.d.ts.map +1 -1
  48. package/resources/destinations.d.mts +7 -7
  49. package/resources/destinations.d.mts.map +1 -1
  50. package/resources/destinations.d.ts +7 -7
  51. package/resources/destinations.d.ts.map +1 -1
  52. package/resources/index.d.mts +5 -4
  53. package/resources/index.d.mts.map +1 -1
  54. package/resources/index.d.ts +5 -4
  55. package/resources/index.d.ts.map +1 -1
  56. package/resources/index.js +5 -3
  57. package/resources/index.js.map +1 -1
  58. package/resources/index.mjs +2 -1
  59. package/resources/index.mjs.map +1 -1
  60. package/resources/mappings.d.mts +174 -15
  61. package/resources/mappings.d.mts.map +1 -1
  62. package/resources/mappings.d.ts +174 -15
  63. package/resources/mappings.d.ts.map +1 -1
  64. package/resources/sources.d.mts +213 -45
  65. package/resources/sources.d.mts.map +1 -1
  66. package/resources/sources.d.ts +213 -45
  67. package/resources/sources.d.ts.map +1 -1
  68. package/resources/sources.js +18 -7
  69. package/resources/sources.js.map +1 -1
  70. package/resources/sources.mjs +18 -7
  71. package/resources/sources.mjs.map +1 -1
  72. package/src/client.ts +60 -27
  73. package/src/resources/allowed-events.ts +232 -4
  74. package/src/resources/consent-analytics.ts +76 -0
  75. package/src/resources/consent-settings.ts +272 -0
  76. package/src/resources/data-governance.ts +1091 -0
  77. package/src/resources/default-mappings.ts +60 -3
  78. package/src/resources/destinations.ts +9 -2
  79. package/src/resources/index.ts +27 -12
  80. package/src/resources/mappings.ts +174 -15
  81. package/src/resources/sources.ts +337 -88
  82. package/src/version.ts +1 -1
  83. package/version.d.mts +1 -1
  84. package/version.d.ts +1 -1
  85. package/version.js +1 -1
  86. package/version.mjs +1 -1
  87. package/resources/global-dispatch-centers.d.mts +0 -349
  88. package/resources/global-dispatch-centers.d.mts.map +0 -1
  89. package/resources/global-dispatch-centers.d.ts +0 -349
  90. package/resources/global-dispatch-centers.d.ts.map +0 -1
  91. package/resources/global-dispatch-centers.js +0 -43
  92. package/resources/global-dispatch-centers.js.map +0 -1
  93. package/resources/global-dispatch-centers.mjs +0 -39
  94. package/resources/global-dispatch-centers.mjs.map +0 -1
  95. package/src/resources/global-dispatch-centers.ts +0 -458
package/src/client.ts CHANGED
@@ -25,12 +25,25 @@ import {
25
25
  AllowedEventDeleteResponse,
26
26
  AllowedEventListResponse,
27
27
  AllowedEventRetrieveResponse,
28
+ AllowedEventUpdateParams,
29
+ AllowedEventUpdateResponse,
28
30
  AllowedEvents,
29
31
  } from './resources/allowed-events';
30
32
  import {
33
+ ConsentAnalytics,
34
+ ConsentAnalyticsListParams,
35
+ ConsentAnalyticsListResponse,
36
+ } from './resources/consent-analytics';
37
+ import {
38
+ ConsentSettingAnalyticsByRegionParams,
39
+ ConsentSettingAnalyticsByRegionResponse,
40
+ ConsentSettingAnalyticsParams,
41
+ ConsentSettingAnalyticsResponse,
31
42
  ConsentSettingCreateResponse,
32
43
  ConsentSettingDeleteResponse,
33
44
  ConsentSettingListResponse,
45
+ ConsentSettingPageAnalysisParams,
46
+ ConsentSettingPageAnalysisResponse,
34
47
  ConsentSettingReplaceParams,
35
48
  ConsentSettingReplaceResponse,
36
49
  ConsentSettingRetrieveResponse,
@@ -38,6 +51,18 @@ import {
38
51
  ConsentSettingUpdateResponse,
39
52
  ConsentSettings,
40
53
  } from './resources/consent-settings';
54
+ import {
55
+ DataGovernance,
56
+ DataGovernanceCreateParams,
57
+ DataGovernanceCreateResponse,
58
+ DataGovernanceDeleteResponse,
59
+ DataGovernanceListParams,
60
+ DataGovernanceListResponse,
61
+ DataGovernanceListResponsesCursor,
62
+ DataGovernanceRetrieveResponse,
63
+ DataGovernanceUpdateParams,
64
+ DataGovernanceUpdateResponse,
65
+ } from './resources/data-governance';
41
66
  import {
42
67
  DefaultMappingListResponse,
43
68
  DefaultMappingReplaceParams,
@@ -106,18 +131,6 @@ import {
106
131
  ExperimentUpdateResponse,
107
132
  Experiments,
108
133
  } from './resources/experiments';
109
- import {
110
- GlobalDispatchCenterCreateParams,
111
- GlobalDispatchCenterCreateResponse,
112
- GlobalDispatchCenterDeleteResponse,
113
- GlobalDispatchCenterListParams,
114
- GlobalDispatchCenterListResponse,
115
- GlobalDispatchCenterListResponsesCursor,
116
- GlobalDispatchCenterRetrieveResponse,
117
- GlobalDispatchCenterUpdateParams,
118
- GlobalDispatchCenterUpdateResponse,
119
- GlobalDispatchCenters,
120
- } from './resources/global-dispatch-centers';
121
134
  import {
122
135
  HeatmapPageListParams,
123
136
  HeatmapPageListResponse,
@@ -171,7 +184,9 @@ import {
171
184
  SourceCreateParams,
172
185
  SourceCreateResponse,
173
186
  SourceDeleteResponse,
187
+ SourceListParams,
174
188
  SourceListResponse,
189
+ SourceListResponsesCursor,
175
190
  SourceRetrieveResponse,
176
191
  SourceTokensResponse,
177
192
  SourceUpdateParams,
@@ -952,13 +967,14 @@ export class OursPrivacyPlatform {
952
967
  static toFile = Uploads.toFile;
953
968
 
954
969
  allowedEvents: API.AllowedEvents = new API.AllowedEvents(this);
970
+ consentAnalytics: API.ConsentAnalytics = new API.ConsentAnalytics(this);
955
971
  consentSettings: API.ConsentSettings = new API.ConsentSettings(this);
972
+ dataGovernance: API.DataGovernance = new API.DataGovernance(this);
956
973
  defaultMappings: API.DefaultMappings = new API.DefaultMappings(this);
957
974
  destinations: API.Destinations = new API.Destinations(this);
958
975
  experimentSettings: API.ExperimentSettings = new API.ExperimentSettings(this);
959
976
  experimentVariants: API.ExperimentVariants = new API.ExperimentVariants(this);
960
977
  experiments: API.Experiments = new API.Experiments(this);
961
- globalDispatchCenters: API.GlobalDispatchCenters = new API.GlobalDispatchCenters(this);
962
978
  heatmapPages: API.HeatmapPages = new API.HeatmapPages(this);
963
979
  locations: API.Locations = new API.Locations(this);
964
980
  mappings: API.Mappings = new API.Mappings(this);
@@ -970,13 +986,14 @@ export class OursPrivacyPlatform {
970
986
  }
971
987
 
972
988
  OursPrivacyPlatform.AllowedEvents = AllowedEvents;
989
+ OursPrivacyPlatform.ConsentAnalytics = ConsentAnalytics;
973
990
  OursPrivacyPlatform.ConsentSettings = ConsentSettings;
991
+ OursPrivacyPlatform.DataGovernance = DataGovernance;
974
992
  OursPrivacyPlatform.DefaultMappings = DefaultMappings;
975
993
  OursPrivacyPlatform.Destinations = Destinations;
976
994
  OursPrivacyPlatform.ExperimentSettings = ExperimentSettings;
977
995
  OursPrivacyPlatform.ExperimentVariants = ExperimentVariants;
978
996
  OursPrivacyPlatform.Experiments = Experiments;
979
- OursPrivacyPlatform.GlobalDispatchCenters = GlobalDispatchCenters;
980
997
  OursPrivacyPlatform.HeatmapPages = HeatmapPages;
981
998
  OursPrivacyPlatform.Locations = Locations;
982
999
  OursPrivacyPlatform.Mappings = Mappings;
@@ -997,8 +1014,16 @@ export declare namespace OursPrivacyPlatform {
997
1014
  type AllowedEventListResponse as AllowedEventListResponse,
998
1015
  type AllowedEventCreateResponse as AllowedEventCreateResponse,
999
1016
  type AllowedEventRetrieveResponse as AllowedEventRetrieveResponse,
1017
+ type AllowedEventUpdateResponse as AllowedEventUpdateResponse,
1000
1018
  type AllowedEventDeleteResponse as AllowedEventDeleteResponse,
1001
1019
  type AllowedEventCreateParams as AllowedEventCreateParams,
1020
+ type AllowedEventUpdateParams as AllowedEventUpdateParams,
1021
+ };
1022
+
1023
+ export {
1024
+ ConsentAnalytics as ConsentAnalytics,
1025
+ type ConsentAnalyticsListResponse as ConsentAnalyticsListResponse,
1026
+ type ConsentAnalyticsListParams as ConsentAnalyticsListParams,
1002
1027
  };
1003
1028
 
1004
1029
  export {
@@ -1009,8 +1034,27 @@ export declare namespace OursPrivacyPlatform {
1009
1034
  type ConsentSettingReplaceResponse as ConsentSettingReplaceResponse,
1010
1035
  type ConsentSettingUpdateResponse as ConsentSettingUpdateResponse,
1011
1036
  type ConsentSettingDeleteResponse as ConsentSettingDeleteResponse,
1037
+ type ConsentSettingAnalyticsResponse as ConsentSettingAnalyticsResponse,
1038
+ type ConsentSettingPageAnalysisResponse as ConsentSettingPageAnalysisResponse,
1039
+ type ConsentSettingAnalyticsByRegionResponse as ConsentSettingAnalyticsByRegionResponse,
1012
1040
  type ConsentSettingReplaceParams as ConsentSettingReplaceParams,
1013
1041
  type ConsentSettingUpdateParams as ConsentSettingUpdateParams,
1042
+ type ConsentSettingAnalyticsParams as ConsentSettingAnalyticsParams,
1043
+ type ConsentSettingPageAnalysisParams as ConsentSettingPageAnalysisParams,
1044
+ type ConsentSettingAnalyticsByRegionParams as ConsentSettingAnalyticsByRegionParams,
1045
+ };
1046
+
1047
+ export {
1048
+ DataGovernance as DataGovernance,
1049
+ type DataGovernanceListResponse as DataGovernanceListResponse,
1050
+ type DataGovernanceCreateResponse as DataGovernanceCreateResponse,
1051
+ type DataGovernanceRetrieveResponse as DataGovernanceRetrieveResponse,
1052
+ type DataGovernanceUpdateResponse as DataGovernanceUpdateResponse,
1053
+ type DataGovernanceDeleteResponse as DataGovernanceDeleteResponse,
1054
+ type DataGovernanceListResponsesCursor as DataGovernanceListResponsesCursor,
1055
+ type DataGovernanceListParams as DataGovernanceListParams,
1056
+ type DataGovernanceCreateParams as DataGovernanceCreateParams,
1057
+ type DataGovernanceUpdateParams as DataGovernanceUpdateParams,
1014
1058
  };
1015
1059
 
1016
1060
  export {
@@ -1086,19 +1130,6 @@ export declare namespace OursPrivacyPlatform {
1086
1130
  type ExperimentSessionReplaysParams as ExperimentSessionReplaysParams,
1087
1131
  };
1088
1132
 
1089
- export {
1090
- GlobalDispatchCenters as GlobalDispatchCenters,
1091
- type GlobalDispatchCenterListResponse as GlobalDispatchCenterListResponse,
1092
- type GlobalDispatchCenterCreateResponse as GlobalDispatchCenterCreateResponse,
1093
- type GlobalDispatchCenterRetrieveResponse as GlobalDispatchCenterRetrieveResponse,
1094
- type GlobalDispatchCenterUpdateResponse as GlobalDispatchCenterUpdateResponse,
1095
- type GlobalDispatchCenterDeleteResponse as GlobalDispatchCenterDeleteResponse,
1096
- type GlobalDispatchCenterListResponsesCursor as GlobalDispatchCenterListResponsesCursor,
1097
- type GlobalDispatchCenterListParams as GlobalDispatchCenterListParams,
1098
- type GlobalDispatchCenterCreateParams as GlobalDispatchCenterCreateParams,
1099
- type GlobalDispatchCenterUpdateParams as GlobalDispatchCenterUpdateParams,
1100
- };
1101
-
1102
1133
  export {
1103
1134
  HeatmapPages as HeatmapPages,
1104
1135
  type HeatmapPageListResponse as HeatmapPageListResponse,
@@ -1160,6 +1191,8 @@ export declare namespace OursPrivacyPlatform {
1160
1191
  type SourceUpdateResponse as SourceUpdateResponse,
1161
1192
  type SourceDeleteResponse as SourceDeleteResponse,
1162
1193
  type SourceTokensResponse as SourceTokensResponse,
1194
+ type SourceListResponsesCursor as SourceListResponsesCursor,
1195
+ type SourceListParams as SourceListParams,
1163
1196
  type SourceCreateParams as SourceCreateParams,
1164
1197
  type SourceUpdateParams as SourceUpdateParams,
1165
1198
  };
@@ -7,28 +7,77 @@ import { path } from '../internal/utils/path';
7
7
 
8
8
  export class AllowedEvents extends APIResource {
9
9
  /**
10
- * List all allowed events. Requires scope: allowedEvent:list
10
+ * List every allowed event for this account. Allowed events sit between sources
11
+ * and destinations in the dispatch flow — only inbound events whose `event` field
12
+ * matches the `name` of an allowed event (case-insensitive) can be routed to that
13
+ * event's `destinationIds`. Events without a matching allowed event are dropped.
14
+ * The list is not paginated; the per-account count is bounded. System events
15
+ * (names beginning with `$`, e.g. `$heatmap_click`) are hidden from the response —
16
+ * only `$identify` is creatable as an allowed event. Requires scope:
17
+ * allowedEvent:list
11
18
  */
12
19
  list(options?: RequestOptions): APIPromise<AllowedEventListResponse> {
13
20
  return this._client.get('/rest/v1/allowed-events', options);
14
21
  }
15
22
 
16
23
  /**
17
- * Create a new allowed event. Requires scope: allowedEvent:create
24
+ * Create a new allowed event for this account.
25
+ *
26
+ * - `name` is required, trimmed, case-insensitively unique within the account, and
27
+ * rejected if it exceeds the platform event-name length limit.
28
+ * - Names starting with `$` are reserved for system events. Only `$identify` is
29
+ * accepted.
30
+ * - `destinationIds` is optional. Unknown ids and ids belonging to other accounts
31
+ * are silently filtered out at write time (the destination must exist on this
32
+ * account to be saved).
33
+ *
34
+ * Returns the full entity so callers can read the server-assigned `id`,
35
+ * `createdAt`, and the filtered `destinationIds` without a follow-up GET. Known
36
+ * input failures (duplicate name, name length, `$`-prefix reservation, empty name)
37
+ * are returned as HTTP 409 with the reason in the response `error` field. Requires
38
+ * scope: allowedEvent:create
18
39
  */
19
40
  create(body: AllowedEventCreateParams, options?: RequestOptions): APIPromise<AllowedEventCreateResponse> {
20
41
  return this._client.post('/rest/v1/allowed-events', { body, ...options });
21
42
  }
22
43
 
23
44
  /**
24
- * Find a single allowed event by ID. Requires scope: allowedEvent:find
45
+ * Fetch a single allowed event by id. Returns 404 when no record matches the
46
+ * supplied id or it belongs to a different account. Requires scope:
47
+ * allowedEvent:find
25
48
  */
26
49
  retrieve(id: string, options?: RequestOptions): APIPromise<AllowedEventRetrieveResponse> {
27
50
  return this._client.get(path`/rest/v1/allowed-events/${id}`, options);
28
51
  }
29
52
 
30
53
  /**
31
- * Delete an allowed event. Requires scope: allowedEvent:delete
54
+ * Partially update an allowed event. Only the fields you send are changed; omitted
55
+ * fields keep their current value.
56
+ *
57
+ * - `destinationIds` is replaced wholesale when sent — the canonical way to add or
58
+ * remove a destination is to fetch, modify the array, and PATCH it back. Stale
59
+ * ids (deleted destinations or destinations on another account) are silently
60
+ * filtered out at write time.
61
+ * - `name` is subject to the same rules as create: case-insensitive uniqueness,
62
+ * length cap, `$`-prefix reservation.
63
+ * - `trigger` accepts `null` to clear the existing value.
64
+ *
65
+ * Returns the full entity. Known input failures (duplicate name, length,
66
+ * `$`-prefix, empty name) are returned as HTTP 409 with the reason in the response
67
+ * `error` field. Requires scope: allowedEvent:update
68
+ */
69
+ update(
70
+ id: string,
71
+ body: AllowedEventUpdateParams,
72
+ options?: RequestOptions,
73
+ ): APIPromise<AllowedEventUpdateResponse> {
74
+ return this._client.patch(path`/rest/v1/allowed-events/${id}`, { body, ...options });
75
+ }
76
+
77
+ /**
78
+ * Delete an allowed event. After deletion, inbound events whose `event` field
79
+ * matches the deleted name are no longer routed and are dropped at the allow-list
80
+ * stage of the dispatch flow. Requires scope: allowedEvent:delete
32
81
  */
33
82
  delete(id: string, options?: RequestOptions): APIPromise<AllowedEventDeleteResponse> {
34
83
  return this._client.delete(path`/rest/v1/allowed-events/${id}`, options);
@@ -41,39 +90,193 @@ export interface AllowedEventListResponse {
41
90
 
42
91
  export namespace AllowedEventListResponse {
43
92
  export interface Entity {
93
+ /**
94
+ * Server-assigned UUID for this allowed event.
95
+ */
44
96
  id: string;
45
97
 
98
+ /**
99
+ * ISO 8601 timestamp when the allowed event was created.
100
+ */
46
101
  createdAt: string;
47
102
 
103
+ /**
104
+ * Destinations that receive this event. Empty array means the event is allowed but
105
+ * routed nowhere (effectively dropped). PATCH replaces this list wholesale.
106
+ */
48
107
  destinationIds: Array<string>;
49
108
 
109
+ /**
110
+ * Case-insensitive event name. Inbound events whose `event` field matches this
111
+ * value are gated through this allowed event. Reserved: names starting with `$`
112
+ * are system events and cannot be created (except `$identify`).
113
+ */
50
114
  name: string;
51
115
 
116
+ /**
117
+ * Optional free-form trigger description. Not used by the dispatch pipeline —
118
+ * surfaced in the dashboard so teams can record where each event fires.
119
+ */
120
+ trigger?: string | null;
121
+
122
+ /**
123
+ * ISO 8601 timestamp of the last PATCH. Equal to createdAt on a freshly created
124
+ * event.
125
+ */
52
126
  updatedAt?: string | null;
53
127
  }
54
128
  }
55
129
 
56
130
  export interface AllowedEventCreateResponse {
131
+ /**
132
+ * Server-assigned UUID for this allowed event.
133
+ */
57
134
  id: string;
58
135
 
136
+ /**
137
+ * ISO 8601 timestamp when the allowed event was created.
138
+ */
59
139
  createdAt: string;
60
140
 
141
+ /**
142
+ * Destinations that receive this event. Empty array means the event is allowed but
143
+ * routed nowhere (effectively dropped). PATCH replaces this list wholesale.
144
+ */
61
145
  destinationIds: Array<string>;
62
146
 
147
+ /**
148
+ * Case-insensitive event name. Inbound events whose `event` field matches this
149
+ * value are gated through this allowed event. Reserved: names starting with `$`
150
+ * are system events and cannot be created (except `$identify`).
151
+ */
63
152
  name: string;
64
153
 
154
+ /**
155
+ * ISO 8601 timestamp of the most recent successful dispatch to any destination on
156
+ * `destinationIds`. Lags `lastTriggeredAt` when consent or governance rules drop
157
+ * the event before dispatch.
158
+ */
159
+ lastDispatchedAt?: string | null;
160
+
161
+ /**
162
+ * ISO 8601 timestamp of the most recent inbound event observed for this name.
163
+ * Useful for spotting events that were configured but never fired. Null when never
164
+ * observed.
165
+ */
166
+ lastTriggeredAt?: string | null;
167
+
168
+ /**
169
+ * Optional free-form trigger description. Not used by the dispatch pipeline —
170
+ * surfaced in the dashboard so teams can record where each event fires.
171
+ */
172
+ trigger?: string | null;
173
+
174
+ /**
175
+ * ISO 8601 timestamp of the last PATCH. Equal to createdAt on a freshly created
176
+ * event.
177
+ */
65
178
  updatedAt?: string | null;
66
179
  }
67
180
 
68
181
  export interface AllowedEventRetrieveResponse {
182
+ /**
183
+ * Server-assigned UUID for this allowed event.
184
+ */
185
+ id: string;
186
+
187
+ /**
188
+ * ISO 8601 timestamp when the allowed event was created.
189
+ */
190
+ createdAt: string;
191
+
192
+ /**
193
+ * Destinations that receive this event. Empty array means the event is allowed but
194
+ * routed nowhere (effectively dropped). PATCH replaces this list wholesale.
195
+ */
196
+ destinationIds: Array<string>;
197
+
198
+ /**
199
+ * Case-insensitive event name. Inbound events whose `event` field matches this
200
+ * value are gated through this allowed event. Reserved: names starting with `$`
201
+ * are system events and cannot be created (except `$identify`).
202
+ */
203
+ name: string;
204
+
205
+ /**
206
+ * ISO 8601 timestamp of the most recent successful dispatch to any destination on
207
+ * `destinationIds`. Lags `lastTriggeredAt` when consent or governance rules drop
208
+ * the event before dispatch.
209
+ */
210
+ lastDispatchedAt?: string | null;
211
+
212
+ /**
213
+ * ISO 8601 timestamp of the most recent inbound event observed for this name.
214
+ * Useful for spotting events that were configured but never fired. Null when never
215
+ * observed.
216
+ */
217
+ lastTriggeredAt?: string | null;
218
+
219
+ /**
220
+ * Optional free-form trigger description. Not used by the dispatch pipeline —
221
+ * surfaced in the dashboard so teams can record where each event fires.
222
+ */
223
+ trigger?: string | null;
224
+
225
+ /**
226
+ * ISO 8601 timestamp of the last PATCH. Equal to createdAt on a freshly created
227
+ * event.
228
+ */
229
+ updatedAt?: string | null;
230
+ }
231
+
232
+ export interface AllowedEventUpdateResponse {
233
+ /**
234
+ * Server-assigned UUID for this allowed event.
235
+ */
69
236
  id: string;
70
237
 
238
+ /**
239
+ * ISO 8601 timestamp when the allowed event was created.
240
+ */
71
241
  createdAt: string;
72
242
 
243
+ /**
244
+ * Destinations that receive this event. Empty array means the event is allowed but
245
+ * routed nowhere (effectively dropped). PATCH replaces this list wholesale.
246
+ */
73
247
  destinationIds: Array<string>;
74
248
 
249
+ /**
250
+ * Case-insensitive event name. Inbound events whose `event` field matches this
251
+ * value are gated through this allowed event. Reserved: names starting with `$`
252
+ * are system events and cannot be created (except `$identify`).
253
+ */
75
254
  name: string;
76
255
 
256
+ /**
257
+ * ISO 8601 timestamp of the most recent successful dispatch to any destination on
258
+ * `destinationIds`. Lags `lastTriggeredAt` when consent or governance rules drop
259
+ * the event before dispatch.
260
+ */
261
+ lastDispatchedAt?: string | null;
262
+
263
+ /**
264
+ * ISO 8601 timestamp of the most recent inbound event observed for this name.
265
+ * Useful for spotting events that were configured but never fired. Null when never
266
+ * observed.
267
+ */
268
+ lastTriggeredAt?: string | null;
269
+
270
+ /**
271
+ * Optional free-form trigger description. Not used by the dispatch pipeline —
272
+ * surfaced in the dashboard so teams can record where each event fires.
273
+ */
274
+ trigger?: string | null;
275
+
276
+ /**
277
+ * ISO 8601 timestamp of the last PATCH. Equal to createdAt on a freshly created
278
+ * event.
279
+ */
77
280
  updatedAt?: string | null;
78
281
  }
79
282
 
@@ -85,12 +288,37 @@ export interface AllowedEventCreateParams {
85
288
  destinationIds?: Array<string> | null;
86
289
  }
87
290
 
291
+ export interface AllowedEventUpdateParams {
292
+ /**
293
+ * Destinations that should receive this event. Wholesale replacement — the sent
294
+ * list becomes the new value. Stale IDs (destinations from another account or
295
+ * deleted destinations) are silently filtered out at write time. Send `[]` to gate
296
+ * the event from every destination.
297
+ */
298
+ destinationIds?: Array<string> | null;
299
+
300
+ /**
301
+ * New event name. Subject to the same rules as create: case-insensitive uniqueness
302
+ * within the account, max length enforced by the platform, and the `$`-prefix
303
+ * reservation (only `$identify` is allowed). Omit to leave the name unchanged.
304
+ */
305
+ name?: string | null;
306
+
307
+ /**
308
+ * Free-form trigger description shown in the dashboard. Send `null` to clear. Not
309
+ * used by the dispatch pipeline.
310
+ */
311
+ trigger?: string | null;
312
+ }
313
+
88
314
  export declare namespace AllowedEvents {
89
315
  export {
90
316
  type AllowedEventListResponse as AllowedEventListResponse,
91
317
  type AllowedEventCreateResponse as AllowedEventCreateResponse,
92
318
  type AllowedEventRetrieveResponse as AllowedEventRetrieveResponse,
319
+ type AllowedEventUpdateResponse as AllowedEventUpdateResponse,
93
320
  type AllowedEventDeleteResponse as AllowedEventDeleteResponse,
94
321
  type AllowedEventCreateParams as AllowedEventCreateParams,
322
+ type AllowedEventUpdateParams as AllowedEventUpdateParams,
95
323
  };
96
324
  }
@@ -0,0 +1,76 @@
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 { RequestOptions } from '../internal/request-options';
6
+
7
+ export class ConsentAnalytics extends APIResource {
8
+ /**
9
+ * Account-wide blocking stats from the Global Consent Center for the window: how
10
+ * many dispatches were attempted, how many were blocked, and a per-category
11
+ * breakdown of the blocks (with `percentageBlocked` = share of `totalDispatches`).
12
+ * Not scoped to a single consent settings record — this aggregates across every
13
+ * destination in the account. The endpoint is identified by query params rather
14
+ * than a path id because the report is account-scoped; this is a documented
15
+ * derived-read exception. Reuses the API-key scope `consentSettings:list` because
16
+ * the report crosses every consent setting. Requires scope: consentSettings:list
17
+ */
18
+ list(
19
+ query: ConsentAnalyticsListParams,
20
+ options?: RequestOptions,
21
+ ): APIPromise<ConsentAnalyticsListResponse> {
22
+ return this._client.get('/rest/v1/consent-analytics', { query, ...options });
23
+ }
24
+ }
25
+
26
+ export interface ConsentAnalyticsListResponse {
27
+ /**
28
+ * Per-category breakdown of blocked dispatches. `categoryName` is `Unknown` when
29
+ * the upstream block message could not be parsed; `percentageBlocked` is the share
30
+ * of `totalDispatches` blocked under that category.
31
+ */
32
+ items: Array<ConsentAnalyticsListResponse.Item>;
33
+
34
+ /**
35
+ * Total dispatches blocked by the Global Consent Center across all categories.
36
+ */
37
+ totalBlocked: number;
38
+
39
+ /**
40
+ * Total dispatches attempted across all destinations for the window.
41
+ */
42
+ totalDispatches: number;
43
+ }
44
+
45
+ export namespace ConsentAnalyticsListResponse {
46
+ export interface Item {
47
+ blockedCount: number;
48
+
49
+ categoryName: string;
50
+
51
+ percentageBlocked: number;
52
+ }
53
+ }
54
+
55
+ export interface ConsentAnalyticsListParams {
56
+ /**
57
+ * Inclusive lower bound of the analytics window, as a UTC calendar day in
58
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 60 days or
59
+ * fewer.
60
+ */
61
+ from: string;
62
+
63
+ /**
64
+ * Inclusive upper bound of the analytics window, as a UTC calendar day in
65
+ * `YYYY-MM-DD` format. The window between `from` and `to` must be 60 days or
66
+ * fewer.
67
+ */
68
+ to: string;
69
+ }
70
+
71
+ export declare namespace ConsentAnalytics {
72
+ export {
73
+ type ConsentAnalyticsListResponse as ConsentAnalyticsListResponse,
74
+ type ConsentAnalyticsListParams as ConsentAnalyticsListParams,
75
+ };
76
+ }