@notiflows/node 0.0.1 → 0.0.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 (84) hide show
  1. package/client.js.map +1 -1
  2. package/client.mjs.map +1 -1
  3. package/package.json +10 -9
  4. package/resources/deliveries.d.mts +9 -4
  5. package/resources/deliveries.d.mts.map +1 -1
  6. package/resources/deliveries.d.ts +9 -4
  7. package/resources/deliveries.d.ts.map +1 -1
  8. package/resources/deliveries.js.map +1 -1
  9. package/resources/deliveries.mjs.map +1 -1
  10. package/resources/notifications.d.mts +6 -10
  11. package/resources/notifications.d.mts.map +1 -1
  12. package/resources/notifications.d.ts +6 -10
  13. package/resources/notifications.d.ts.map +1 -1
  14. package/resources/notiflows.d.mts +2 -2
  15. package/resources/notiflows.d.mts.map +1 -1
  16. package/resources/notiflows.d.ts +2 -2
  17. package/resources/notiflows.d.ts.map +1 -1
  18. package/resources/notiflows.js +3 -3
  19. package/resources/notiflows.js.map +1 -1
  20. package/resources/notiflows.mjs +3 -3
  21. package/resources/notiflows.mjs.map +1 -1
  22. package/resources/users/channel-settings.d.mts +6 -6
  23. package/resources/users/channel-settings.d.mts.map +1 -1
  24. package/resources/users/channel-settings.d.ts +6 -6
  25. package/resources/users/channel-settings.d.ts.map +1 -1
  26. package/resources/users/channel-settings.js +12 -9
  27. package/resources/users/channel-settings.js.map +1 -1
  28. package/resources/users/channel-settings.mjs +12 -9
  29. package/resources/users/channel-settings.mjs.map +1 -1
  30. package/resources/users/deliveries.d.mts +3 -3
  31. package/resources/users/deliveries.d.mts.map +1 -1
  32. package/resources/users/deliveries.d.ts +3 -3
  33. package/resources/users/deliveries.d.ts.map +1 -1
  34. package/resources/users/deliveries.js +5 -8
  35. package/resources/users/deliveries.js.map +1 -1
  36. package/resources/users/deliveries.mjs +5 -8
  37. package/resources/users/deliveries.mjs.map +1 -1
  38. package/resources/users/notifications.d.mts +3 -3
  39. package/resources/users/notifications.d.mts.map +1 -1
  40. package/resources/users/notifications.d.ts +3 -3
  41. package/resources/users/notifications.d.ts.map +1 -1
  42. package/resources/users/notifications.js +5 -5
  43. package/resources/users/notifications.js.map +1 -1
  44. package/resources/users/notifications.mjs +5 -5
  45. package/resources/users/notifications.mjs.map +1 -1
  46. package/resources/users/preferences.d.mts +8 -7
  47. package/resources/users/preferences.d.mts.map +1 -1
  48. package/resources/users/preferences.d.ts +8 -7
  49. package/resources/users/preferences.d.ts.map +1 -1
  50. package/resources/users/preferences.js +7 -6
  51. package/resources/users/preferences.js.map +1 -1
  52. package/resources/users/preferences.mjs +7 -6
  53. package/resources/users/preferences.mjs.map +1 -1
  54. package/resources/users/subscriptions.d.mts +6 -6
  55. package/resources/users/subscriptions.d.mts.map +1 -1
  56. package/resources/users/subscriptions.d.ts +6 -6
  57. package/resources/users/subscriptions.d.ts.map +1 -1
  58. package/resources/users/subscriptions.js +10 -10
  59. package/resources/users/subscriptions.js.map +1 -1
  60. package/resources/users/subscriptions.mjs +10 -10
  61. package/resources/users/subscriptions.mjs.map +1 -1
  62. package/resources/users/users.d.mts +4 -10
  63. package/resources/users/users.d.mts.map +1 -1
  64. package/resources/users/users.d.ts +4 -10
  65. package/resources/users/users.d.ts.map +1 -1
  66. package/resources/users/users.js +7 -9
  67. package/resources/users/users.js.map +1 -1
  68. package/resources/users/users.mjs +7 -9
  69. package/resources/users/users.mjs.map +1 -1
  70. package/src/client.ts +1 -1
  71. package/src/resources/deliveries.ts +10 -4
  72. package/src/resources/notifications.ts +6 -11
  73. package/src/resources/notiflows.ts +3 -3
  74. package/src/resources/users/channel-settings.ts +15 -12
  75. package/src/resources/users/deliveries.ts +10 -9
  76. package/src/resources/users/notifications.ts +6 -6
  77. package/src/resources/users/preferences.ts +14 -9
  78. package/src/resources/users/subscriptions.ts +12 -12
  79. package/src/resources/users/users.ts +7 -14
  80. package/src/version.ts +1 -1
  81. package/version.d.mts +1 -1
  82. package/version.d.ts +1 -1
  83. package/version.js +1 -1
  84. package/version.mjs +1 -1
@@ -104,9 +104,9 @@ export interface Notification {
104
104
  notiflow_run_id: string;
105
105
 
106
106
  /**
107
- * Internal ID of the recipient user
107
+ * A user (recipient) in your project
108
108
  */
109
- recipient_id: string;
109
+ recipient: UsersAPI.User;
110
110
 
111
111
  /**
112
112
  * Notification processing status:
@@ -128,25 +128,20 @@ export interface Notification {
128
128
  */
129
129
  actor?: UsersAPI.User | null;
130
130
 
131
- /**
132
- * Internal ID of the actor (user who triggered the notification)
133
- */
134
- actor_id?: string | null;
135
-
136
131
  /**
137
132
  * Delivery attempts for this notification (when expanded)
138
133
  */
139
134
  deliveries?: Array<DeliveriesAPI.Delivery>;
140
135
 
141
136
  /**
142
- * When the notification was processed
137
+ * Handle of the notiflow that generated this notification
143
138
  */
144
- processed_at?: string | null;
139
+ notiflow_handle?: string;
145
140
 
146
141
  /**
147
- * A user (recipient) in your project
142
+ * When the notification was processed
148
143
  */
149
- recipient?: UsersAPI.User;
144
+ processed_at?: string | null;
150
145
 
151
146
  /**
152
147
  * Topic name if triggered via topic
@@ -25,16 +25,16 @@ export class NotiflowsResource extends APIResource {
25
25
  * @example
26
26
  * ```ts
27
27
  * const response = await client.notiflows.run(
28
- * '01HQXYZ123456789ABCDEFGHIJ',
28
+ * 'welcome-email',
29
29
  * );
30
30
  * ```
31
31
  */
32
32
  run(
33
- notiflowID: string,
33
+ notiflowHandle: string,
34
34
  body: NotiflowRunParams,
35
35
  options?: RequestOptions,
36
36
  ): APIPromise<NotiflowRunResponse> {
37
- return this._client.post(path`/notiflows/${notiflowID}/run`, { body, ...options });
37
+ return this._client.post(path`/notiflows/${notiflowHandle}/run`, { body, ...options });
38
38
  }
39
39
  }
40
40
 
@@ -18,7 +18,7 @@ export class ChannelSettings extends APIResource {
18
18
  * const channelSettings =
19
19
  * await client.users.channelSettings.retrieve(
20
20
  * '01HQXYZ123456789ABCDEFGHIJ',
21
- * { user_id: 'user_12345' },
21
+ * { user_external_id: 'user_12345' },
22
22
  * );
23
23
  * ```
24
24
  */
@@ -27,8 +27,8 @@ export class ChannelSettings extends APIResource {
27
27
  params: ChannelSettingRetrieveParams,
28
28
  options?: RequestOptions,
29
29
  ): APIPromise<ChannelSettings> {
30
- const { user_id } = params;
31
- return this._client.get(path`/users/${user_id}/channel-settings/${channelID}`, options);
30
+ const { user_external_id } = params;
31
+ return this._client.get(path`/users/${user_external_id}/channel-settings/${channelID}`, options);
32
32
  }
33
33
 
34
34
  /**
@@ -66,7 +66,7 @@ export class ChannelSettings extends APIResource {
66
66
  * await client.users.channelSettings.update(
67
67
  * '01HQXYZ123456789ABCDEFGHIJ',
68
68
  * {
69
- * user_id: 'user_12345',
69
+ * user_external_id: 'user_12345',
70
70
  * settings: {
71
71
  * device_tokens: ['ExampleTokenABCDEF123456789...'],
72
72
  * },
@@ -79,8 +79,11 @@ export class ChannelSettings extends APIResource {
79
79
  params: ChannelSettingUpdateParams,
80
80
  options?: RequestOptions,
81
81
  ): APIPromise<ChannelSettings> {
82
- const { user_id, ...body } = params;
83
- return this._client.put(path`/users/${user_id}/channel-settings/${channelID}`, { body, ...options });
82
+ const { user_external_id, ...body } = params;
83
+ return this._client.put(path`/users/${user_external_id}/channel-settings/${channelID}`, {
84
+ body,
85
+ ...options,
86
+ });
84
87
  }
85
88
 
86
89
  /**
@@ -93,13 +96,13 @@ export class ChannelSettings extends APIResource {
93
96
  * ```ts
94
97
  * await client.users.channelSettings.delete(
95
98
  * '01HQXYZ123456789ABCDEFGHIJ',
96
- * { user_id: 'user_12345' },
99
+ * { user_external_id: 'user_12345' },
97
100
  * );
98
101
  * ```
99
102
  */
100
103
  delete(channelID: string, params: ChannelSettingDeleteParams, options?: RequestOptions): APIPromise<void> {
101
- const { user_id } = params;
102
- return this._client.delete(path`/users/${user_id}/channel-settings/${channelID}`, {
104
+ const { user_external_id } = params;
105
+ return this._client.delete(path`/users/${user_external_id}/channel-settings/${channelID}`, {
103
106
  ...options,
104
107
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
105
108
  });
@@ -171,14 +174,14 @@ export interface ChannelSettingRetrieveParams {
171
174
  /**
172
175
  * User external ID
173
176
  */
174
- user_id: string;
177
+ user_external_id: string;
175
178
  }
176
179
 
177
180
  export interface ChannelSettingUpdateParams {
178
181
  /**
179
182
  * Path param: User external ID
180
183
  */
181
- user_id: string;
184
+ user_external_id: string;
182
185
 
183
186
  /**
184
187
  * Body param: Provider-specific settings. Structure depends on channel provider.
@@ -190,7 +193,7 @@ export interface ChannelSettingDeleteParams {
190
193
  /**
191
194
  * User external ID
192
195
  */
193
- user_id: string;
196
+ user_external_id: string;
194
197
  }
195
198
 
196
199
  export declare namespace ChannelSettings {
@@ -16,7 +16,7 @@ export class Deliveries extends APIResource {
16
16
  * ```ts
17
17
  * const delivery = await client.users.deliveries.retrieve(
18
18
  * '01HQXYZ123456789ABCDEFGHIJ',
19
- * { user_id: 'user_12345' },
19
+ * { user_external_id: 'user_12345' },
20
20
  * );
21
21
  * ```
22
22
  */
@@ -25,8 +25,8 @@ export class Deliveries extends APIResource {
25
25
  params: DeliveryRetrieveParams,
26
26
  options?: RequestOptions,
27
27
  ): APIPromise<DeliveriesAPI.Delivery> {
28
- const { user_id } = params;
29
- return this._client.get(path`/users/${user_id}/deliveries/${deliveryID}`, options);
28
+ const { user_external_id } = params;
29
+ return this._client.get(path`/users/${user_external_id}/deliveries/${deliveryID}`, options);
30
30
  }
31
31
 
32
32
  /**
@@ -43,14 +43,15 @@ export class Deliveries extends APIResource {
43
43
  * ```
44
44
  */
45
45
  list(
46
- userID: string,
46
+ userExternalID: string,
47
47
  query: DeliveryListParams | null | undefined = {},
48
48
  options?: RequestOptions,
49
49
  ): PagePromise<DeliveriesCursorPage, DeliveriesAPI.Delivery> {
50
- return this._client.getAPIList(path`/users/${userID}/deliveries`, CursorPage<DeliveriesAPI.Delivery>, {
51
- query,
52
- ...options,
53
- });
50
+ return this._client.getAPIList(
51
+ path`/users/${userExternalID}/deliveries`,
52
+ CursorPage<DeliveriesAPI.Delivery>,
53
+ { query, ...options },
54
+ );
54
55
  }
55
56
  }
56
57
 
@@ -58,7 +59,7 @@ export interface DeliveryRetrieveParams {
58
59
  /**
59
60
  * User external ID
60
61
  */
61
- user_id: string;
62
+ user_external_id: string;
62
63
  }
63
64
 
64
65
  export interface DeliveryListParams extends CursorPageParams {
@@ -17,7 +17,7 @@ export class Notifications extends APIResource {
17
17
  * const notification =
18
18
  * await client.users.notifications.retrieve(
19
19
  * '01HQXYZ123456789ABCDEFGHIJ',
20
- * { user_id: 'user_12345' },
20
+ * { user_external_id: 'user_12345' },
21
21
  * );
22
22
  * ```
23
23
  */
@@ -26,8 +26,8 @@ export class Notifications extends APIResource {
26
26
  params: NotificationRetrieveParams,
27
27
  options?: RequestOptions,
28
28
  ): APIPromise<NotificationsAPI.Notification> {
29
- const { user_id } = params;
30
- return this._client.get(path`/users/${user_id}/notifications/${notificationID}`, options);
29
+ const { user_external_id } = params;
30
+ return this._client.get(path`/users/${user_external_id}/notifications/${notificationID}`, options);
31
31
  }
32
32
 
33
33
  /**
@@ -44,12 +44,12 @@ export class Notifications extends APIResource {
44
44
  * ```
45
45
  */
46
46
  list(
47
- userID: string,
47
+ userExternalID: string,
48
48
  query: NotificationListParams | null | undefined = {},
49
49
  options?: RequestOptions,
50
50
  ): PagePromise<NotificationsCursorPage, NotificationsAPI.Notification> {
51
51
  return this._client.getAPIList(
52
- path`/users/${userID}/notifications`,
52
+ path`/users/${userExternalID}/notifications`,
53
53
  CursorPage<NotificationsAPI.Notification>,
54
54
  { query, ...options },
55
55
  );
@@ -60,7 +60,7 @@ export interface NotificationRetrieveParams {
60
60
  /**
61
61
  * User external ID
62
62
  */
63
- user_id: string;
63
+ user_external_id: string;
64
64
  }
65
65
 
66
66
  export interface NotificationListParams extends CursorPageParams {
@@ -22,8 +22,8 @@ export class Preferences extends APIResource {
22
22
  * );
23
23
  * ```
24
24
  */
25
- retrieve(userID: string, options?: RequestOptions): APIPromise<Preferences> {
26
- return this._client.get(path`/users/${userID}/preferences`, options);
25
+ retrieve(userExternalID: string, options?: RequestOptions): APIPromise<Preferences> {
26
+ return this._client.get(path`/users/${userExternalID}/preferences`, options);
27
27
  }
28
28
 
29
29
  /**
@@ -32,12 +32,13 @@ export class Preferences extends APIResource {
32
32
  *
33
33
  * **Channel types:** Set to `false` to opt the user out of a channel globally.
34
34
  *
35
- * **Notiflow preferences:** Override settings for specific notiflows:
35
+ * **Notiflow preferences:** Override settings for specific notiflows (keyed by
36
+ * notiflow handle):
36
37
  *
37
38
  * ```json
38
39
  * {
39
40
  * "notiflows": {
40
- * "notiflow_uuid": {
41
+ * "order-updates": {
41
42
  * "enabled": true,
42
43
  * "channel_types": {
43
44
  * "email": false
@@ -54,8 +55,12 @@ export class Preferences extends APIResource {
54
55
  * );
55
56
  * ```
56
57
  */
57
- update(userID: string, body: PreferenceUpdateParams, options?: RequestOptions): APIPromise<Preferences> {
58
- return this._client.put(path`/users/${userID}/preferences`, { body, ...options });
58
+ update(
59
+ userExternalID: string,
60
+ body: PreferenceUpdateParams,
61
+ options?: RequestOptions,
62
+ ): APIPromise<Preferences> {
63
+ return this._client.put(path`/users/${userExternalID}/preferences`, { body, ...options });
59
64
  }
60
65
  }
61
66
 
@@ -70,7 +75,7 @@ export interface Preferences {
70
75
  channel_types?: Preferences.ChannelTypes;
71
76
 
72
77
  /**
73
- * Per-notiflow preferences. Keys are notiflow IDs (UUIDs).
78
+ * Per-notiflow preferences. Keys are notiflow handles.
74
79
  */
75
80
  notiflows?: { [key: string]: Preferences.Notiflows };
76
81
  }
@@ -140,7 +145,7 @@ export interface UpdatePreferencesRequest {
140
145
  channel_types?: { [key: string]: boolean };
141
146
 
142
147
  /**
143
- * Per-notiflow preferences (keyed by notiflow ID)
148
+ * Per-notiflow preferences (keyed by notiflow handle)
144
149
  */
145
150
  notiflows?: { [key: string]: UpdatePreferencesRequest.Notiflows };
146
151
  }
@@ -160,7 +165,7 @@ export interface PreferenceUpdateParams {
160
165
  channel_types?: { [key: string]: boolean };
161
166
 
162
167
  /**
163
- * Per-notiflow preferences (keyed by notiflow ID)
168
+ * Per-notiflow preferences (keyed by notiflow handle)
164
169
  */
165
170
  notiflows?: { [key: string]: PreferenceUpdateParams.Notiflows };
166
171
  }
@@ -16,7 +16,7 @@ export class Subscriptions extends APIResource {
16
16
  * const subscription =
17
17
  * await client.users.subscriptions.retrieve(
18
18
  * 'order-updates',
19
- * { user_id: 'user_12345' },
19
+ * { user_external_id: 'user_12345' },
20
20
  * );
21
21
  * ```
22
22
  */
@@ -25,8 +25,8 @@ export class Subscriptions extends APIResource {
25
25
  params: SubscriptionRetrieveParams,
26
26
  options?: RequestOptions,
27
27
  ): APIPromise<Subscription> {
28
- const { user_id } = params;
29
- return this._client.get(path`/users/${user_id}/subscriptions/${topicName}`, options);
28
+ const { user_external_id } = params;
29
+ return this._client.get(path`/users/${user_external_id}/subscriptions/${topicName}`, options);
30
30
  }
31
31
 
32
32
  /**
@@ -43,11 +43,11 @@ export class Subscriptions extends APIResource {
43
43
  * ```
44
44
  */
45
45
  list(
46
- userID: string,
46
+ userExternalID: string,
47
47
  query: SubscriptionListParams | null | undefined = {},
48
48
  options?: RequestOptions,
49
49
  ): PagePromise<SubscriptionsCursorPage, Subscription> {
50
- return this._client.getAPIList(path`/users/${userID}/subscriptions`, CursorPage<Subscription>, {
50
+ return this._client.getAPIList(path`/users/${userExternalID}/subscriptions`, CursorPage<Subscription>, {
51
51
  query,
52
52
  ...options,
53
53
  });
@@ -69,11 +69,11 @@ export class Subscriptions extends APIResource {
69
69
  * ```
70
70
  */
71
71
  subscribe(
72
- userID: string,
72
+ userExternalID: string,
73
73
  body: SubscriptionSubscribeParams,
74
74
  options?: RequestOptions,
75
75
  ): APIPromise<Subscription> {
76
- return this._client.post(path`/users/${userID}/subscriptions`, { body, ...options });
76
+ return this._client.post(path`/users/${userExternalID}/subscriptions`, { body, ...options });
77
77
  }
78
78
 
79
79
  /**
@@ -84,7 +84,7 @@ export class Subscriptions extends APIResource {
84
84
  * ```ts
85
85
  * await client.users.subscriptions.unsubscribe(
86
86
  * 'order-updates',
87
- * { user_id: 'user_12345' },
87
+ * { user_external_id: 'user_12345' },
88
88
  * );
89
89
  * ```
90
90
  */
@@ -93,8 +93,8 @@ export class Subscriptions extends APIResource {
93
93
  params: SubscriptionUnsubscribeParams,
94
94
  options?: RequestOptions,
95
95
  ): APIPromise<void> {
96
- const { user_id } = params;
97
- return this._client.delete(path`/users/${user_id}/subscriptions/${topicName}`, {
96
+ const { user_external_id } = params;
97
+ return this._client.delete(path`/users/${user_external_id}/subscriptions/${topicName}`, {
98
98
  ...options,
99
99
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
100
100
  });
@@ -132,7 +132,7 @@ export interface SubscriptionRetrieveParams {
132
132
  /**
133
133
  * User external ID
134
134
  */
135
- user_id: string;
135
+ user_external_id: string;
136
136
  }
137
137
 
138
138
  export interface SubscriptionListParams extends CursorPageParams {
@@ -164,7 +164,7 @@ export interface SubscriptionUnsubscribeParams {
164
164
  /**
165
165
  * User external ID
166
166
  */
167
- user_id: string;
167
+ user_external_id: string;
168
168
  }
169
169
 
170
170
  export declare namespace Subscriptions {
@@ -48,8 +48,8 @@ export class Users extends APIResource {
48
48
  * const user = await client.users.retrieve('user_12345');
49
49
  * ```
50
50
  */
51
- retrieve(id: string, options?: RequestOptions): APIPromise<User> {
52
- return this._client.get(path`/users/${id}`, options);
51
+ retrieve(userExternalID: string, options?: RequestOptions): APIPromise<User> {
52
+ return this._client.get(path`/users/${userExternalID}`, options);
53
53
  }
54
54
 
55
55
  /**
@@ -86,8 +86,8 @@ export class Users extends APIResource {
86
86
  * await client.users.delete('user_12345');
87
87
  * ```
88
88
  */
89
- delete(id: string, options?: RequestOptions): APIPromise<void> {
90
- return this._client.delete(path`/users/${id}`, {
89
+ delete(userExternalID: string, options?: RequestOptions): APIPromise<void> {
90
+ return this._client.delete(path`/users/${userExternalID}`, {
91
91
  ...options,
92
92
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
93
93
  });
@@ -107,13 +107,11 @@ export class Users extends APIResource {
107
107
  *
108
108
  * @example
109
109
  * ```ts
110
- * const user = await client.users.upsert('user_12345', {
111
- * external_id: 'user_12345',
112
- * });
110
+ * const user = await client.users.upsert('user_12345');
113
111
  * ```
114
112
  */
115
- upsert(id: string, body: UserUpsertParams, options?: RequestOptions): APIPromise<User> {
116
- return this._client.put(path`/users/${id}`, { body, ...options });
113
+ upsert(userExternalID: string, body: UserUpsertParams, options?: RequestOptions): APIPromise<User> {
114
+ return this._client.put(path`/users/${userExternalID}`, { body, ...options });
117
115
  }
118
116
  }
119
117
 
@@ -203,11 +201,6 @@ export interface UserListParams extends CursorPageParams {
203
201
  }
204
202
 
205
203
  export interface UserUpsertParams {
206
- /**
207
- * Your system's unique identifier for this user. Required for creating new users.
208
- */
209
- external_id: string;
210
-
211
204
  /**
212
205
  * URL to user's avatar image (must start with http:// or https://)
213
206
  */
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.0.1';
1
+ export const VERSION = '0.0.2';
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.1";
1
+ export declare const VERSION = "0.0.2";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.1";
1
+ export declare const VERSION = "0.0.2";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.0.1';
4
+ exports.VERSION = '0.0.2';
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.0.1';
1
+ export const VERSION = '0.0.2';
2
2
  //# sourceMappingURL=version.mjs.map