Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHAT-2191] async batch delete users #762

Merged
merged 26 commits into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bf07575
initial DeleteUsers async method
gumuz Aug 20, 2021
a93ff46
async prefix to AsyncDeleteUsers
gumuz Aug 20, 2021
931aca4
Merge branch 'master' into async-delete-users
gumuz Aug 25, 2021
d881a3f
Merge branch 'master' into async-delete-users
gumuz Sep 10, 2021
a234f03
Merge branch 'master' into async-delete-users
gumuz Sep 15, 2021
50b4935
Merge branch 'master' into async-delete-users
gumuz Sep 15, 2021
ccbb1cc
updated DeleteUsers endpoint
gumuz Sep 16, 2021
2ec5b88
Suggested api and type improvements
ferhatelmas Sep 17, 2021
1227cda
Better comments
ferhatelmas Sep 17, 2021
26b520c
update from master
gumuz Sep 21, 2021
19bdc1f
update from master
gumuz Oct 4, 2021
232a965
Update src/client.ts
gumuz Oct 4, 2021
6e1d656
Update src/types.ts
Oct 4, 2021
52a55a1
Update src/client.ts
gumuz Oct 7, 2021
2ce37c9
Merge branch 'master' into async-delete-users
gumuz Oct 7, 2021
4edf0f4
lint
gumuz Oct 7, 2021
561eafc
Merge branch 'master' into async-delete-users
gumuz Oct 19, 2021
94287ee
bad merge
gumuz Oct 19, 2021
ebb8b29
added docs for DeleteUserOptions
gumuz Oct 19, 2021
014f139
simplify method signature for deleteUsers
gumuz Oct 22, 2021
26028e6
add runtime validation of deleteusers ethod
gumuz Oct 22, 2021
7d473ad
Merge branch 'master' into async-delete-users
Oct 22, 2021
074432f
Merge branch 'master' into async-delete-users
gumuz Oct 27, 2021
17bb104
Merge branch 'async-delete-users' of github.com:GetStream/stream-chat…
gumuz Oct 27, 2021
3bb0725
Merge branch 'master' into async-delete-users
ferhatelmas Oct 28, 2021
e6d3203
Update src/client.ts
gumuz Oct 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ import {
CampaignData,
OGAttachment,
TaskStatus,
DeleteUserOptions,
DeleteChannelsResponse,
TaskResponse,
} from './types';

function isString(x: unknown): x is string {
Expand Down Expand Up @@ -3321,4 +3323,18 @@ export class StreamChat<
{ cids, ...options },
);
}

/**
* deleteUsers - Batch Delete Users
*
* @param {DeleteUserOptions} options Configuration to delete users; which users and how
*
* @return {APIResponse} A task ID
*/
async deleteUsers(options: DeleteUserOptions) {
return await this.post<APIResponse & TaskResponse>(
this.baseURL + `/users/delete`,
options,
);
}
}
11 changes: 9 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export type AppSettingsAPIResponse<
url_enrichment?: boolean;
}
>;
async_url_enrich_enabled?: boolean;
gumuz marked this conversation as resolved.
Show resolved Hide resolved
auto_translation_enabled?: boolean;
before_message_send_hook_url?: string;
campaign_enabled?: boolean;
Expand Down Expand Up @@ -1825,7 +1824,6 @@ export type ExportChannelRequest = {

export type ExportChannelOptions = {
clear_deleted_message_text?: boolean;
include_truncated_messages?: boolean;
gumuz marked this conversation as resolved.
Show resolved Hide resolved
};

export type Field = {
Expand Down Expand Up @@ -2134,6 +2132,15 @@ export type DeleteChannelsResponse = {
result: Record<string, string>;
} & Partial<TaskResponse>;

export type DeleteType = 'soft' | 'hard';

export type DeleteUserOptions = {
gumuz marked this conversation as resolved.
Show resolved Hide resolved
user: DeleteType;
user_ids: string[];
conversations?: DeleteType;
messages?: DeleteType;
};

export type SegmentData = {
description: string;
// TODO: define this type in more detail
Expand Down