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-2049] Add async user export endpoint support #860

Merged
merged 2 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ import {
FlagReportsResponse,
ReviewFlagReportOptions,
FlagReportsPaginationOptions,
ExportUsersRequest,
ExportUsersResponse,
} from './types';
import { InsightMetrics, postInsights } from './insights';

Expand Down Expand Up @@ -2808,6 +2810,10 @@ export class StreamChat<
return this.post<APIResponse & ExportChannelResponse>(`${this.baseURL}/export_channels`, payload);
}

exportUsers(request: ExportUsersRequest) {
return this.post<APIResponse & ExportUsersResponse>(`${this.baseURL}/export/users`, request);
}

exportChannel(request: ExportChannelRequest, options?: ExportChannelOptions) {
return this.exportChannels([request], options);
}
Expand Down
8 changes: 8 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ export type ExportChannelResponse = {
task_id: string;
};

export type ExportUsersResponse = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a difference or will be in future between this and ExportChannelResponse?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there is no difference, but wanted to keep it separate just in case we decide to diverge in the future.

task_id: string;
};

export type ExportChannelStatusResponse = {
created_at?: string;
error?: {};
Expand Down Expand Up @@ -1737,6 +1741,10 @@ export type ExportChannelOptions = {
version?: string;
};

export type ExportUsersRequest = {
user_ids: string[];
};

export type Field = {
short?: boolean;
title?: string;
Expand Down