@stream-io/node-sdk 0.4.1 → 0.4.3
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 +174 -134
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +174 -134
- package/dist/index.es.js.map +1 -1
- package/dist/src/StreamChannel.d.ts +2 -2
- package/dist/src/StreamClient.d.ts +2 -2
- package/dist/src/gen/chat/ChannelApi.d.ts +4 -1
- package/dist/src/gen/chat/ChatApi.d.ts +10 -5
- package/dist/src/gen/models/index.d.ts +40 -14
- package/package.json +4 -2
- package/src/BaseApi.ts +12 -3
- package/src/StreamChannel.ts +2 -2
- package/src/StreamClient.ts +2 -2
- package/src/gen/chat/ChannelApi.ts +17 -0
- package/src/gen/chat/ChatApi.ts +42 -8
- package/src/gen/model-decoders/index.ts +31 -19
- package/src/gen/models/index.ts +60 -16
- package/src/gen/moderation/ModerationApi.ts +2 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ChannelApi } from './gen/chat/ChannelApi';
|
|
2
|
-
import { ChannelGetOrCreateRequest,
|
|
2
|
+
import { ChannelGetOrCreateRequest, QueryMembersPayload } from './gen/models';
|
|
3
3
|
import { OmitTypeId } from './types';
|
|
4
4
|
export declare class StreamChannel extends ChannelApi {
|
|
5
5
|
get cid(): string;
|
|
6
6
|
getOrCreate: (channel_get_or_create_request?: ChannelGetOrCreateRequest) => Promise<import("./types").StreamResponse<import("./gen/models").ChannelStateResponse>>;
|
|
7
7
|
queryMembers(request?: {
|
|
8
|
-
payload?: OmitTypeId<
|
|
8
|
+
payload?: OmitTypeId<QueryMembersPayload>;
|
|
9
9
|
}): Promise<import("./types").StreamResponse<import("./gen/models").MembersResponse>>;
|
|
10
10
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { CommonApi } from './gen/common/CommonApi';
|
|
3
3
|
import { StreamVideoClient } from './StreamVideoClient';
|
|
4
4
|
import { StreamChatClient } from './StreamChatClient';
|
|
5
|
-
import {
|
|
5
|
+
import { QueryBannedUsersPayload, UserRequest } from './gen/models';
|
|
6
6
|
import { StreamModerationClient } from './StreamModerationClient';
|
|
7
7
|
export interface StreamClientOptions {
|
|
8
8
|
timeout?: number;
|
|
@@ -26,7 +26,7 @@ export declare class StreamClient extends CommonApi {
|
|
|
26
26
|
constructor(apiKey: string, secret: string, config?: StreamClientOptions | undefined);
|
|
27
27
|
upsertUsers: (users: UserRequest[]) => Promise<import("./types").StreamResponse<import("./gen/models").UpdateUsersResponse>>;
|
|
28
28
|
queryBannedUsers: (request?: {
|
|
29
|
-
payload?:
|
|
29
|
+
payload?: QueryBannedUsersPayload;
|
|
30
30
|
}) => Promise<import("./types").StreamResponse<import("./gen/models").QueryBannedUsersResponse>>;
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChatApi } from './ChatApi';
|
|
2
2
|
import { StreamResponse } from '../../types';
|
|
3
|
-
import { ChannelGetOrCreateRequest, ChannelStateResponse, DeleteChannelResponse, EventResponse, FileUploadRequest, FileUploadResponse, GetManyMessagesResponse, HideChannelRequest, HideChannelResponse, ImageUploadRequest, ImageUploadResponse, MarkReadRequest, MarkReadResponse, MarkUnreadRequest, Response, SendEventRequest, SendMessageRequest, SendMessageResponse, ShowChannelRequest, ShowChannelResponse, TruncateChannelRequest, TruncateChannelResponse, UpdateChannelPartialRequest, UpdateChannelPartialResponse, UpdateChannelRequest, UpdateChannelResponse } from '../models';
|
|
3
|
+
import { ChannelGetOrCreateRequest, ChannelStateResponse, DeleteChannelResponse, EventResponse, FileUploadRequest, FileUploadResponse, GetManyMessagesResponse, HideChannelRequest, HideChannelResponse, ImageUploadRequest, ImageUploadResponse, MarkReadRequest, MarkReadResponse, MarkUnreadRequest, Response, SendEventRequest, SendMessageRequest, SendMessageResponse, ShowChannelRequest, ShowChannelResponse, TruncateChannelRequest, TruncateChannelResponse, UpdateChannelPartialRequest, UpdateChannelPartialResponse, UpdateChannelRequest, UpdateChannelResponse, UpdateMemberPartialRequest, UpdateMemberPartialResponse } from '../models';
|
|
4
4
|
export declare class ChannelApi {
|
|
5
5
|
protected chatApi: ChatApi;
|
|
6
6
|
readonly type: string;
|
|
@@ -21,6 +21,9 @@ export declare class ChannelApi {
|
|
|
21
21
|
url?: string;
|
|
22
22
|
}) => Promise<StreamResponse<Response>>;
|
|
23
23
|
uploadImage: (request?: ImageUploadRequest) => Promise<StreamResponse<ImageUploadResponse>>;
|
|
24
|
+
updateMemberPartial: (request: UpdateMemberPartialRequest & {
|
|
25
|
+
user_id: string;
|
|
26
|
+
}) => Promise<StreamResponse<UpdateMemberPartialResponse>>;
|
|
24
27
|
sendMessage: (request: SendMessageRequest) => Promise<StreamResponse<SendMessageResponse>>;
|
|
25
28
|
getManyMessages: (request: {
|
|
26
29
|
ids: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseApi } from '../../BaseApi';
|
|
2
2
|
import { StreamResponse } from '../../types';
|
|
3
|
-
import { CastPollVoteRequest, ChannelGetOrCreateRequest, ChannelStateResponse, CommitMessageRequest, CreateChannelTypeRequest, CreateChannelTypeResponse, CreateCommandRequest, CreateCommandResponse, CreatePollOptionRequest, CreatePollRequest, DeleteChannelResponse, DeleteChannelsRequest, DeleteChannelsResponse, DeleteCommandResponse, DeleteMessageResponse, EventResponse, ExportChannelsRequest, ExportChannelsResponse, FileUploadRequest, FileUploadResponse, GetChannelTypeResponse, GetCommandResponse, GetExportChannelsStatusResponse, GetManyMessagesResponse, GetMessageResponse, GetReactionsResponse, GetRepliesResponse, GetThreadResponse, HideChannelRequest, HideChannelResponse, ImageUploadRequest, ImageUploadResponse, ListChannelTypesResponse, ListCommandsResponse, MarkChannelsReadRequest, MarkReadRequest, MarkReadResponse, MarkUnreadRequest, MembersResponse, MessageActionRequest, MessageResponse, MuteChannelRequest, MuteChannelResponse, PollOptionResponse, PollResponse, PollVoteResponse, PollVotesResponse,
|
|
3
|
+
import { CastPollVoteRequest, ChannelGetOrCreateRequest, ChannelStateResponse, CommitMessageRequest, CreateChannelTypeRequest, CreateChannelTypeResponse, CreateCommandRequest, CreateCommandResponse, CreatePollOptionRequest, CreatePollRequest, DeleteChannelResponse, DeleteChannelsRequest, DeleteChannelsResponse, DeleteCommandResponse, DeleteMessageResponse, EventResponse, ExportChannelsRequest, ExportChannelsResponse, FileUploadRequest, FileUploadResponse, GetChannelTypeResponse, GetCommandResponse, GetExportChannelsStatusResponse, GetManyMessagesResponse, GetMessageResponse, GetReactionsResponse, GetRepliesResponse, GetThreadResponse, HideChannelRequest, HideChannelResponse, ImageUploadRequest, ImageUploadResponse, ListChannelTypesResponse, ListCommandsResponse, MarkChannelsReadRequest, MarkReadRequest, MarkReadResponse, MarkUnreadRequest, MembersResponse, MessageActionRequest, MessageResponse, MuteChannelRequest, MuteChannelResponse, PollOptionResponse, PollResponse, PollVoteResponse, PollVotesResponse, QueryBannedUsersPayload, QueryBannedUsersResponse, QueryChannelsRequest, QueryChannelsResponse, QueryMembersPayload, QueryMessageFlagsPayload, QueryMessageFlagsResponse, QueryMessageHistoryRequest, QueryMessageHistoryResponse, QueryPollVotesRequest, QueryPollsRequest, QueryPollsResponse, QueryReactionsRequest, QueryReactionsResponse, QueryThreadsRequest, QueryThreadsResponse, ReactionRemovalResponse, Response, SearchPayload, SearchResponse, SendEventRequest, SendMessageRequest, SendMessageResponse, SendReactionRequest, SendReactionResponse, SendUserCustomEventRequest, ShowChannelRequest, ShowChannelResponse, SortParamRequest, TranslateMessageRequest, TruncateChannelRequest, TruncateChannelResponse, UnmuteChannelRequest, UnmuteResponse, UnreadCountsBatchRequest, UnreadCountsBatchResponse, UpdateChannelPartialRequest, UpdateChannelPartialResponse, UpdateChannelRequest, UpdateChannelResponse, UpdateChannelTypeRequest, UpdateChannelTypeResponse, UpdateCommandRequest, UpdateCommandResponse, UpdateMemberPartialRequest, UpdateMemberPartialResponse, UpdateMessagePartialRequest, UpdateMessagePartialResponse, UpdateMessageRequest, UpdateMessageResponse, UpdatePollOptionRequest, UpdatePollPartialRequest, UpdatePollRequest, UpdateThreadPartialRequest, UpdateThreadPartialResponse, WrappedUnreadCountsResponse } from '../models';
|
|
4
4
|
export declare class ChatApi extends BaseApi {
|
|
5
5
|
queryChannels: (request?: QueryChannelsRequest) => Promise<StreamResponse<QueryChannelsResponse>>;
|
|
6
6
|
deleteChannels: (request: DeleteChannelsRequest) => Promise<StreamResponse<DeleteChannelsResponse>>;
|
|
@@ -47,6 +47,11 @@ export declare class ChatApi extends BaseApi {
|
|
|
47
47
|
type: string;
|
|
48
48
|
id: string;
|
|
49
49
|
}) => Promise<StreamResponse<ImageUploadResponse>>;
|
|
50
|
+
updateMemberPartial: (request: UpdateMemberPartialRequest & {
|
|
51
|
+
user_id: string;
|
|
52
|
+
type: string;
|
|
53
|
+
id: string;
|
|
54
|
+
}) => Promise<StreamResponse<UpdateMemberPartialResponse>>;
|
|
50
55
|
sendMessage: (request: SendMessageRequest & {
|
|
51
56
|
type: string;
|
|
52
57
|
id: string;
|
|
@@ -103,7 +108,7 @@ export declare class ChatApi extends BaseApi {
|
|
|
103
108
|
id: string;
|
|
104
109
|
}) => Promise<StreamResponse<GetExportChannelsStatusResponse>>;
|
|
105
110
|
queryMembers: (request?: {
|
|
106
|
-
payload?:
|
|
111
|
+
payload?: QueryMembersPayload;
|
|
107
112
|
}) => Promise<StreamResponse<MembersResponse>>;
|
|
108
113
|
queryMessageHistory: (request: QueryMessageHistoryRequest) => Promise<StreamResponse<QueryMessageHistoryResponse>>;
|
|
109
114
|
deleteMessage: (request: {
|
|
@@ -176,7 +181,7 @@ export declare class ChatApi extends BaseApi {
|
|
|
176
181
|
sort?: SortParamRequest[];
|
|
177
182
|
}) => Promise<StreamResponse<GetRepliesResponse>>;
|
|
178
183
|
queryMessageFlags: (request?: {
|
|
179
|
-
payload?:
|
|
184
|
+
payload?: QueryMessageFlagsPayload;
|
|
180
185
|
}) => Promise<StreamResponse<QueryMessageFlagsResponse>>;
|
|
181
186
|
muteChannel: (request?: MuteChannelRequest) => Promise<StreamResponse<MuteChannelResponse>>;
|
|
182
187
|
unmuteChannel: (request?: UnmuteChannelRequest) => Promise<StreamResponse<UnmuteResponse>>;
|
|
@@ -217,10 +222,10 @@ export declare class ChatApi extends BaseApi {
|
|
|
217
222
|
user_id?: string;
|
|
218
223
|
}) => Promise<StreamResponse<PollVotesResponse>>;
|
|
219
224
|
queryBannedUsers: (request?: {
|
|
220
|
-
payload?:
|
|
225
|
+
payload?: QueryBannedUsersPayload;
|
|
221
226
|
}) => Promise<StreamResponse<QueryBannedUsersResponse>>;
|
|
222
227
|
search: (request?: {
|
|
223
|
-
payload?:
|
|
228
|
+
payload?: SearchPayload;
|
|
224
229
|
}) => Promise<StreamResponse<SearchResponse>>;
|
|
225
230
|
queryThreads: (request?: QueryThreadsRequest) => Promise<StreamResponse<QueryThreadsResponse>>;
|
|
226
231
|
getThread: (request: {
|
|
@@ -613,6 +613,7 @@ export interface ChannelMember {
|
|
|
613
613
|
notifications_muted: boolean;
|
|
614
614
|
shadow_banned: boolean;
|
|
615
615
|
updated_at: Date;
|
|
616
|
+
custom: Record<string, any>;
|
|
616
617
|
ban_expires?: Date;
|
|
617
618
|
deleted_at?: Date;
|
|
618
619
|
invite_accepted_at?: Date;
|
|
@@ -630,6 +631,7 @@ export interface ChannelMemberResponse {
|
|
|
630
631
|
notifications_muted: boolean;
|
|
631
632
|
shadow_banned: boolean;
|
|
632
633
|
updated_at: Date;
|
|
634
|
+
custom: Record<string, any>;
|
|
633
635
|
ban_expires?: Date;
|
|
634
636
|
deleted_at?: Date;
|
|
635
637
|
invite_accepted_at?: Date;
|
|
@@ -685,7 +687,7 @@ export interface ChannelStateResponse {
|
|
|
685
687
|
hidden?: boolean;
|
|
686
688
|
hide_messages_before?: Date;
|
|
687
689
|
watcher_count?: number;
|
|
688
|
-
pending_messages?:
|
|
690
|
+
pending_messages?: PendingMessageResponse[];
|
|
689
691
|
read?: ReadStateResponse[];
|
|
690
692
|
watchers?: UserResponse[];
|
|
691
693
|
channel?: ChannelResponse;
|
|
@@ -699,7 +701,7 @@ export interface ChannelStateResponseFields {
|
|
|
699
701
|
hidden?: boolean;
|
|
700
702
|
hide_messages_before?: Date;
|
|
701
703
|
watcher_count?: number;
|
|
702
|
-
pending_messages?:
|
|
704
|
+
pending_messages?: PendingMessageResponse[];
|
|
703
705
|
read?: ReadStateResponse[];
|
|
704
706
|
watchers?: UserResponse[];
|
|
705
707
|
channel?: ChannelResponse;
|
|
@@ -840,6 +842,7 @@ export interface ConfigResponse {
|
|
|
840
842
|
block_list_config?: BlockListConfig;
|
|
841
843
|
bodyguard_config?: BodyguardConfig;
|
|
842
844
|
go_og_le_vision_config?: GoogleVisionConfig;
|
|
845
|
+
velocity_filter_config?: VelocityFilterConfig;
|
|
843
846
|
}
|
|
844
847
|
export interface Coordinates {
|
|
845
848
|
latitude: number;
|
|
@@ -1075,6 +1078,7 @@ export interface DeactivateUsersResponse {
|
|
|
1075
1078
|
task_id: string;
|
|
1076
1079
|
}
|
|
1077
1080
|
export interface DeleteActivityRequest {
|
|
1081
|
+
hard_delete?: boolean;
|
|
1078
1082
|
}
|
|
1079
1083
|
export interface DeleteCallRequest {
|
|
1080
1084
|
hard?: boolean;
|
|
@@ -1374,6 +1378,7 @@ export interface FullUserResponse {
|
|
|
1374
1378
|
shadow_banned: boolean;
|
|
1375
1379
|
total_unread_count: number;
|
|
1376
1380
|
unread_channels: number;
|
|
1381
|
+
unread_count: number;
|
|
1377
1382
|
unread_threads: number;
|
|
1378
1383
|
updated_at: Date;
|
|
1379
1384
|
blocked_user_ids: string[];
|
|
@@ -1939,6 +1944,7 @@ export interface MessageFlagResponse {
|
|
|
1939
1944
|
user?: UserResponse;
|
|
1940
1945
|
}
|
|
1941
1946
|
export interface MessageHistoryEntryResponse {
|
|
1947
|
+
is_deleted: boolean;
|
|
1942
1948
|
message_id: string;
|
|
1943
1949
|
message_updated_at: Date;
|
|
1944
1950
|
message_updated_by_id: string;
|
|
@@ -2084,7 +2090,6 @@ export interface ModerationActionConfig {
|
|
|
2084
2090
|
custom: Record<string, any>;
|
|
2085
2091
|
}
|
|
2086
2092
|
export interface ModerationPayload {
|
|
2087
|
-
created_at?: Date;
|
|
2088
2093
|
images?: string[];
|
|
2089
2094
|
texts?: string[];
|
|
2090
2095
|
videos?: string[];
|
|
@@ -2229,11 +2234,11 @@ export interface PaginationParams {
|
|
|
2229
2234
|
limit?: number;
|
|
2230
2235
|
offset?: number;
|
|
2231
2236
|
}
|
|
2232
|
-
export interface
|
|
2233
|
-
channel?:
|
|
2234
|
-
message?:
|
|
2237
|
+
export interface PendingMessageResponse {
|
|
2238
|
+
channel?: ChannelResponse;
|
|
2239
|
+
message?: MessageResponse;
|
|
2235
2240
|
metadata?: Record<string, string>;
|
|
2236
|
-
user?:
|
|
2241
|
+
user?: UserResponse;
|
|
2237
2242
|
}
|
|
2238
2243
|
export interface Permission {
|
|
2239
2244
|
action: string;
|
|
@@ -2476,7 +2481,7 @@ export interface PushProviderResponse {
|
|
|
2476
2481
|
xiaomi_app_secret?: string;
|
|
2477
2482
|
xiaomi_package_name?: string;
|
|
2478
2483
|
}
|
|
2479
|
-
export interface
|
|
2484
|
+
export interface QueryBannedUsersPayload {
|
|
2480
2485
|
filter_conditions: Record<string, any>;
|
|
2481
2486
|
exclude_expired_bans?: boolean;
|
|
2482
2487
|
limit?: number;
|
|
@@ -2555,7 +2560,7 @@ export interface QueryFeedModerationTemplatesResponse {
|
|
|
2555
2560
|
duration: string;
|
|
2556
2561
|
templates: QueryFeedModerationTemplate[];
|
|
2557
2562
|
}
|
|
2558
|
-
export interface
|
|
2563
|
+
export interface QueryMembersPayload {
|
|
2559
2564
|
type: string;
|
|
2560
2565
|
filter_conditions: Record<string, any>;
|
|
2561
2566
|
id?: string;
|
|
@@ -2566,7 +2571,7 @@ export interface QueryMembersRequest {
|
|
|
2566
2571
|
sort?: SortParamRequest[];
|
|
2567
2572
|
user?: UserRequest;
|
|
2568
2573
|
}
|
|
2569
|
-
export interface
|
|
2574
|
+
export interface QueryMessageFlagsPayload {
|
|
2570
2575
|
limit?: number;
|
|
2571
2576
|
offset?: number;
|
|
2572
2577
|
show_deleted_messages?: boolean;
|
|
@@ -2922,7 +2927,7 @@ export interface ScreensharingSettingsResponse {
|
|
|
2922
2927
|
enabled: boolean;
|
|
2923
2928
|
target_resolution?: TargetResolution;
|
|
2924
2929
|
}
|
|
2925
|
-
export interface
|
|
2930
|
+
export interface SearchPayload {
|
|
2926
2931
|
filter_conditions: Record<string, any>;
|
|
2927
2932
|
limit?: number;
|
|
2928
2933
|
next?: string;
|
|
@@ -3097,11 +3102,12 @@ export interface StopTranscriptionResponse {
|
|
|
3097
3102
|
duration: string;
|
|
3098
3103
|
}
|
|
3099
3104
|
export interface SubmitActionRequest {
|
|
3100
|
-
action_type: '
|
|
3105
|
+
action_type: 'mark_reviewed' | 'delete_message' | 'delete_activity' | 'delete_reaction' | 'ban' | 'custom' | 'unban' | 'restore' | 'delete_user' | 'unblock';
|
|
3101
3106
|
item_id: string;
|
|
3102
3107
|
user_id?: string;
|
|
3103
3108
|
ban?: BanActionRequest;
|
|
3104
3109
|
custom?: CustomActionRequest;
|
|
3110
|
+
delete_activity?: DeleteActivityRequest;
|
|
3105
3111
|
delete_message?: DeleteMessageRequest;
|
|
3106
3112
|
delete_reaction?: DeleteReactionRequest;
|
|
3107
3113
|
delete_user?: DeleteUserRequest;
|
|
@@ -3183,7 +3189,7 @@ export interface ThreadStateResponse {
|
|
|
3183
3189
|
parent_message_id: string;
|
|
3184
3190
|
title: string;
|
|
3185
3191
|
updated_at: Date;
|
|
3186
|
-
latest_replies:
|
|
3192
|
+
latest_replies: MessageResponse[];
|
|
3187
3193
|
custom: Record<string, any>;
|
|
3188
3194
|
active_participant_count?: number;
|
|
3189
3195
|
deleted_at?: Date;
|
|
@@ -3248,7 +3254,7 @@ export interface TruncateChannelRequest {
|
|
|
3248
3254
|
export interface TruncateChannelResponse {
|
|
3249
3255
|
duration: string;
|
|
3250
3256
|
channel?: ChannelResponse;
|
|
3251
|
-
message?:
|
|
3257
|
+
message?: MessageResponse;
|
|
3252
3258
|
}
|
|
3253
3259
|
export interface TypingIndicators {
|
|
3254
3260
|
enabled?: boolean;
|
|
@@ -3540,6 +3546,14 @@ export interface UpdateExternalStorageResponse {
|
|
|
3540
3546
|
path: string;
|
|
3541
3547
|
type: 's3' | 'gcs' | 'abs';
|
|
3542
3548
|
}
|
|
3549
|
+
export interface UpdateMemberPartialRequest {
|
|
3550
|
+
unset?: string[];
|
|
3551
|
+
set?: Record<string, any>;
|
|
3552
|
+
}
|
|
3553
|
+
export interface UpdateMemberPartialResponse {
|
|
3554
|
+
duration: string;
|
|
3555
|
+
channel_member?: ChannelMemberResponse;
|
|
3556
|
+
}
|
|
3543
3557
|
export interface UpdateMessagePartialRequest {
|
|
3544
3558
|
skip_enrich_url?: boolean;
|
|
3545
3559
|
user_id?: string;
|
|
@@ -3633,6 +3647,7 @@ export interface UpsertConfigRequest {
|
|
|
3633
3647
|
block_list_config?: BlockListConfig;
|
|
3634
3648
|
bodyguard_config?: BodyguardConfig;
|
|
3635
3649
|
go_og_le_vision_config?: GoogleVisionConfig;
|
|
3650
|
+
velocity_filter_config?: VelocityFilterConfig;
|
|
3636
3651
|
}
|
|
3637
3652
|
export interface UpsertConfigResponse {
|
|
3638
3653
|
duration: string;
|
|
@@ -3744,6 +3759,7 @@ export interface UserSessionStats {
|
|
|
3744
3759
|
freeze_duration_seconds: number;
|
|
3745
3760
|
max_freeze_fraction: number;
|
|
3746
3761
|
max_freezes_duration_seconds: number;
|
|
3762
|
+
min_event_ts: number;
|
|
3747
3763
|
packet_loss_fraction: number;
|
|
3748
3764
|
publisher_packet_loss_fraction: number;
|
|
3749
3765
|
publishing_duration_seconds: number;
|
|
@@ -3799,6 +3815,16 @@ export interface UserStats {
|
|
|
3799
3815
|
info: UserInfoResponse;
|
|
3800
3816
|
rating?: number;
|
|
3801
3817
|
}
|
|
3818
|
+
export interface VelocityFilterConfig {
|
|
3819
|
+
enabled?: boolean;
|
|
3820
|
+
rule?: VelocityFilterConfigRule[];
|
|
3821
|
+
}
|
|
3822
|
+
export interface VelocityFilterConfigRule {
|
|
3823
|
+
action: 'flag' | 'shadow' | 'remove' | 'ban';
|
|
3824
|
+
ip_ban?: boolean;
|
|
3825
|
+
shadow_ban?: boolean;
|
|
3826
|
+
timeout?: Date;
|
|
3827
|
+
}
|
|
3802
3828
|
export interface VideoQuality {
|
|
3803
3829
|
usage_type?: string;
|
|
3804
3830
|
resolution?: VideoResolution;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/node-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -74,5 +74,7 @@
|
|
|
74
74
|
"jsonwebtoken": "^9.0.2",
|
|
75
75
|
"uuid": "^9.0.1"
|
|
76
76
|
},
|
|
77
|
-
"
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": ">=18.0.0"
|
|
79
|
+
}
|
|
78
80
|
}
|
package/src/BaseApi.ts
CHANGED
|
@@ -52,11 +52,20 @@ export class BaseApi {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
if (response.status < 200 || response.status >= 300) {
|
|
55
|
-
|
|
55
|
+
let error: APIError;
|
|
56
|
+
try {
|
|
57
|
+
error = (await response.json()) as APIError;
|
|
58
|
+
} catch (_) {
|
|
59
|
+
throw new StreamError(
|
|
60
|
+
`Stream error: ${response.status} - ${response.statusText}`,
|
|
61
|
+
metadata,
|
|
62
|
+
response.status,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
56
65
|
throw new StreamError(
|
|
57
|
-
`Stream error code ${error
|
|
66
|
+
`Stream error code ${error!.code}: ${error!.message}`,
|
|
58
67
|
metadata,
|
|
59
|
-
error
|
|
68
|
+
error!.code,
|
|
60
69
|
undefined,
|
|
61
70
|
);
|
|
62
71
|
}
|
package/src/StreamChannel.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChannelApi } from './gen/chat/ChannelApi';
|
|
2
|
-
import { ChannelGetOrCreateRequest,
|
|
2
|
+
import { ChannelGetOrCreateRequest, QueryMembersPayload } from './gen/models';
|
|
3
3
|
import { OmitTypeId } from './types';
|
|
4
4
|
|
|
5
5
|
export class StreamChannel extends ChannelApi {
|
|
@@ -27,7 +27,7 @@ export class StreamChannel extends ChannelApi {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
queryMembers(request?: { payload?: OmitTypeId<
|
|
30
|
+
queryMembers(request?: { payload?: OmitTypeId<QueryMembersPayload> }) {
|
|
31
31
|
return this.chatApi.queryMembers({
|
|
32
32
|
payload: {
|
|
33
33
|
id: this.id,
|
package/src/StreamClient.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { StreamVideoClient } from './StreamVideoClient';
|
|
|
4
4
|
import crypto from 'crypto';
|
|
5
5
|
import { StreamChatClient } from './StreamChatClient';
|
|
6
6
|
import { CallTokenPayload, UserTokenPayload } from './types';
|
|
7
|
-
import {
|
|
7
|
+
import { QueryBannedUsersPayload, UserRequest } from './gen/models';
|
|
8
8
|
import { StreamModerationClient } from './StreamModerationClient';
|
|
9
9
|
|
|
10
10
|
export interface StreamClientOptions {
|
|
@@ -67,7 +67,7 @@ export class StreamClient extends CommonApi {
|
|
|
67
67
|
return this.updateUsers({ users: payload });
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
queryBannedUsers = (request?: { payload?:
|
|
70
|
+
queryBannedUsers = (request?: { payload?: QueryBannedUsersPayload }) => {
|
|
71
71
|
return this.chat.queryBannedUsers(request);
|
|
72
72
|
};
|
|
73
73
|
|
|
@@ -27,6 +27,8 @@ import {
|
|
|
27
27
|
UpdateChannelPartialResponse,
|
|
28
28
|
UpdateChannelRequest,
|
|
29
29
|
UpdateChannelResponse,
|
|
30
|
+
UpdateMemberPartialRequest,
|
|
31
|
+
UpdateMemberPartialResponse,
|
|
30
32
|
} from '../models';
|
|
31
33
|
|
|
32
34
|
export class ChannelApi {
|
|
@@ -167,6 +169,21 @@ export class ChannelApi {
|
|
|
167
169
|
});
|
|
168
170
|
};
|
|
169
171
|
|
|
172
|
+
updateMemberPartial = (
|
|
173
|
+
request: UpdateMemberPartialRequest & { user_id: string },
|
|
174
|
+
): Promise<StreamResponse<UpdateMemberPartialResponse>> => {
|
|
175
|
+
if (!this.id) {
|
|
176
|
+
throw new Error(
|
|
177
|
+
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
return this.chatApi.updateMemberPartial({
|
|
181
|
+
id: this.id,
|
|
182
|
+
type: this.type,
|
|
183
|
+
...request,
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
|
|
170
187
|
sendMessage = (
|
|
171
188
|
request: SendMessageRequest,
|
|
172
189
|
): Promise<StreamResponse<SendMessageResponse>> => {
|
package/src/gen/chat/ChatApi.ts
CHANGED
|
@@ -48,12 +48,12 @@ import {
|
|
|
48
48
|
PollResponse,
|
|
49
49
|
PollVoteResponse,
|
|
50
50
|
PollVotesResponse,
|
|
51
|
-
|
|
51
|
+
QueryBannedUsersPayload,
|
|
52
52
|
QueryBannedUsersResponse,
|
|
53
53
|
QueryChannelsRequest,
|
|
54
54
|
QueryChannelsResponse,
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
QueryMembersPayload,
|
|
56
|
+
QueryMessageFlagsPayload,
|
|
57
57
|
QueryMessageFlagsResponse,
|
|
58
58
|
QueryMessageHistoryRequest,
|
|
59
59
|
QueryMessageHistoryResponse,
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
QueryThreadsResponse,
|
|
67
67
|
ReactionRemovalResponse,
|
|
68
68
|
Response,
|
|
69
|
-
|
|
69
|
+
SearchPayload,
|
|
70
70
|
SearchResponse,
|
|
71
71
|
SendEventRequest,
|
|
72
72
|
SendMessageRequest,
|
|
@@ -92,6 +92,8 @@ import {
|
|
|
92
92
|
UpdateChannelTypeResponse,
|
|
93
93
|
UpdateCommandRequest,
|
|
94
94
|
UpdateCommandResponse,
|
|
95
|
+
UpdateMemberPartialRequest,
|
|
96
|
+
UpdateMemberPartialResponse,
|
|
95
97
|
UpdateMessagePartialRequest,
|
|
96
98
|
UpdateMessagePartialResponse,
|
|
97
99
|
UpdateMessageRequest,
|
|
@@ -440,6 +442,38 @@ export class ChatApi extends BaseApi {
|
|
|
440
442
|
return { ...response.body, metadata: response.metadata };
|
|
441
443
|
};
|
|
442
444
|
|
|
445
|
+
updateMemberPartial = async (
|
|
446
|
+
request: UpdateMemberPartialRequest & {
|
|
447
|
+
user_id: string;
|
|
448
|
+
type: string;
|
|
449
|
+
id: string;
|
|
450
|
+
},
|
|
451
|
+
): Promise<StreamResponse<UpdateMemberPartialResponse>> => {
|
|
452
|
+
const pathParams = {
|
|
453
|
+
user_id: request?.user_id,
|
|
454
|
+
type: request?.type,
|
|
455
|
+
id: request?.id,
|
|
456
|
+
};
|
|
457
|
+
const body = {
|
|
458
|
+
unset: request?.unset,
|
|
459
|
+
set: request?.set,
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
const response = await this.sendRequest<
|
|
463
|
+
StreamResponse<UpdateMemberPartialResponse>
|
|
464
|
+
>(
|
|
465
|
+
'PATCH',
|
|
466
|
+
'/api/v2/chat/channels/{type}/{id}/member/{user_id}',
|
|
467
|
+
pathParams,
|
|
468
|
+
undefined,
|
|
469
|
+
body,
|
|
470
|
+
);
|
|
471
|
+
|
|
472
|
+
decoders.UpdateMemberPartialResponse?.(response.body);
|
|
473
|
+
|
|
474
|
+
return { ...response.body, metadata: response.metadata };
|
|
475
|
+
};
|
|
476
|
+
|
|
443
477
|
sendMessage = async (
|
|
444
478
|
request: SendMessageRequest & { type: string; id: string },
|
|
445
479
|
): Promise<StreamResponse<SendMessageResponse>> => {
|
|
@@ -900,7 +934,7 @@ export class ChatApi extends BaseApi {
|
|
|
900
934
|
};
|
|
901
935
|
|
|
902
936
|
queryMembers = async (request?: {
|
|
903
|
-
payload?:
|
|
937
|
+
payload?: QueryMembersPayload;
|
|
904
938
|
}): Promise<StreamResponse<MembersResponse>> => {
|
|
905
939
|
const queryParams = {
|
|
906
940
|
payload: request?.payload,
|
|
@@ -1329,7 +1363,7 @@ export class ChatApi extends BaseApi {
|
|
|
1329
1363
|
};
|
|
1330
1364
|
|
|
1331
1365
|
queryMessageFlags = async (request?: {
|
|
1332
|
-
payload?:
|
|
1366
|
+
payload?: QueryMessageFlagsPayload;
|
|
1333
1367
|
}): Promise<StreamResponse<QueryMessageFlagsResponse>> => {
|
|
1334
1368
|
const queryParams = {
|
|
1335
1369
|
payload: request?.payload,
|
|
@@ -1690,7 +1724,7 @@ export class ChatApi extends BaseApi {
|
|
|
1690
1724
|
};
|
|
1691
1725
|
|
|
1692
1726
|
queryBannedUsers = async (request?: {
|
|
1693
|
-
payload?:
|
|
1727
|
+
payload?: QueryBannedUsersPayload;
|
|
1694
1728
|
}): Promise<StreamResponse<QueryBannedUsersResponse>> => {
|
|
1695
1729
|
const queryParams = {
|
|
1696
1730
|
payload: request?.payload,
|
|
@@ -1706,7 +1740,7 @@ export class ChatApi extends BaseApi {
|
|
|
1706
1740
|
};
|
|
1707
1741
|
|
|
1708
1742
|
search = async (request?: {
|
|
1709
|
-
payload?:
|
|
1743
|
+
payload?: SearchPayload;
|
|
1710
1744
|
}): Promise<StreamResponse<SearchResponse>> => {
|
|
1711
1745
|
const queryParams = {
|
|
1712
1746
|
payload: request?.payload,
|
|
@@ -375,7 +375,7 @@ decoders.ChannelStateResponse = (input?: Record<string, any>) => {
|
|
|
375
375
|
|
|
376
376
|
hide_messages_before: { type: 'DatetimeType', isSingle: true },
|
|
377
377
|
|
|
378
|
-
pending_messages: { type: '
|
|
378
|
+
pending_messages: { type: 'PendingMessageResponse', isSingle: false },
|
|
379
379
|
|
|
380
380
|
read: { type: 'ReadStateResponse', isSingle: false },
|
|
381
381
|
|
|
@@ -400,7 +400,7 @@ decoders.ChannelStateResponseFields = (input?: Record<string, any>) => {
|
|
|
400
400
|
|
|
401
401
|
hide_messages_before: { type: 'DatetimeType', isSingle: true },
|
|
402
402
|
|
|
403
|
-
pending_messages: { type: '
|
|
403
|
+
pending_messages: { type: 'PendingMessageResponse', isSingle: false },
|
|
404
404
|
|
|
405
405
|
read: { type: 'ReadStateResponse', isSingle: false },
|
|
406
406
|
|
|
@@ -445,6 +445,8 @@ decoders.ConfigResponse = (input?: Record<string, any>) => {
|
|
|
445
445
|
created_at: { type: 'DatetimeType', isSingle: true },
|
|
446
446
|
|
|
447
447
|
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
448
|
+
|
|
449
|
+
velocity_filter_config: { type: 'VelocityFilterConfig', isSingle: true },
|
|
448
450
|
};
|
|
449
451
|
return decode(typeMappings, input);
|
|
450
452
|
};
|
|
@@ -570,8 +572,6 @@ decoders.Flag2 = (input?: Record<string, any>) => {
|
|
|
570
572
|
|
|
571
573
|
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
572
574
|
|
|
573
|
-
moderation_payload: { type: 'ModerationPayload', isSingle: true },
|
|
574
|
-
|
|
575
575
|
user: { type: 'UserObject', isSingle: true },
|
|
576
576
|
};
|
|
577
577
|
return decode(typeMappings, input);
|
|
@@ -1057,13 +1057,6 @@ decoders.MessageWithChannelResponse = (input?: Record<string, any>) => {
|
|
|
1057
1057
|
return decode(typeMappings, input);
|
|
1058
1058
|
};
|
|
1059
1059
|
|
|
1060
|
-
decoders.ModerationPayload = (input?: Record<string, any>) => {
|
|
1061
|
-
const typeMappings: TypeMapping = {
|
|
1062
|
-
created_at: { type: 'DatetimeType', isSingle: true },
|
|
1063
|
-
};
|
|
1064
|
-
return decode(typeMappings, input);
|
|
1065
|
-
};
|
|
1066
|
-
|
|
1067
1060
|
decoders.ModerationUsageStats = (input?: Record<string, any>) => {
|
|
1068
1061
|
const typeMappings: TypeMapping = {
|
|
1069
1062
|
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
@@ -1121,13 +1114,13 @@ decoders.OwnUser = (input?: Record<string, any>) => {
|
|
|
1121
1114
|
return decode(typeMappings, input);
|
|
1122
1115
|
};
|
|
1123
1116
|
|
|
1124
|
-
decoders.
|
|
1117
|
+
decoders.PendingMessageResponse = (input?: Record<string, any>) => {
|
|
1125
1118
|
const typeMappings: TypeMapping = {
|
|
1126
|
-
channel: { type: '
|
|
1119
|
+
channel: { type: 'ChannelResponse', isSingle: true },
|
|
1127
1120
|
|
|
1128
|
-
message: { type: '
|
|
1121
|
+
message: { type: 'MessageResponse', isSingle: true },
|
|
1129
1122
|
|
|
1130
|
-
user: { type: '
|
|
1123
|
+
user: { type: 'UserResponse', isSingle: true },
|
|
1131
1124
|
};
|
|
1132
1125
|
return decode(typeMappings, input);
|
|
1133
1126
|
};
|
|
@@ -1450,8 +1443,6 @@ decoders.ReviewQueueItem = (input?: Record<string, any>) => {
|
|
|
1450
1443
|
feeds_v2_reaction: { type: 'Reaction', isSingle: true },
|
|
1451
1444
|
|
|
1452
1445
|
message: { type: 'Message', isSingle: true },
|
|
1453
|
-
|
|
1454
|
-
moderation_payload: { type: 'ModerationPayload', isSingle: true },
|
|
1455
1446
|
};
|
|
1456
1447
|
return decode(typeMappings, input);
|
|
1457
1448
|
};
|
|
@@ -1606,7 +1597,7 @@ decoders.ThreadStateResponse = (input?: Record<string, any>) => {
|
|
|
1606
1597
|
|
|
1607
1598
|
updated_at: { type: 'DatetimeType', isSingle: true },
|
|
1608
1599
|
|
|
1609
|
-
latest_replies: { type: '
|
|
1600
|
+
latest_replies: { type: 'MessageResponse', isSingle: false },
|
|
1610
1601
|
|
|
1611
1602
|
deleted_at: { type: 'DatetimeType', isSingle: true },
|
|
1612
1603
|
|
|
@@ -1629,7 +1620,7 @@ decoders.TruncateChannelResponse = (input?: Record<string, any>) => {
|
|
|
1629
1620
|
const typeMappings: TypeMapping = {
|
|
1630
1621
|
channel: { type: 'ChannelResponse', isSingle: true },
|
|
1631
1622
|
|
|
1632
|
-
message: { type: '
|
|
1623
|
+
message: { type: 'MessageResponse', isSingle: true },
|
|
1633
1624
|
};
|
|
1634
1625
|
return decode(typeMappings, input);
|
|
1635
1626
|
};
|
|
@@ -1725,6 +1716,13 @@ decoders.UpdateCommandResponse = (input?: Record<string, any>) => {
|
|
|
1725
1716
|
return decode(typeMappings, input);
|
|
1726
1717
|
};
|
|
1727
1718
|
|
|
1719
|
+
decoders.UpdateMemberPartialResponse = (input?: Record<string, any>) => {
|
|
1720
|
+
const typeMappings: TypeMapping = {
|
|
1721
|
+
channel_member: { type: 'ChannelMemberResponse', isSingle: true },
|
|
1722
|
+
};
|
|
1723
|
+
return decode(typeMappings, input);
|
|
1724
|
+
};
|
|
1725
|
+
|
|
1728
1726
|
decoders.UpdateMessagePartialResponse = (input?: Record<string, any>) => {
|
|
1729
1727
|
const typeMappings: TypeMapping = {
|
|
1730
1728
|
message: { type: 'Message', isSingle: true },
|
|
@@ -1860,6 +1858,20 @@ decoders.UserResponse = (input?: Record<string, any>) => {
|
|
|
1860
1858
|
return decode(typeMappings, input);
|
|
1861
1859
|
};
|
|
1862
1860
|
|
|
1861
|
+
decoders.VelocityFilterConfig = (input?: Record<string, any>) => {
|
|
1862
|
+
const typeMappings: TypeMapping = {
|
|
1863
|
+
rule: { type: 'VelocityFilterConfigRule', isSingle: false },
|
|
1864
|
+
};
|
|
1865
|
+
return decode(typeMappings, input);
|
|
1866
|
+
};
|
|
1867
|
+
|
|
1868
|
+
decoders.VelocityFilterConfigRule = (input?: Record<string, any>) => {
|
|
1869
|
+
const typeMappings: TypeMapping = {
|
|
1870
|
+
timeout: { type: 'DatetimeType', isSingle: true },
|
|
1871
|
+
};
|
|
1872
|
+
return decode(typeMappings, input);
|
|
1873
|
+
};
|
|
1874
|
+
|
|
1863
1875
|
decoders.WSEvent = (input?: Record<string, any>) => {
|
|
1864
1876
|
const typeMappings: TypeMapping = {
|
|
1865
1877
|
created_at: { type: 'DatetimeType', isSingle: true },
|