stream-chat 8.33.1 → 8.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.es.js +678 -584
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +678 -584
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +678 -584
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +678 -584
- package/dist/index.js.map +1 -1
- package/dist/types/client.d.ts +4 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/types.d.ts +20 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +19 -0
- package/src/types.ts +22 -0
package/src/client.ts
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
BaseDeviceFields,
|
|
41
41
|
BlockList,
|
|
42
42
|
BlockListResponse,
|
|
43
|
+
BlockUserAPIResponse,
|
|
43
44
|
CampaignResponse,
|
|
44
45
|
CampaignData,
|
|
45
46
|
CampaignFilters,
|
|
@@ -179,6 +180,7 @@ import {
|
|
|
179
180
|
QuerySegmentTargetsFilter,
|
|
180
181
|
SortParam,
|
|
181
182
|
GetMessageOptions,
|
|
183
|
+
GetBlockedUsersAPIResponse,
|
|
182
184
|
QueryVotesFilters,
|
|
183
185
|
VoteSort,
|
|
184
186
|
CreatePollAPIResponse,
|
|
@@ -2188,7 +2190,24 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
|
|
|
2188
2190
|
...options,
|
|
2189
2191
|
});
|
|
2190
2192
|
}
|
|
2193
|
+
async blockUser(blockedUserID: string, user_id?: string) {
|
|
2194
|
+
return await this.post<BlockUserAPIResponse>(this.baseURL + '/users/block', {
|
|
2195
|
+
blocked_user_id: blockedUserID,
|
|
2196
|
+
...(user_id ? { user_id } : {}),
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
2191
2199
|
|
|
2200
|
+
async getBlockedUsers(user_id?: string) {
|
|
2201
|
+
return await this.get<GetBlockedUsersAPIResponse>(this.baseURL + '/users/block', {
|
|
2202
|
+
...(user_id ? { user_id } : {}),
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
async unBlockUser(blockedUserID: string, userID?: string) {
|
|
2206
|
+
return await this.post<APIResponse>(this.baseURL + '/users/unblock', {
|
|
2207
|
+
blocked_user_id: blockedUserID,
|
|
2208
|
+
...(userID ? { user_id: userID } : {}),
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2192
2211
|
/** muteUser - mutes a user
|
|
2193
2212
|
*
|
|
2194
2213
|
* @param {string} targetID
|
package/src/types.ts
CHANGED
|
@@ -697,6 +697,26 @@ export type MuteUserResponse<StreamChatGenerics extends ExtendableGenerics = Def
|
|
|
697
697
|
own_user?: OwnUserResponse<StreamChatGenerics>;
|
|
698
698
|
};
|
|
699
699
|
|
|
700
|
+
export type BlockUserAPIResponse = APIResponse & {
|
|
701
|
+
blocks: BlockUserResponse[];
|
|
702
|
+
};
|
|
703
|
+
export type BlockUserResponse = APIResponse & {
|
|
704
|
+
blocked_at: string;
|
|
705
|
+
blocked_by_user_id: string;
|
|
706
|
+
blocked_user_id: string;
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
export type GetBlockedUsersAPIResponse = APIResponse & {
|
|
710
|
+
blocks: BlockedUserDetails[];
|
|
711
|
+
};
|
|
712
|
+
export type BlockedUserDetails = APIResponse & {
|
|
713
|
+
blocked_user: UserResponse;
|
|
714
|
+
blocked_user_id: string;
|
|
715
|
+
created_at: string;
|
|
716
|
+
user: UserResponse;
|
|
717
|
+
user_id: string;
|
|
718
|
+
};
|
|
719
|
+
|
|
700
720
|
export type OwnUserBase<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
|
|
701
721
|
channel_mutes: ChannelMute<StreamChatGenerics>[];
|
|
702
722
|
devices: Device<StreamChatGenerics>[];
|
|
@@ -818,6 +838,7 @@ export type UpdateUsersAPIResponse<StreamChatGenerics extends ExtendableGenerics
|
|
|
818
838
|
|
|
819
839
|
export type UserResponse<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = User<StreamChatGenerics> & {
|
|
820
840
|
banned?: boolean;
|
|
841
|
+
blocked_user_ids?: string[];
|
|
821
842
|
created_at?: string;
|
|
822
843
|
deactivated_at?: string;
|
|
823
844
|
deleted_at?: string;
|
|
@@ -2040,6 +2061,7 @@ export type ChannelConfigWithInfo<
|
|
|
2040
2061
|
export type ChannelData<
|
|
2041
2062
|
StreamChatGenerics extends ExtendableGenerics = DefaultGenerics
|
|
2042
2063
|
> = StreamChatGenerics['channelType'] & {
|
|
2064
|
+
blocked?: boolean;
|
|
2043
2065
|
members?: string[];
|
|
2044
2066
|
name?: string;
|
|
2045
2067
|
};
|