@stream-io/node-sdk 0.4.19 → 0.4.21
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.
- package/dist/index.cjs.js +112 -98
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.mjs +112 -98
- package/dist/index.es.mjs.map +1 -1
- package/dist/src/BaseApi.d.ts +1 -0
- package/dist/src/StreamClient.d.ts +3 -0
- package/dist/src/gen/chat/ChannelApi.d.ts +9 -1
- package/dist/src/gen/chat/ChatApi.d.ts +17 -1
- package/dist/src/gen/models/index.d.ts +119 -119
- package/dist/src/gen/moderation/ModerationApi.d.ts +1 -11
- package/dist/src/types.d.ts +3 -0
- package/dist/src/utils/rate-limit.d.ts +1 -0
- package/package.json +2 -2
- package/src/BaseApi.ts +7 -1
- package/src/StreamClient.ts +13 -1
- package/src/gen/chat/ChannelApi.ts +29 -0
- package/src/gen/chat/ChatApi.ts +89 -1
- package/src/gen/model-decoders/index.ts +50 -63
- package/src/gen/models/index.ts +214 -206
- package/src/gen/moderation/ModerationApi.ts +0 -94
- package/src/types.ts +2 -0
package/dist/index.cjs.js
CHANGED
|
@@ -157,7 +157,7 @@ class BaseApi {
|
|
|
157
157
|
Authorization: this.apiConfig.token,
|
|
158
158
|
'stream-auth-type': 'jwt',
|
|
159
159
|
'Content-Type': 'application/json',
|
|
160
|
-
'X-Stream-Client': 'stream-node-' + "0.4.
|
|
160
|
+
'X-Stream-Client': 'stream-node-' + "0.4.21",
|
|
161
161
|
'Accept-Encoding': 'gzip',
|
|
162
162
|
'x-client-request-id': clientRequestId,
|
|
163
163
|
};
|
|
@@ -168,6 +168,7 @@ class BaseApi {
|
|
|
168
168
|
method,
|
|
169
169
|
body: JSON.stringify(body),
|
|
170
170
|
headers,
|
|
171
|
+
dispatcher: this.dispatcher,
|
|
171
172
|
});
|
|
172
173
|
const responseHeaders = response.headers;
|
|
173
174
|
const metadata = {
|
|
@@ -228,6 +229,7 @@ class BaseApi {
|
|
|
228
229
|
}
|
|
229
230
|
return newParams.join('&');
|
|
230
231
|
};
|
|
232
|
+
this.dispatcher = this.apiConfig.agent;
|
|
231
233
|
}
|
|
232
234
|
}
|
|
233
235
|
|
|
@@ -531,6 +533,7 @@ decoders.ChannelStateResponse = (input) => {
|
|
|
531
533
|
read: { type: 'ReadStateResponse', isSingle: false },
|
|
532
534
|
watchers: { type: 'UserResponse', isSingle: false },
|
|
533
535
|
channel: { type: 'ChannelResponse', isSingle: true },
|
|
536
|
+
draft: { type: 'DraftResponse', isSingle: true },
|
|
534
537
|
membership: { type: 'ChannelMember', isSingle: true },
|
|
535
538
|
push_preferences: { type: 'ChannelPushPreferences', isSingle: true },
|
|
536
539
|
};
|
|
@@ -547,6 +550,7 @@ decoders.ChannelStateResponseFields = (input) => {
|
|
|
547
550
|
read: { type: 'ReadStateResponse', isSingle: false },
|
|
548
551
|
watchers: { type: 'UserResponse', isSingle: false },
|
|
549
552
|
channel: { type: 'ChannelResponse', isSingle: true },
|
|
553
|
+
draft: { type: 'DraftResponse', isSingle: true },
|
|
550
554
|
membership: { type: 'ChannelMember', isSingle: true },
|
|
551
555
|
push_preferences: { type: 'ChannelPushPreferences', isSingle: true },
|
|
552
556
|
};
|
|
@@ -673,6 +677,22 @@ decoders.DeviceResponse = (input) => {
|
|
|
673
677
|
};
|
|
674
678
|
return decode(typeMappings, input);
|
|
675
679
|
};
|
|
680
|
+
decoders.DraftPayloadResponse = (input) => {
|
|
681
|
+
const typeMappings = {
|
|
682
|
+
mentioned_users: { type: 'UserResponse', isSingle: false },
|
|
683
|
+
};
|
|
684
|
+
return decode(typeMappings, input);
|
|
685
|
+
};
|
|
686
|
+
decoders.DraftResponse = (input) => {
|
|
687
|
+
const typeMappings = {
|
|
688
|
+
created_at: { type: 'DatetimeType', isSingle: true },
|
|
689
|
+
message: { type: 'DraftPayloadResponse', isSingle: true },
|
|
690
|
+
channel: { type: 'ChannelResponse', isSingle: true },
|
|
691
|
+
parent_message: { type: 'MessageResponse', isSingle: true },
|
|
692
|
+
quoted_message: { type: 'MessageResponse', isSingle: true },
|
|
693
|
+
};
|
|
694
|
+
return decode(typeMappings, input);
|
|
695
|
+
};
|
|
676
696
|
decoders.EgressRTMPResponse = (input) => {
|
|
677
697
|
const typeMappings = {
|
|
678
698
|
started_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -723,7 +743,7 @@ decoders.ExportUserResponse = (input) => {
|
|
|
723
743
|
};
|
|
724
744
|
return decode(typeMappings, input);
|
|
725
745
|
};
|
|
726
|
-
decoders.
|
|
746
|
+
decoders.Flag = (input) => {
|
|
727
747
|
const typeMappings = {
|
|
728
748
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
729
749
|
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -731,14 +751,6 @@ decoders.Flag2 = (input) => {
|
|
|
731
751
|
};
|
|
732
752
|
return decode(typeMappings, input);
|
|
733
753
|
};
|
|
734
|
-
decoders.Flag2Response = (input) => {
|
|
735
|
-
const typeMappings = {
|
|
736
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
737
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
738
|
-
user: { type: 'UserResponse', isSingle: true },
|
|
739
|
-
};
|
|
740
|
-
return decode(typeMappings, input);
|
|
741
|
-
};
|
|
742
754
|
decoders.FlagDetails = (input) => {
|
|
743
755
|
const typeMappings = {
|
|
744
756
|
automod: { type: 'AutomodDetails', isSingle: true },
|
|
@@ -798,12 +810,6 @@ decoders.GetCallTypeResponse = (input) => {
|
|
|
798
810
|
};
|
|
799
811
|
return decode(typeMappings, input);
|
|
800
812
|
};
|
|
801
|
-
decoders.GetCampaignResponse = (input) => {
|
|
802
|
-
const typeMappings = {
|
|
803
|
-
campaign: { type: 'CampaignResponse', isSingle: true },
|
|
804
|
-
};
|
|
805
|
-
return decode(typeMappings, input);
|
|
806
|
-
};
|
|
807
813
|
decoders.GetChannelTypeResponse = (input) => {
|
|
808
814
|
const typeMappings = {
|
|
809
815
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -825,6 +831,12 @@ decoders.GetConfigResponse = (input) => {
|
|
|
825
831
|
};
|
|
826
832
|
return decode(typeMappings, input);
|
|
827
833
|
};
|
|
834
|
+
decoders.GetDraftResponse = (input) => {
|
|
835
|
+
const typeMappings = {
|
|
836
|
+
draft: { type: 'DraftResponse', isSingle: true },
|
|
837
|
+
};
|
|
838
|
+
return decode(typeMappings, input);
|
|
839
|
+
};
|
|
828
840
|
decoders.GetImportResponse = (input) => {
|
|
829
841
|
const typeMappings = {
|
|
830
842
|
import_task: { type: 'ImportTask', isSingle: true },
|
|
@@ -888,14 +900,6 @@ decoders.GetThreadResponse = (input) => {
|
|
|
888
900
|
};
|
|
889
901
|
return decode(typeMappings, input);
|
|
890
902
|
};
|
|
891
|
-
decoders.GetUserModerationReportResponse = (input) => {
|
|
892
|
-
const typeMappings = {
|
|
893
|
-
user_blocks: { type: 'UserBlock', isSingle: false },
|
|
894
|
-
user_mutes: { type: 'UserMute', isSingle: false },
|
|
895
|
-
user: { type: 'UserResponse', isSingle: true },
|
|
896
|
-
};
|
|
897
|
-
return decode(typeMappings, input);
|
|
898
|
-
};
|
|
899
903
|
decoders.GoLiveResponse = (input) => {
|
|
900
904
|
const typeMappings = {
|
|
901
905
|
call: { type: 'CallResponse', isSingle: true },
|
|
@@ -1068,6 +1072,7 @@ decoders.MessageResponse = (input) => {
|
|
|
1068
1072
|
pin_expires: { type: 'DatetimeType', isSingle: true },
|
|
1069
1073
|
pinned_at: { type: 'DatetimeType', isSingle: true },
|
|
1070
1074
|
thread_participants: { type: 'UserResponse', isSingle: false },
|
|
1075
|
+
draft: { type: 'DraftResponse', isSingle: true },
|
|
1071
1076
|
pinned_by: { type: 'UserResponse', isSingle: true },
|
|
1072
1077
|
poll: { type: 'PollResponseData', isSingle: true },
|
|
1073
1078
|
quoted_message: { type: 'MessageResponse', isSingle: true },
|
|
@@ -1089,6 +1094,7 @@ decoders.MessageWithChannelResponse = (input) => {
|
|
|
1089
1094
|
pin_expires: { type: 'DatetimeType', isSingle: true },
|
|
1090
1095
|
pinned_at: { type: 'DatetimeType', isSingle: true },
|
|
1091
1096
|
thread_participants: { type: 'UserResponse', isSingle: false },
|
|
1097
|
+
draft: { type: 'DraftResponse', isSingle: true },
|
|
1092
1098
|
pinned_by: { type: 'UserResponse', isSingle: true },
|
|
1093
1099
|
poll: { type: 'PollResponseData', isSingle: true },
|
|
1094
1100
|
quoted_message: { type: 'MessageResponse', isSingle: true },
|
|
@@ -1096,13 +1102,6 @@ decoders.MessageWithChannelResponse = (input) => {
|
|
|
1096
1102
|
};
|
|
1097
1103
|
return decode(typeMappings, input);
|
|
1098
1104
|
};
|
|
1099
|
-
decoders.ModerationUsageStats = (input) => {
|
|
1100
|
-
const typeMappings = {
|
|
1101
|
-
reference_date: { type: 'DatetimeType', isSingle: true },
|
|
1102
|
-
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1103
|
-
};
|
|
1104
|
-
return decode(typeMappings, input);
|
|
1105
|
-
};
|
|
1106
1105
|
decoders.MuteChannelResponse = (input) => {
|
|
1107
1106
|
const typeMappings = {
|
|
1108
1107
|
channel_mutes: { type: 'ChannelMute', isSingle: false },
|
|
@@ -1280,6 +1279,12 @@ decoders.QueryChannelsResponse = (input) => {
|
|
|
1280
1279
|
};
|
|
1281
1280
|
return decode(typeMappings, input);
|
|
1282
1281
|
};
|
|
1282
|
+
decoders.QueryDraftsResponse = (input) => {
|
|
1283
|
+
const typeMappings = {
|
|
1284
|
+
drafts: { type: 'DraftResponse', isSingle: false },
|
|
1285
|
+
};
|
|
1286
|
+
return decode(typeMappings, input);
|
|
1287
|
+
};
|
|
1283
1288
|
decoders.QueryFeedModerationTemplate = (input) => {
|
|
1284
1289
|
const typeMappings = {
|
|
1285
1290
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -1353,12 +1358,6 @@ decoders.QueryThreadsResponse = (input) => {
|
|
|
1353
1358
|
};
|
|
1354
1359
|
return decode(typeMappings, input);
|
|
1355
1360
|
};
|
|
1356
|
-
decoders.QueryUsageStatsResponse = (input) => {
|
|
1357
|
-
const typeMappings = {
|
|
1358
|
-
items: { type: 'ModerationUsageStats', isSingle: false },
|
|
1359
|
-
};
|
|
1360
|
-
return decode(typeMappings, input);
|
|
1361
|
-
};
|
|
1362
1361
|
decoders.QueryUsersResponse = (input) => {
|
|
1363
1362
|
const typeMappings = {
|
|
1364
1363
|
users: { type: 'FullUserResponse', isSingle: false },
|
|
@@ -1407,7 +1406,7 @@ decoders.ReviewQueueItem = (input) => {
|
|
|
1407
1406
|
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1408
1407
|
actions: { type: 'ActionLog', isSingle: false },
|
|
1409
1408
|
bans: { type: 'Ban', isSingle: false },
|
|
1410
|
-
flags: { type: '
|
|
1409
|
+
flags: { type: 'Flag', isSingle: false },
|
|
1411
1410
|
assigned_to: { type: 'User', isSingle: true },
|
|
1412
1411
|
entity_creator: { type: 'EntityCreator', isSingle: true },
|
|
1413
1412
|
feeds_v2_reaction: { type: 'Reaction', isSingle: true },
|
|
@@ -1422,7 +1421,6 @@ decoders.ReviewQueueItemResponse = (input) => {
|
|
|
1422
1421
|
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1423
1422
|
actions: { type: 'ActionLogResponse', isSingle: false },
|
|
1424
1423
|
bans: { type: 'Ban', isSingle: false },
|
|
1425
|
-
flags: { type: 'Flag2Response', isSingle: false },
|
|
1426
1424
|
completed_at: { type: 'DatetimeType', isSingle: true },
|
|
1427
1425
|
reviewed_at: { type: 'DatetimeType', isSingle: true },
|
|
1428
1426
|
assigned_to: { type: 'UserResponse', isSingle: true },
|
|
@@ -1460,6 +1458,7 @@ decoders.SearchResultMessage = (input) => {
|
|
|
1460
1458
|
pinned_at: { type: 'DatetimeType', isSingle: true },
|
|
1461
1459
|
thread_participants: { type: 'UserResponse', isSingle: false },
|
|
1462
1460
|
channel: { type: 'ChannelResponse', isSingle: true },
|
|
1461
|
+
draft: { type: 'DraftResponse', isSingle: true },
|
|
1463
1462
|
pinned_by: { type: 'UserResponse', isSingle: true },
|
|
1464
1463
|
poll: { type: 'PollResponseData', isSingle: true },
|
|
1465
1464
|
quoted_message: { type: 'MessageResponse', isSingle: true },
|
|
@@ -1502,12 +1501,6 @@ decoders.SendReactionResponse = (input) => {
|
|
|
1502
1501
|
};
|
|
1503
1502
|
return decode(typeMappings, input);
|
|
1504
1503
|
};
|
|
1505
|
-
decoders.StartCampaignResponse = (input) => {
|
|
1506
|
-
const typeMappings = {
|
|
1507
|
-
campaign: { type: 'CampaignResponse', isSingle: true },
|
|
1508
|
-
};
|
|
1509
|
-
return decode(typeMappings, input);
|
|
1510
|
-
};
|
|
1511
1504
|
decoders.StopLiveResponse = (input) => {
|
|
1512
1505
|
const typeMappings = {
|
|
1513
1506
|
call: { type: 'CallResponse', isSingle: true },
|
|
@@ -1554,6 +1547,7 @@ decoders.ThreadStateResponse = (input) => {
|
|
|
1554
1547
|
thread_participants: { type: 'ThreadParticipant', isSingle: false },
|
|
1555
1548
|
channel: { type: 'ChannelResponse', isSingle: true },
|
|
1556
1549
|
created_by: { type: 'UserResponse', isSingle: true },
|
|
1550
|
+
draft: { type: 'DraftResponse', isSingle: true },
|
|
1557
1551
|
parent_message: { type: 'MessageResponse', isSingle: true },
|
|
1558
1552
|
};
|
|
1559
1553
|
return decode(typeMappings, input);
|
|
@@ -1712,12 +1706,6 @@ decoders.User = (input) => {
|
|
|
1712
1706
|
};
|
|
1713
1707
|
return decode(typeMappings, input);
|
|
1714
1708
|
};
|
|
1715
|
-
decoders.UserBlock = (input) => {
|
|
1716
|
-
const typeMappings = {
|
|
1717
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1718
|
-
};
|
|
1719
|
-
return decode(typeMappings, input);
|
|
1720
|
-
};
|
|
1721
1709
|
decoders.UserMute = (input) => {
|
|
1722
1710
|
const typeMappings = {
|
|
1723
1711
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -3105,6 +3093,7 @@ class ChatApi extends BaseApi {
|
|
|
3105
3093
|
limit: request?.limit,
|
|
3106
3094
|
next: request?.next,
|
|
3107
3095
|
prev: request?.prev,
|
|
3096
|
+
user_limit: request?.user_limit,
|
|
3108
3097
|
sort: request?.sort,
|
|
3109
3098
|
filter: request?.filter,
|
|
3110
3099
|
};
|
|
@@ -3113,10 +3102,15 @@ class ChatApi extends BaseApi {
|
|
|
3113
3102
|
return { ...response.body, metadata: response.metadata };
|
|
3114
3103
|
};
|
|
3115
3104
|
this.getCampaign = async (request) => {
|
|
3105
|
+
const queryParams = {
|
|
3106
|
+
prev: request?.prev,
|
|
3107
|
+
next: request?.next,
|
|
3108
|
+
limit: request?.limit,
|
|
3109
|
+
};
|
|
3116
3110
|
const pathParams = {
|
|
3117
3111
|
id: request?.id,
|
|
3118
3112
|
};
|
|
3119
|
-
const response = await this.sendRequest('GET', '/api/v2/chat/campaigns/{id}', pathParams,
|
|
3113
|
+
const response = await this.sendRequest('GET', '/api/v2/chat/campaigns/{id}', pathParams, queryParams);
|
|
3120
3114
|
decoders.GetCampaignResponse?.(response.body);
|
|
3121
3115
|
return { ...response.body, metadata: response.metadata };
|
|
3122
3116
|
};
|
|
@@ -3246,6 +3240,32 @@ class ChatApi extends BaseApi {
|
|
|
3246
3240
|
decoders.UpdateChannelResponse?.(response.body);
|
|
3247
3241
|
return { ...response.body, metadata: response.metadata };
|
|
3248
3242
|
};
|
|
3243
|
+
this.deleteDraft = async (request) => {
|
|
3244
|
+
const queryParams = {
|
|
3245
|
+
parent_id: request?.parent_id,
|
|
3246
|
+
user_id: request?.user_id,
|
|
3247
|
+
};
|
|
3248
|
+
const pathParams = {
|
|
3249
|
+
type: request?.type,
|
|
3250
|
+
id: request?.id,
|
|
3251
|
+
};
|
|
3252
|
+
const response = await this.sendRequest('DELETE', '/api/v2/chat/channels/{type}/{id}/draft', pathParams, queryParams);
|
|
3253
|
+
decoders.Response?.(response.body);
|
|
3254
|
+
return { ...response.body, metadata: response.metadata };
|
|
3255
|
+
};
|
|
3256
|
+
this.getDraft = async (request) => {
|
|
3257
|
+
const queryParams = {
|
|
3258
|
+
parent_id: request?.parent_id,
|
|
3259
|
+
user_id: request?.user_id,
|
|
3260
|
+
};
|
|
3261
|
+
const pathParams = {
|
|
3262
|
+
type: request?.type,
|
|
3263
|
+
id: request?.id,
|
|
3264
|
+
};
|
|
3265
|
+
const response = await this.sendRequest('GET', '/api/v2/chat/channels/{type}/{id}/draft', pathParams, queryParams);
|
|
3266
|
+
decoders.GetDraftResponse?.(response.body);
|
|
3267
|
+
return { ...response.body, metadata: response.metadata };
|
|
3268
|
+
};
|
|
3249
3269
|
this.sendEvent = async (request) => {
|
|
3250
3270
|
const pathParams = {
|
|
3251
3271
|
type: request?.type,
|
|
@@ -3584,6 +3604,20 @@ class ChatApi extends BaseApi {
|
|
|
3584
3604
|
decoders.UpdateCommandResponse?.(response.body);
|
|
3585
3605
|
return { ...response.body, metadata: response.metadata };
|
|
3586
3606
|
};
|
|
3607
|
+
this.queryDrafts = async (request) => {
|
|
3608
|
+
const body = {
|
|
3609
|
+
limit: request?.limit,
|
|
3610
|
+
next: request?.next,
|
|
3611
|
+
prev: request?.prev,
|
|
3612
|
+
user_id: request?.user_id,
|
|
3613
|
+
sort: request?.sort,
|
|
3614
|
+
filter: request?.filter,
|
|
3615
|
+
user: request?.user,
|
|
3616
|
+
};
|
|
3617
|
+
const response = await this.sendRequest('POST', '/api/v2/chat/drafts/query', undefined, undefined, body);
|
|
3618
|
+
decoders.QueryDraftsResponse?.(response.body);
|
|
3619
|
+
return { ...response.body, metadata: response.metadata };
|
|
3620
|
+
};
|
|
3587
3621
|
this.exportChannels = async (request) => {
|
|
3588
3622
|
const body = {
|
|
3589
3623
|
channels: request?.channels,
|
|
@@ -4200,6 +4234,22 @@ class ChannelApi {
|
|
|
4200
4234
|
...request,
|
|
4201
4235
|
});
|
|
4202
4236
|
};
|
|
4237
|
+
this.deleteDraft = (request) => {
|
|
4238
|
+
if (!this.id) {
|
|
4239
|
+
throw new Error(`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`);
|
|
4240
|
+
}
|
|
4241
|
+
return this.chatApi.deleteDraft({
|
|
4242
|
+
id: this.id,
|
|
4243
|
+
type: this.type,
|
|
4244
|
+
...request,
|
|
4245
|
+
});
|
|
4246
|
+
};
|
|
4247
|
+
this.getDraft = (request) => {
|
|
4248
|
+
if (!this.id) {
|
|
4249
|
+
throw new Error(`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`);
|
|
4250
|
+
}
|
|
4251
|
+
return this.chatApi.getDraft({ id: this.id, type: this.type, ...request });
|
|
4252
|
+
};
|
|
4203
4253
|
this.sendEvent = (request) => {
|
|
4204
4254
|
if (!this.id) {
|
|
4205
4255
|
throw new Error(`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`);
|
|
@@ -4385,15 +4435,6 @@ class StreamChatClient extends ChatApi {
|
|
|
4385
4435
|
class ModerationApi extends BaseApi {
|
|
4386
4436
|
constructor() {
|
|
4387
4437
|
super(...arguments);
|
|
4388
|
-
this.getModerationAnalytics = async (request) => {
|
|
4389
|
-
const body = {
|
|
4390
|
-
end_date: request?.end_date,
|
|
4391
|
-
start_date: request?.start_date,
|
|
4392
|
-
};
|
|
4393
|
-
const response = await this.sendRequest('POST', '/api/v2/moderation/analytics', undefined, undefined, body);
|
|
4394
|
-
decoders.GetModerationAnalyticsResponse?.(response.body);
|
|
4395
|
-
return { ...response.body, metadata: response.metadata };
|
|
4396
|
-
};
|
|
4397
4438
|
this.ban = async (request) => {
|
|
4398
4439
|
const body = {
|
|
4399
4440
|
target_user_id: request?.target_user_id,
|
|
@@ -4433,7 +4474,6 @@ class ModerationApi extends BaseApi {
|
|
|
4433
4474
|
team: request?.team,
|
|
4434
4475
|
user_id: request?.user_id,
|
|
4435
4476
|
ai_image_config: request?.ai_image_config,
|
|
4436
|
-
ai_image_lite_config: request?.ai_image_lite_config,
|
|
4437
4477
|
ai_text_config: request?.ai_text_config,
|
|
4438
4478
|
ai_video_config: request?.ai_video_config,
|
|
4439
4479
|
automod_platform_circumvention_config: request?.automod_platform_circumvention_config,
|
|
@@ -4548,11 +4588,6 @@ class ModerationApi extends BaseApi {
|
|
|
4548
4588
|
decoders.QueryModerationLogsResponse?.(response.body);
|
|
4549
4589
|
return { ...response.body, metadata: response.metadata };
|
|
4550
4590
|
};
|
|
4551
|
-
this.getModeratorStats = async () => {
|
|
4552
|
-
const response = await this.sendRequest('GET', '/api/v2/moderation/moderator_stats', undefined, undefined);
|
|
4553
|
-
decoders.ModeratorStatsResponse?.(response.body);
|
|
4554
|
-
return { ...response.body, metadata: response.metadata };
|
|
4555
|
-
};
|
|
4556
4591
|
this.mute = async (request) => {
|
|
4557
4592
|
const body = {
|
|
4558
4593
|
target_ids: request?.target_ids,
|
|
@@ -4564,11 +4599,6 @@ class ModerationApi extends BaseApi {
|
|
|
4564
4599
|
decoders.MuteResponse?.(response.body);
|
|
4565
4600
|
return { ...response.body, metadata: response.metadata };
|
|
4566
4601
|
};
|
|
4567
|
-
this.getQueueStats = async () => {
|
|
4568
|
-
const response = await this.sendRequest('GET', '/api/v2/moderation/queue_stats', undefined, undefined);
|
|
4569
|
-
decoders.QueueStatsResponse?.(response.body);
|
|
4570
|
-
return { ...response.body, metadata: response.metadata };
|
|
4571
|
-
};
|
|
4572
4602
|
this.queryReviewQueue = async (request) => {
|
|
4573
4603
|
const body = {
|
|
4574
4604
|
limit: request?.limit,
|
|
@@ -4638,31 +4668,6 @@ class ModerationApi extends BaseApi {
|
|
|
4638
4668
|
decoders.UnmuteResponse?.(response.body);
|
|
4639
4669
|
return { ...response.body, metadata: response.metadata };
|
|
4640
4670
|
};
|
|
4641
|
-
this.queryUsageStats = async (request) => {
|
|
4642
|
-
const body = {
|
|
4643
|
-
limit: request?.limit,
|
|
4644
|
-
next: request?.next,
|
|
4645
|
-
prev: request?.prev,
|
|
4646
|
-
user_id: request?.user_id,
|
|
4647
|
-
sort: request?.sort,
|
|
4648
|
-
filter: request?.filter,
|
|
4649
|
-
user: request?.user,
|
|
4650
|
-
};
|
|
4651
|
-
const response = await this.sendRequest('POST', '/api/v2/moderation/usage_stats', undefined, undefined, body);
|
|
4652
|
-
decoders.QueryUsageStatsResponse?.(response.body);
|
|
4653
|
-
return { ...response.body, metadata: response.metadata };
|
|
4654
|
-
};
|
|
4655
|
-
this.getUserReport = async (request) => {
|
|
4656
|
-
const queryParams = {
|
|
4657
|
-
user_id: request?.user_id,
|
|
4658
|
-
create_user_if_not_exists: request?.create_user_if_not_exists,
|
|
4659
|
-
include_user_mutes: request?.include_user_mutes,
|
|
4660
|
-
include_user_blocks: request?.include_user_blocks,
|
|
4661
|
-
};
|
|
4662
|
-
const response = await this.sendRequest('GET', '/api/v2/moderation/user_report', undefined, queryParams);
|
|
4663
|
-
decoders.GetUserModerationReportResponse?.(response.body);
|
|
4664
|
-
return { ...response.body, metadata: response.metadata };
|
|
4665
|
-
};
|
|
4666
4671
|
}
|
|
4667
4672
|
}
|
|
4668
4673
|
|
|
@@ -4681,7 +4686,13 @@ class StreamClient extends CommonApi {
|
|
|
4681
4686
|
const timeout = config?.timeout ?? StreamClient.DEFAULT_TIMEOUT;
|
|
4682
4687
|
const chatBaseUrl = config?.basePath ?? 'https://chat.stream-io-api.com';
|
|
4683
4688
|
const videoBaseUrl = config?.basePath ?? 'https://video.stream-io-api.com';
|
|
4684
|
-
super({
|
|
4689
|
+
super({
|
|
4690
|
+
apiKey,
|
|
4691
|
+
token,
|
|
4692
|
+
timeout,
|
|
4693
|
+
baseUrl: chatBaseUrl,
|
|
4694
|
+
agent: config?.agent,
|
|
4695
|
+
});
|
|
4685
4696
|
this.apiKey = apiKey;
|
|
4686
4697
|
this.secret = secret;
|
|
4687
4698
|
this.config = config;
|
|
@@ -4782,18 +4793,21 @@ class StreamClient extends CommonApi {
|
|
|
4782
4793
|
token,
|
|
4783
4794
|
timeout,
|
|
4784
4795
|
baseUrl: videoBaseUrl,
|
|
4796
|
+
agent: config?.agent,
|
|
4785
4797
|
});
|
|
4786
4798
|
this.chat = new StreamChatClient({
|
|
4787
4799
|
apiKey,
|
|
4788
4800
|
token,
|
|
4789
4801
|
timeout,
|
|
4790
4802
|
baseUrl: chatBaseUrl,
|
|
4803
|
+
agent: config?.agent,
|
|
4791
4804
|
});
|
|
4792
4805
|
this.moderation = new StreamModerationClient({
|
|
4793
4806
|
apiKey,
|
|
4794
4807
|
token,
|
|
4795
4808
|
timeout,
|
|
4796
4809
|
baseUrl: chatBaseUrl,
|
|
4810
|
+
agent: config?.agent,
|
|
4797
4811
|
});
|
|
4798
4812
|
}
|
|
4799
4813
|
}
|