@stream-io/node-sdk 0.4.10 → 0.4.12

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.
@@ -11,6 +11,7 @@ import {
11
11
  CheckSQSRequest,
12
12
  CheckSQSResponse,
13
13
  CreateBlockListRequest,
14
+ CreateBlockListResponse,
14
15
  CreateDeviceRequest,
15
16
  CreateExternalStorageRequest,
16
17
  CreateExternalStorageResponse,
@@ -59,6 +60,7 @@ import {
59
60
  UnblockUsersResponse,
60
61
  UpdateAppRequest,
61
62
  UpdateBlockListRequest,
63
+ UpdateBlockListResponse,
62
64
  UpdateExternalStorageRequest,
63
65
  UpdateExternalStorageResponse,
64
66
  UpdateUsersPartialRequest,
@@ -141,10 +143,16 @@ export class CommonApi extends BaseApi {
141
143
  return { ...response.body, metadata: response.metadata };
142
144
  };
143
145
 
144
- listBlockLists = async (): Promise<StreamResponse<ListBlockListResponse>> => {
146
+ listBlockLists = async (request?: {
147
+ team?: string;
148
+ }): Promise<StreamResponse<ListBlockListResponse>> => {
149
+ const queryParams = {
150
+ team: request?.team,
151
+ };
152
+
145
153
  const response = await this.sendRequest<
146
154
  StreamResponse<ListBlockListResponse>
147
- >('GET', '/api/v2/blocklists', undefined, undefined);
155
+ >('GET', '/api/v2/blocklists', undefined, queryParams);
148
156
 
149
157
  decoders.ListBlockListResponse?.(response.body);
150
158
 
@@ -153,29 +161,30 @@ export class CommonApi extends BaseApi {
153
161
 
154
162
  createBlockList = async (
155
163
  request: CreateBlockListRequest,
156
- ): Promise<StreamResponse<Response>> => {
164
+ ): Promise<StreamResponse<CreateBlockListResponse>> => {
157
165
  const body = {
158
166
  name: request?.name,
159
167
  words: request?.words,
168
+ team: request?.team,
160
169
  type: request?.type,
161
170
  };
162
171
 
163
- const response = await this.sendRequest<StreamResponse<Response>>(
164
- 'POST',
165
- '/api/v2/blocklists',
166
- undefined,
167
- undefined,
168
- body,
169
- );
172
+ const response = await this.sendRequest<
173
+ StreamResponse<CreateBlockListResponse>
174
+ >('POST', '/api/v2/blocklists', undefined, undefined, body);
170
175
 
171
- decoders.Response?.(response.body);
176
+ decoders.CreateBlockListResponse?.(response.body);
172
177
 
173
178
  return { ...response.body, metadata: response.metadata };
174
179
  };
175
180
 
176
181
  deleteBlockList = async (request: {
177
182
  name: string;
183
+ team?: string;
178
184
  }): Promise<StreamResponse<Response>> => {
185
+ const queryParams = {
186
+ team: request?.team,
187
+ };
179
188
  const pathParams = {
180
189
  name: request?.name,
181
190
  };
@@ -184,7 +193,7 @@ export class CommonApi extends BaseApi {
184
193
  'DELETE',
185
194
  '/api/v2/blocklists/{name}',
186
195
  pathParams,
187
- undefined,
196
+ queryParams,
188
197
  );
189
198
 
190
199
  decoders.Response?.(response.body);
@@ -194,14 +203,18 @@ export class CommonApi extends BaseApi {
194
203
 
195
204
  getBlockList = async (request: {
196
205
  name: string;
206
+ team?: string;
197
207
  }): Promise<StreamResponse<GetBlockListResponse>> => {
208
+ const queryParams = {
209
+ team: request?.team,
210
+ };
198
211
  const pathParams = {
199
212
  name: request?.name,
200
213
  };
201
214
 
202
215
  const response = await this.sendRequest<
203
216
  StreamResponse<GetBlockListResponse>
204
- >('GET', '/api/v2/blocklists/{name}', pathParams, undefined);
217
+ >('GET', '/api/v2/blocklists/{name}', pathParams, queryParams);
205
218
 
206
219
  decoders.GetBlockListResponse?.(response.body);
207
220
 
@@ -210,23 +223,20 @@ export class CommonApi extends BaseApi {
210
223
 
211
224
  updateBlockList = async (
212
225
  request: UpdateBlockListRequest & { name: string },
213
- ): Promise<StreamResponse<Response>> => {
226
+ ): Promise<StreamResponse<UpdateBlockListResponse>> => {
214
227
  const pathParams = {
215
228
  name: request?.name,
216
229
  };
217
230
  const body = {
231
+ team: request?.team,
218
232
  words: request?.words,
219
233
  };
220
234
 
221
- const response = await this.sendRequest<StreamResponse<Response>>(
222
- 'PUT',
223
- '/api/v2/blocklists/{name}',
224
- pathParams,
225
- undefined,
226
- body,
227
- );
235
+ const response = await this.sendRequest<
236
+ StreamResponse<UpdateBlockListResponse>
237
+ >('PUT', '/api/v2/blocklists/{name}', pathParams, undefined, body);
228
238
 
229
- decoders.Response?.(response.body);
239
+ decoders.UpdateBlockListResponse?.(response.body);
230
240
 
231
241
  return { ...response.body, metadata: response.metadata };
232
242
  };
@@ -381,6 +381,13 @@ decoders.ChannelMute = (input?: Record<string, any>) => {
381
381
  return decode(typeMappings, input);
382
382
  };
383
383
 
384
+ decoders.ChannelPushPreferences = (input?: Record<string, any>) => {
385
+ const typeMappings: TypeMapping = {
386
+ disabled_until: { type: 'DatetimeType', isSingle: true },
387
+ };
388
+ return decode(typeMappings, input);
389
+ };
390
+
384
391
  decoders.ChannelResponse = (input?: Record<string, any>) => {
385
392
  const typeMappings: TypeMapping = {
386
393
  created_at: { type: 'DatetimeType', isSingle: true },
@@ -429,6 +436,8 @@ decoders.ChannelStateResponse = (input?: Record<string, any>) => {
429
436
  channel: { type: 'ChannelResponse', isSingle: true },
430
437
 
431
438
  membership: { type: 'ChannelMember', isSingle: true },
439
+
440
+ push_preferences: { type: 'ChannelPushPreferences', isSingle: true },
432
441
  };
433
442
  return decode(typeMappings, input);
434
443
  };
@@ -454,6 +463,8 @@ decoders.ChannelStateResponseFields = (input?: Record<string, any>) => {
454
463
  channel: { type: 'ChannelResponse', isSingle: true },
455
464
 
456
465
  membership: { type: 'ChannelMember', isSingle: true },
466
+
467
+ push_preferences: { type: 'ChannelPushPreferences', isSingle: true },
457
468
  };
458
469
  return decode(typeMappings, input);
459
470
  };
@@ -494,6 +505,13 @@ decoders.ConfigResponse = (input?: Record<string, any>) => {
494
505
  return decode(typeMappings, input);
495
506
  };
496
507
 
508
+ decoders.CreateBlockListResponse = (input?: Record<string, any>) => {
509
+ const typeMappings: TypeMapping = {
510
+ blocklist: { type: 'BlockListResponse', isSingle: true },
511
+ };
512
+ return decode(typeMappings, input);
513
+ };
514
+
497
515
  decoders.CreateCallTypeResponse = (input?: Record<string, any>) => {
498
516
  const typeMappings: TypeMapping = {
499
517
  created_at: { type: 'DatetimeType', isSingle: true },
@@ -622,8 +640,6 @@ decoders.EntityCreator = (input?: Record<string, any>) => {
622
640
  revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
623
641
 
624
642
  updated_at: { type: 'DatetimeType', isSingle: true },
625
-
626
- push_notifications: { type: 'PushNotificationSettings', isSingle: true },
627
643
  };
628
644
  return decode(typeMappings, input);
629
645
  };
@@ -634,8 +650,6 @@ decoders.EntityCreatorResponse = (input?: Record<string, any>) => {
634
650
 
635
651
  updated_at: { type: 'DatetimeType', isSingle: true },
636
652
 
637
- devices: { type: 'DeviceResponse', isSingle: false },
638
-
639
653
  ban_expires: { type: 'DatetimeType', isSingle: true },
640
654
 
641
655
  deactivated_at: { type: 'DatetimeType', isSingle: true },
@@ -646,6 +660,8 @@ decoders.EntityCreatorResponse = (input?: Record<string, any>) => {
646
660
 
647
661
  revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
648
662
 
663
+ devices: { type: 'DeviceResponse', isSingle: false },
664
+
649
665
  push_notifications: {
650
666
  type: 'PushNotificationSettingsResponse',
651
667
  isSingle: true,
@@ -727,11 +743,6 @@ decoders.FullUserResponse = (input?: Record<string, any>) => {
727
743
  last_active: { type: 'DatetimeType', isSingle: true },
728
744
 
729
745
  revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
730
-
731
- push_notifications: {
732
- type: 'PushNotificationSettingsResponse',
733
- isSingle: true,
734
- },
735
746
  };
736
747
  return decode(typeMappings, input);
737
748
  };
@@ -1109,9 +1120,11 @@ decoders.MessageReadEvent = (input?: Record<string, any>) => {
1109
1120
  const typeMappings: TypeMapping = {
1110
1121
  created_at: { type: 'DatetimeType', isSingle: true },
1111
1122
 
1123
+ channel_last_message_at: { type: 'DatetimeType', isSingle: true },
1124
+
1112
1125
  thread: { type: 'ThreadResponse', isSingle: true },
1113
1126
 
1114
- user: { type: 'UserResponse', isSingle: true },
1127
+ user: { type: 'UserResponseCommonFields', isSingle: true },
1115
1128
  };
1116
1129
  return decode(typeMappings, input);
1117
1130
  };
@@ -1217,13 +1230,6 @@ decoders.MuteResponse = (input?: Record<string, any>) => {
1217
1230
  return decode(typeMappings, input);
1218
1231
  };
1219
1232
 
1220
- decoders.NullTime = (input?: Record<string, any>) => {
1221
- const typeMappings: TypeMapping = {
1222
- value: { type: 'DatetimeType', isSingle: true },
1223
- };
1224
- return decode(typeMappings, input);
1225
- };
1226
-
1227
1233
  decoders.OwnUser = (input?: Record<string, any>) => {
1228
1234
  const typeMappings: TypeMapping = {
1229
1235
  created_at: { type: 'DatetimeType', isSingle: true },
@@ -1244,7 +1250,7 @@ decoders.OwnUser = (input?: Record<string, any>) => {
1244
1250
 
1245
1251
  last_engaged_at: { type: 'DatetimeType', isSingle: true },
1246
1252
 
1247
- push_notifications: { type: 'PushNotificationSettings', isSingle: true },
1253
+ push_preferences: { type: 'PushPreferences', isSingle: true },
1248
1254
  };
1249
1255
  return decode(typeMappings, input);
1250
1256
  };
@@ -1269,10 +1275,7 @@ decoders.OwnUserResponse = (input?: Record<string, any>) => {
1269
1275
 
1270
1276
  revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
1271
1277
 
1272
- push_notifications: {
1273
- type: 'PushNotificationSettingsResponse',
1274
- isSingle: true,
1275
- },
1278
+ push_preferences: { type: 'PushPreferences', isSingle: true },
1276
1279
  };
1277
1280
  return decode(typeMappings, input);
1278
1281
  };
@@ -1368,14 +1371,14 @@ decoders.PushNotificationFields = (input?: Record<string, any>) => {
1368
1371
  return decode(typeMappings, input);
1369
1372
  };
1370
1373
 
1371
- decoders.PushNotificationSettings = (input?: Record<string, any>) => {
1374
+ decoders.PushNotificationSettingsResponse = (input?: Record<string, any>) => {
1372
1375
  const typeMappings: TypeMapping = {
1373
1376
  disabled_until: { type: 'DatetimeType', isSingle: true },
1374
1377
  };
1375
1378
  return decode(typeMappings, input);
1376
1379
  };
1377
1380
 
1378
- decoders.PushNotificationSettingsResponse = (input?: Record<string, any>) => {
1381
+ decoders.PushPreferences = (input?: Record<string, any>) => {
1379
1382
  const typeMappings: TypeMapping = {
1380
1383
  disabled_until: { type: 'DatetimeType', isSingle: true },
1381
1384
  };
@@ -1607,10 +1610,6 @@ decoders.ReviewQueueItem = (input?: Record<string, any>) => {
1607
1610
 
1608
1611
  flags: { type: 'Flag2', isSingle: false },
1609
1612
 
1610
- completed_at: { type: 'NullTime', isSingle: true },
1611
-
1612
- reviewed_at: { type: 'NullTime', isSingle: true },
1613
-
1614
1613
  assigned_to: { type: 'User', isSingle: true },
1615
1614
 
1616
1615
  entity_creator: { type: 'EntityCreator', isSingle: true },
@@ -1868,6 +1867,13 @@ decoders.UnreadCountsThread = (input?: Record<string, any>) => {
1868
1867
  return decode(typeMappings, input);
1869
1868
  };
1870
1869
 
1870
+ decoders.UpdateBlockListResponse = (input?: Record<string, any>) => {
1871
+ const typeMappings: TypeMapping = {
1872
+ blocklist: { type: 'BlockListResponse', isSingle: true },
1873
+ };
1874
+ return decode(typeMappings, input);
1875
+ };
1876
+
1871
1877
  decoders.UpdateCallMembersResponse = (input?: Record<string, any>) => {
1872
1878
  const typeMappings: TypeMapping = {
1873
1879
  members: { type: 'MemberResponse', isSingle: false },
@@ -1980,6 +1986,13 @@ decoders.UpsertModerationTemplateResponse = (input?: Record<string, any>) => {
1980
1986
  return decode(typeMappings, input);
1981
1987
  };
1982
1988
 
1989
+ decoders.UpsertPushPreferencesResponse = (input?: Record<string, any>) => {
1990
+ const typeMappings: TypeMapping = {
1991
+ user_preferences: { type: 'PushPreferences', isSingle: false },
1992
+ };
1993
+ return decode(typeMappings, input);
1994
+ };
1995
+
1983
1996
  decoders.UpsertPushProviderResponse = (input?: Record<string, any>) => {
1984
1997
  const typeMappings: TypeMapping = {
1985
1998
  push_provider: { type: 'PushProviderResponse', isSingle: true },
@@ -2004,8 +2017,6 @@ decoders.User = (input?: Record<string, any>) => {
2004
2017
  revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
2005
2018
 
2006
2019
  updated_at: { type: 'DatetimeType', isSingle: true },
2007
-
2008
- push_notifications: { type: 'PushNotificationSettings', isSingle: true },
2009
2020
  };
2010
2021
  return decode(typeMappings, input);
2011
2022
  };
@@ -2053,8 +2064,6 @@ decoders.UserResponse = (input?: Record<string, any>) => {
2053
2064
 
2054
2065
  updated_at: { type: 'DatetimeType', isSingle: true },
2055
2066
 
2056
- devices: { type: 'DeviceResponse', isSingle: false },
2057
-
2058
2067
  ban_expires: { type: 'DatetimeType', isSingle: true },
2059
2068
 
2060
2069
  deactivated_at: { type: 'DatetimeType', isSingle: true },
@@ -2065,6 +2074,8 @@ decoders.UserResponse = (input?: Record<string, any>) => {
2065
2074
 
2066
2075
  revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
2067
2076
 
2077
+ devices: { type: 'DeviceResponse', isSingle: false },
2078
+
2068
2079
  push_notifications: {
2069
2080
  type: 'PushNotificationSettingsResponse',
2070
2081
  isSingle: true,
@@ -2073,10 +2084,29 @@ decoders.UserResponse = (input?: Record<string, any>) => {
2073
2084
  return decode(typeMappings, input);
2074
2085
  };
2075
2086
 
2087
+ decoders.UserResponseCommonFields = (input?: Record<string, any>) => {
2088
+ const typeMappings: TypeMapping = {
2089
+ created_at: { type: 'DatetimeType', isSingle: true },
2090
+
2091
+ updated_at: { type: 'DatetimeType', isSingle: true },
2092
+
2093
+ deactivated_at: { type: 'DatetimeType', isSingle: true },
2094
+
2095
+ deleted_at: { type: 'DatetimeType', isSingle: true },
2096
+
2097
+ last_active: { type: 'DatetimeType', isSingle: true },
2098
+
2099
+ revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true },
2100
+ };
2101
+ return decode(typeMappings, input);
2102
+ };
2103
+
2076
2104
  decoders.WSEvent = (input?: Record<string, any>) => {
2077
2105
  const typeMappings: TypeMapping = {
2078
2106
  created_at: { type: 'DatetimeType', isSingle: true },
2079
2107
 
2108
+ channel_last_message_at: { type: 'DatetimeType', isSingle: true },
2109
+
2080
2110
  channel: { type: 'ChannelResponse', isSingle: true },
2081
2111
 
2082
2112
  created_by: { type: 'UserResponse', isSingle: true },