stream-chat 8.1.2 → 8.2.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 +539 -434
- 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 +539 -434
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +539 -434
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +539 -434
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/client.d.ts +39 -12
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/types.d.ts +13 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +15 -6
- package/src/client.ts +47 -11
- package/src/types.ts +16 -0
package/src/client.ts
CHANGED
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
CreateImportResponse,
|
|
62
62
|
CreateImportURLResponse,
|
|
63
63
|
CustomPermissionOptions,
|
|
64
|
+
DeactivateUsersOptions,
|
|
64
65
|
DefaultGenerics,
|
|
65
66
|
DeleteCampaignOptions,
|
|
66
67
|
DeleteChannelsResponse,
|
|
@@ -120,6 +121,8 @@ import {
|
|
|
120
121
|
PushProviderUpsertResponse,
|
|
121
122
|
QueryChannelsAPIResponse,
|
|
122
123
|
ReactionResponse,
|
|
124
|
+
ReactivateUserOptions,
|
|
125
|
+
ReactivateUsersOptions,
|
|
123
126
|
Recipient,
|
|
124
127
|
RecipientFilters,
|
|
125
128
|
RecipientQueryOptions,
|
|
@@ -1961,7 +1964,7 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
|
|
|
1961
1964
|
*
|
|
1962
1965
|
* @param {string[]} user_ids which users to restore
|
|
1963
1966
|
*
|
|
1964
|
-
* @return {APIResponse}
|
|
1967
|
+
* @return {APIResponse} An API response
|
|
1965
1968
|
*/
|
|
1966
1969
|
async restoreUsers(user_ids: string[]) {
|
|
1967
1970
|
return await this.post<APIResponse>(this.baseURL + `/users/restore`, {
|
|
@@ -1969,27 +1972,60 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
|
|
|
1969
1972
|
});
|
|
1970
1973
|
}
|
|
1971
1974
|
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1975
|
+
/**
|
|
1976
|
+
* reactivateUser - Reactivate one user
|
|
1977
|
+
*
|
|
1978
|
+
* @param {string} userID which user to reactivate
|
|
1979
|
+
* @param {ReactivateUserOptions} [options]
|
|
1980
|
+
*
|
|
1981
|
+
* @return {UserResponse} Reactivated user
|
|
1982
|
+
*/
|
|
1983
|
+
async reactivateUser(userID: string, options?: ReactivateUserOptions) {
|
|
1980
1984
|
return await this.post<APIResponse & { user: UserResponse<StreamChatGenerics> }>(
|
|
1981
1985
|
this.baseURL + `/users/${userID}/reactivate`,
|
|
1982
1986
|
{ ...options },
|
|
1983
1987
|
);
|
|
1984
1988
|
}
|
|
1985
1989
|
|
|
1986
|
-
|
|
1990
|
+
/**
|
|
1991
|
+
* reactivateUsers - Reactivate many users asynchronously
|
|
1992
|
+
*
|
|
1993
|
+
* @param {string[]} user_ids which users to reactivate
|
|
1994
|
+
* @param {ReactivateUsersOptions} [options]
|
|
1995
|
+
*
|
|
1996
|
+
* @return {TaskResponse} A task ID
|
|
1997
|
+
*/
|
|
1998
|
+
async reactivateUsers(user_ids: string[], options?: ReactivateUsersOptions) {
|
|
1999
|
+
return await this.post<APIResponse & TaskResponse>(this.baseURL + `/users/reactivate`, { user_ids, ...options });
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* deactivateUser - Deactivate one user
|
|
2004
|
+
*
|
|
2005
|
+
* @param {string} userID which user to deactivate
|
|
2006
|
+
* @param {DeactivateUsersOptions} [options]
|
|
2007
|
+
*
|
|
2008
|
+
* @return {UserResponse} Deactivated user
|
|
2009
|
+
*/
|
|
2010
|
+
async deactivateUser(userID: string, options?: DeactivateUsersOptions) {
|
|
1987
2011
|
return await this.post<APIResponse & { user: UserResponse<StreamChatGenerics> }>(
|
|
1988
2012
|
this.baseURL + `/users/${userID}/deactivate`,
|
|
1989
2013
|
{ ...options },
|
|
1990
2014
|
);
|
|
1991
2015
|
}
|
|
1992
2016
|
|
|
2017
|
+
/**
|
|
2018
|
+
* deactivateUsers - Deactivate many users asynchronously
|
|
2019
|
+
*
|
|
2020
|
+
* @param {string[]} user_ids which users to deactivate
|
|
2021
|
+
* @param {DeactivateUsersOptions} [options]
|
|
2022
|
+
*
|
|
2023
|
+
* @return {TaskResponse} A task ID
|
|
2024
|
+
*/
|
|
2025
|
+
async deactivateUsers(user_ids: string[], options?: DeactivateUsersOptions) {
|
|
2026
|
+
return await this.post<APIResponse & TaskResponse>(this.baseURL + `/users/deactivate`, { user_ids, ...options });
|
|
2027
|
+
}
|
|
2028
|
+
|
|
1993
2029
|
async exportUser(userID: string, options?: Record<string, string>) {
|
|
1994
2030
|
return await this.get<
|
|
1995
2031
|
APIResponse & {
|
|
@@ -2978,7 +3014,7 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
|
|
|
2978
3014
|
* @param {string[]} user_ids which users to delete
|
|
2979
3015
|
* @param {DeleteUserOptions} options Configuration how to delete users
|
|
2980
3016
|
*
|
|
2981
|
-
* @return {
|
|
3017
|
+
* @return {TaskResponse} A task ID
|
|
2982
3018
|
*/
|
|
2983
3019
|
async deleteUsers(user_ids: string[], options: DeleteUserOptions) {
|
|
2984
3020
|
if (options?.user !== 'soft' && options?.user !== 'hard') {
|
package/src/types.ts
CHANGED
|
@@ -793,6 +793,11 @@ export type CustomPermissionOptions = {
|
|
|
793
793
|
same_team?: boolean;
|
|
794
794
|
};
|
|
795
795
|
|
|
796
|
+
export type DeactivateUsersOptions = {
|
|
797
|
+
created_by_id?: string;
|
|
798
|
+
mark_messages_deleted?: boolean;
|
|
799
|
+
};
|
|
800
|
+
|
|
796
801
|
// TODO: rename to UpdateChannelOptions in the next major update and use it in channel._update and/or channel.update
|
|
797
802
|
export type InviteOptions<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
|
|
798
803
|
accept_invite?: boolean;
|
|
@@ -884,6 +889,17 @@ export type QueryMembersOptions = {
|
|
|
884
889
|
user_id_lte?: string;
|
|
885
890
|
};
|
|
886
891
|
|
|
892
|
+
export type ReactivateUserOptions = {
|
|
893
|
+
created_by_id?: string;
|
|
894
|
+
name?: string;
|
|
895
|
+
restore_messages?: boolean;
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
export type ReactivateUsersOptions = {
|
|
899
|
+
created_by_id?: string;
|
|
900
|
+
restore_messages?: boolean;
|
|
901
|
+
};
|
|
902
|
+
|
|
887
903
|
export type SearchOptions<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
|
|
888
904
|
limit?: number;
|
|
889
905
|
next?: string;
|