MM-60436 - remove telemetry api track calls (#28160)

Этот коммит содержится в:
catalintomai
2024-12-03 23:20:53 +00:00
коммит произвёл GitHub
родитель e9878f8ac6
Коммит 8861a8aef0

Просмотреть файл

@@ -576,8 +576,6 @@ export default class Client4 {
// User Routes
createUser = (user: UserProfile, token: string, inviteId: string, redirect?: string) => {
this.trackEvent('api', 'api_users_create');
const queryParams: any = {};
if (token) {
@@ -606,8 +604,6 @@ export default class Client4 {
};
patchUser = (userPatch: Partial<UserProfile> & {id: string}) => {
this.trackEvent('api', 'api_users_patch');
return this.doFetch<UserProfile>(
`${this.getUserRoute(userPatch.id)}/patch`,
{method: 'put', body: JSON.stringify(userPatch)},
@@ -615,8 +611,6 @@ export default class Client4 {
};
updateUser = (user: UserProfile) => {
this.trackEvent('api', 'api_users_update');
return this.doFetch<UserProfile>(
`${this.getUserRoute(user.id)}`,
{method: 'put', body: JSON.stringify(user)},
@@ -624,8 +618,6 @@ export default class Client4 {
};
promoteGuestToUser = (userId: string) => {
this.trackEvent('api', 'api_users_promote_guest_to_user');
return this.doFetch<StatusOK>(
`${this.getUserRoute(userId)}/promote`,
{method: 'post'},
@@ -633,8 +625,6 @@ export default class Client4 {
};
demoteUserToGuest = (userId: string) => {
this.trackEvent('api', 'api_users_demote_user_to_guest');
return this.doFetch<StatusOK>(
`${this.getUserRoute(userId)}/demote`,
{method: 'post'},
@@ -642,8 +632,6 @@ export default class Client4 {
};
updateUserRoles = (userId: string, roles: string) => {
this.trackEvent('api', 'api_users_update_roles');
return this.doFetch<StatusOK>(
`${this.getUserRoute(userId)}/roles`,
{method: 'put', body: JSON.stringify({roles})},
@@ -666,8 +654,6 @@ export default class Client4 {
};
updateUserPassword = (userId: string, currentPassword: string, newPassword: string) => {
this.trackEvent('api', 'api_users_newpassword');
return this.doFetch<StatusOK>(
`${this.getUserRoute(userId)}/password`,
{method: 'put', body: JSON.stringify({current_password: currentPassword, new_password: newPassword})},
@@ -675,8 +661,6 @@ export default class Client4 {
};
resetUserPassword = (token: string, newPassword: string) => {
this.trackEvent('api', 'api_users_reset_password');
return this.doFetch<StatusOK>(
`${this.getUsersRoute()}/password/reset`,
{method: 'post', body: JSON.stringify({token, new_password: newPassword})},
@@ -691,8 +675,6 @@ export default class Client4 {
};
sendPasswordResetEmail = (email: string) => {
this.trackEvent('api', 'api_users_send_password_reset');
return this.doFetch<StatusOK>(
`${this.getUsersRoute()}/password/reset/send`,
{method: 'post', body: JSON.stringify({email})},
@@ -700,8 +682,6 @@ export default class Client4 {
};
updateUserActive = (userId: string, active: boolean) => {
this.trackEvent('api', 'api_users_update_active');
return this.doFetch<StatusOK>(
`${this.getUserRoute(userId)}/active`,
{method: 'put', body: JSON.stringify({active})},
@@ -709,8 +689,6 @@ export default class Client4 {
};
uploadProfileImage = (userId: string, imageData: File) => {
this.trackEvent('api', 'api_users_update_profile_picture');
const formData = new FormData();
formData.append('image', imageData);
const request: any = {
@@ -725,8 +703,6 @@ export default class Client4 {
};
setDefaultProfileImage = (userId: string) => {
this.trackEvent('api', 'api_users_set_default_profile_picture');
return this.doFetch<StatusOK>(
`${this.getUserRoute(userId)}/image`,
{method: 'delete'},
@@ -769,12 +745,6 @@ export default class Client4 {
};
login = async (loginId: string, password: string, token = '', ldapOnly = false) => {
this.trackEvent('api', 'api_users_login');
if (ldapOnly) {
this.trackEvent('api', 'api_users_login_ldap');
}
const body: any = {
login_id: loginId,
password,
@@ -814,7 +784,6 @@ export default class Client4 {
};
loginById = (id: string, password: string, token = '') => {
this.trackEvent('api', 'api_users_login');
const body: any = {
id,
password,
@@ -829,8 +798,6 @@ export default class Client4 {
};
logout = async () => {
this.trackEvent('api', 'api_users_logout');
const {response} = await this.doFetchWithResponse(
`${this.getUsersRoute()}/logout`,
{method: 'post'},
@@ -1066,8 +1033,6 @@ export default class Client4 {
};
searchUsers = (term: string, options: any) => {
this.trackEvent('api', 'api_search_users');
return this.doFetch<UserProfile[]>(
`${this.getUsersRoute()}/search`,
{method: 'post', body: JSON.stringify({term, ...options})},
@@ -1125,8 +1090,6 @@ export default class Client4 {
};
switchEmailToOAuth = (service: string, email: string, password: string, mfaCode = '') => {
this.trackEvent('api', 'api_users_email_to_oauth');
return this.doFetch<AuthChangeResponse>(
`${this.getUsersRoute()}/login/switch`,
{method: 'post', body: JSON.stringify({current_service: 'email', new_service: service, email, password, mfa_code: mfaCode})},
@@ -1134,8 +1097,6 @@ export default class Client4 {
};
switchOAuthToEmail = (currentService: string, email: string, password: string) => {
this.trackEvent('api', 'api_users_oauth_to_email');
return this.doFetch<AuthChangeResponse>(
`${this.getUsersRoute()}/login/switch`,
{method: 'post', body: JSON.stringify({current_service: currentService, new_service: 'email', email, new_password: password})},
@@ -1143,8 +1104,6 @@ export default class Client4 {
};
switchEmailToLdap = (email: string, emailPassword: string, ldapId: string, ldapPassword: string, mfaCode = '') => {
this.trackEvent('api', 'api_users_email_to_ldap');
return this.doFetch<AuthChangeResponse>(
`${this.getUsersRoute()}/login/switch`,
{method: 'post', body: JSON.stringify({current_service: 'email', new_service: 'ldap', email, password: emailPassword, ldap_id: ldapId, new_password: ldapPassword, mfa_code: mfaCode})},
@@ -1152,8 +1111,6 @@ export default class Client4 {
};
switchLdapToEmail = (ldapPassword: string, email: string, emailPassword: string, mfaCode = '') => {
this.trackEvent('api', 'api_users_ldap_to_email');
return this.doFetch<AuthChangeResponse>(
`${this.getUsersRoute()}/login/switch`,
{method: 'post', body: JSON.stringify({current_service: 'ldap', new_service: 'email', email, password: ldapPassword, new_password: emailPassword, mfa_code: mfaCode})},
@@ -1182,8 +1139,6 @@ export default class Client4 {
};
createUserAccessToken = (userId: string, description: string) => {
this.trackEvent('api', 'api_users_create_access_token');
return this.doFetch<UserAccessToken>(
`${this.getUserRoute(userId)}/tokens`,
{method: 'post', body: JSON.stringify({description})},
@@ -1212,8 +1167,6 @@ export default class Client4 {
};
revokeUserAccessToken = (tokenId: string) => {
this.trackEvent('api', 'api_users_revoke_access_token');
return this.doFetch<StatusOK>(
`${this.getUsersRoute()}/tokens/revoke`,
{method: 'post', body: JSON.stringify({token_id: tokenId})},
@@ -1248,8 +1201,6 @@ export default class Client4 {
// Team Routes
createTeam = (team: Team) => {
this.trackEvent('api', 'api_teams_create');
return this.doFetch<Team>(
`${this.getTeamsRoute()}`,
{method: 'post', body: JSON.stringify(team)},
@@ -1257,8 +1208,6 @@ export default class Client4 {
};
deleteTeam = (teamId: string) => {
this.trackEvent('api', 'api_teams_delete');
return this.doFetch<StatusOK>(
`${this.getTeamRoute(teamId)}`,
{method: 'delete'},
@@ -1273,8 +1222,6 @@ export default class Client4 {
};
updateTeam = (team: Team) => {
this.trackEvent('api', 'api_teams_update_name', {team_id: team.id});
return this.doFetch<Team>(
`${this.getTeamRoute(team.id)}`,
{method: 'put', body: JSON.stringify(team)},
@@ -1282,8 +1229,6 @@ export default class Client4 {
};
patchTeam = (team: Partial<Team> & {id: string}) => {
this.trackEvent('api', 'api_teams_patch_name', {team_id: team.id});
return this.doFetch<Team>(
`${this.getTeamRoute(team.id)}/patch`,
{method: 'put', body: JSON.stringify(team)},
@@ -1291,8 +1236,6 @@ export default class Client4 {
};
regenerateTeamInviteId = (teamId: string) => {
this.trackEvent('api', 'api_teams_regenerate_invite_id', {team_id: teamId});
return this.doFetch<Team>(
`${this.getTeamRoute(teamId)}/regenerate_invite_id`,
{method: 'post'},
@@ -1302,8 +1245,6 @@ export default class Client4 {
updateTeamScheme = (teamId: string, schemeId: string) => {
const patch = {scheme_id: schemeId};
this.trackEvent('api', 'api_teams_update_scheme', {team_id: teamId, ...patch});
return this.doFetch<StatusOK>(
`${this.getTeamSchemeRoute(teamId)}`,
{method: 'put', body: JSON.stringify(patch)},
@@ -1327,8 +1268,6 @@ export default class Client4 {
searchTeams(term: string, opts: PagedTeamSearchOpts): Promise<Team[]>;
searchTeams(term: string, opts: NotPagedTeamSearchOpts): Promise<TeamsWithCount>;
searchTeams(term: string, opts: TeamSearchOpts): Promise<Team[] | TeamsWithCount> {
this.trackEvent('api', 'api_search_teams');
return this.doFetch<Team[] | TeamsWithCount>(
`${this.getTeamsRoute()}/search`,
{method: 'post', body: JSON.stringify({term, ...opts})},
@@ -1343,8 +1282,6 @@ export default class Client4 {
};
getTeamByName = (teamName: string) => {
this.trackEvent('api', 'api_teams_get_team_by_name');
return this.doFetch<Team>(
this.getTeamNameRoute(teamName),
{method: 'get'},
@@ -1408,8 +1345,6 @@ export default class Client4 {
};
addToTeam = (teamId: string, userId: string) => {
this.trackEvent('api', 'api_teams_invite_members', {team_id: teamId});
const member = {user_id: userId, team_id: teamId};
return this.doFetch<TeamMembership>(
`${this.getTeamMembersRoute(teamId)}`,
@@ -1418,8 +1353,6 @@ export default class Client4 {
};
addToTeamFromInvite = (token = '', inviteId = '') => {
this.trackEvent('api', 'api_teams_invite_members');
const query = buildQueryString({token, invite_id: inviteId});
return this.doFetch<TeamMembership>(
`${this.getTeamsRoute()}/members/invite${query}`,
@@ -1428,8 +1361,6 @@ export default class Client4 {
};
addUsersToTeam = (teamId: string, userIds: string[]) => {
this.trackEvent('api', 'api_teams_batch_add_members', {team_id: teamId, count: userIds.length});
const members: any = [];
userIds.forEach((id) => members.push({team_id: teamId, user_id: id}));
return this.doFetch<TeamMembership[]>(
@@ -1439,8 +1370,6 @@ export default class Client4 {
};
addUsersToTeamGracefully = (teamId: string, userIds: string[]) => {
this.trackEvent('api', 'api_teams_batch_add_members', {team_id: teamId, count: userIds.length});
const members: any = [];
userIds.forEach((id) => members.push({team_id: teamId, user_id: id}));
return this.doFetch<TeamMemberWithError[]>(
@@ -1458,8 +1387,6 @@ export default class Client4 {
};
removeFromTeam = (teamId: string, userId: string) => {
this.trackEvent('api', 'api_teams_remove_members', {team_id: teamId});
return this.doFetch<StatusOK>(
`${this.getTeamMemberRoute(teamId, userId)}`,
{method: 'delete'},
@@ -1507,8 +1434,6 @@ export default class Client4 {
};
updateTeamMemberRoles = (teamId: string, userId: string, roles: string[]) => {
this.trackEvent('api', 'api_teams_update_member_roles', {team_id: teamId});
return this.doFetch<StatusOK>(
`${this.getTeamMemberRoute(teamId, userId)}/roles`,
{method: 'put', body: JSON.stringify({roles})},
@@ -1516,8 +1441,6 @@ export default class Client4 {
};
sendEmailInvitesToTeam = (teamId: string, emails: string[]) => {
this.trackEvent('api', 'api_teams_invite_members', {team_id: teamId});
return this.doFetch<StatusOK>(
`${this.getTeamRoute(teamId)}/invite/email`,
{method: 'post', body: JSON.stringify(emails)},
@@ -1534,8 +1457,6 @@ export default class Client4 {
};
sendEmailInvitesToTeamGracefully = (teamId: string, emails: string[]) => {
this.trackEvent('api', 'api_teams_invite_members', {team_id: teamId});
return this.doFetch<TeamInviteWithError[]>(
`${this.getTeamRoute(teamId)}/invite/email?graceful=true`,
{method: 'post', body: JSON.stringify(emails)},
@@ -1548,8 +1469,6 @@ export default class Client4 {
emails: string[],
message: string,
) => {
this.trackEvent('api', 'api_teams_invite_members_to_channels', {team_id: teamId, channel_len: channelIds.length});
return this.doFetch<TeamInviteWithError[]>(
`${this.getTeamRoute(teamId)}/invite/email?graceful=true`,
{method: 'post', body: JSON.stringify({emails, channelIds, message})},
@@ -1575,8 +1494,6 @@ export default class Client4 {
};
setTeamIcon = (teamId: string, imageData: File) => {
this.trackEvent('api', 'api_team_set_team_icon');
const formData = new FormData();
formData.append('image', imageData);
@@ -1592,8 +1509,6 @@ export default class Client4 {
};
removeTeamIcon = (teamId: string) => {
this.trackEvent('api', 'api_team_remove_team_icon');
return this.doFetch<StatusOK>(
`${this.getTeamRoute(teamId)}/image`,
{method: 'delete'},
@@ -1653,8 +1568,6 @@ export default class Client4 {
}
createChannel = (channel: Channel) => {
this.trackEvent('api', 'api_channels_create', {team_id: channel.team_id});
return this.doFetch<ServerChannel>(
`${this.getChannelsRoute()}`,
{method: 'post', body: JSON.stringify(channel)},
@@ -1662,8 +1575,6 @@ export default class Client4 {
};
createDirectChannel = (userIds: string[]) => {
this.trackEvent('api', 'api_channels_create_direct');
return this.doFetch<ServerChannel>(
`${this.getChannelsRoute()}/direct`,
{method: 'post', body: JSON.stringify(userIds)},
@@ -1671,8 +1582,6 @@ export default class Client4 {
};
createGroupChannel = (userIds: string[]) => {
this.trackEvent('api', 'api_channels_create_group');
return this.doFetch<ServerChannel>(
`${this.getChannelsRoute()}/group`,
{method: 'post', body: JSON.stringify(userIds)},
@@ -1680,8 +1589,6 @@ export default class Client4 {
};
deleteChannel = (channelId: string) => {
this.trackEvent('api', 'api_channels_delete', {channel_id: channelId});
return this.doFetch<StatusOK>(
`${this.getChannelRoute(channelId)}`,
{method: 'delete'},
@@ -1689,8 +1596,6 @@ export default class Client4 {
};
unarchiveChannel = (channelId: string) => {
this.trackEvent('api', 'api_channels_unarchive', {channel_id: channelId});
return this.doFetch<ServerChannel>(
`${this.getChannelRoute(channelId)}/restore`,
{method: 'post'},
@@ -1698,8 +1603,6 @@ export default class Client4 {
};
updateChannel = (channel: Channel) => {
this.trackEvent('api', 'api_channels_update', {channel_id: channel.id});
return this.doFetch<ServerChannel>(
`${this.getChannelRoute(channel.id)}`,
{method: 'put', body: JSON.stringify(channel)},
@@ -1707,8 +1610,6 @@ export default class Client4 {
};
updateChannelPrivacy = (channelId: string, privacy: any) => {
this.trackEvent('api', 'api_channels_update_privacy', {channel_id: channelId, privacy});
return this.doFetch<ServerChannel>(
`${this.getChannelRoute(channelId)}/privacy`,
{method: 'put', body: JSON.stringify({privacy})},
@@ -1716,8 +1617,6 @@ export default class Client4 {
};
patchChannel = (channelId: string, channelPatch: Partial<Channel>) => {
this.trackEvent('api', 'api_channels_patch', {channel_id: channelId});
return this.doFetch<ServerChannel>(
`${this.getChannelRoute(channelId)}/patch`,
{method: 'put', body: JSON.stringify(channelPatch)},
@@ -1725,8 +1624,6 @@ export default class Client4 {
};
updateChannelNotifyProps = (props: any) => {
this.trackEvent('api', 'api_users_update_channel_notifications', {channel_id: props.channel_id});
return this.doFetch<StatusOK>(
`${this.getChannelMemberRoute(props.channel_id, props.user_id)}/notify_props`,
{method: 'put', body: JSON.stringify(props)},
@@ -1736,8 +1633,6 @@ export default class Client4 {
updateChannelScheme = (channelId: string, schemeId: string) => {
const patch = {scheme_id: schemeId};
this.trackEvent('api', 'api_channels_update_scheme', {channel_id: channelId, ...patch});
return this.doFetch<StatusOK>(
`${this.getChannelSchemeRoute(channelId)}`,
{method: 'put', body: JSON.stringify(patch)},
@@ -1843,8 +1738,6 @@ export default class Client4 {
};
addToChannels = (userIds: string[], channelId: string, postRootId = '') => {
this.trackEvent('api', 'api_channels_add_members', {channel_id: channelId});
const members = {user_ids: userIds, channel_id: channelId, post_root_id: postRootId};
return this.doFetch<ChannelMembership[]>(
`${this.getChannelMembersRoute(channelId)}`,
@@ -1853,8 +1746,6 @@ export default class Client4 {
};
addToChannel = (userId: string, channelId: string, postRootId = '') => {
this.trackEvent('api', 'api_channels_add_member', {channel_id: channelId});
const member = {user_id: userId, channel_id: channelId, post_root_id: postRootId};
return this.doFetch<ChannelMembership>(
`${this.getChannelMembersRoute(channelId)}`,
@@ -1863,8 +1754,6 @@ export default class Client4 {
};
removeFromChannel = (userId: string, channelId: string) => {
this.trackEvent('api', 'api_channels_remove_member', {channel_id: channelId});
return this.doFetch<StatusOK>(
`${this.getChannelMemberRoute(channelId, userId)}`,
{method: 'delete'},
@@ -2183,19 +2072,12 @@ export default class Client4 {
analyticsData.priority = post.metadata.priority.priority;
analyticsData.requested_ack = post.metadata.priority.requested_ack;
analyticsData.persistent_notifications = post.metadata.priority.persistent_notifications;
}
this.trackEvent('api', 'api_posts_create', analyticsData);
if (result.root_id != null && result.root_id !== '') {
this.trackEvent('api', 'api_posts_replied', analyticsData);
this.trackEvent('api', 'api_posts_create', analyticsData);
}
return result;
};
updatePost = (post: Post) => {
this.trackEvent('api', 'api_posts_update', {channel_id: post.channel_id, post_id: post.id});
return this.doFetch<Post>(
`${this.getPostRoute(post.id)}`,
{method: 'put', body: JSON.stringify(post)},
@@ -2210,8 +2092,6 @@ export default class Client4 {
};
patchPost = (postPatch: Partial<Post> & {id: string}) => {
this.trackEvent('api', 'api_posts_patch', {channel_id: postPatch.channel_id, post_id: postPatch.id});
return this.doFetch<Post>(
`${this.getPostRoute(postPatch.id)}/patch`,
{method: 'put', body: JSON.stringify(postPatch)},
@@ -2219,8 +2099,6 @@ export default class Client4 {
};
deletePost = (postId: string) => {
this.trackEvent('api', 'api_posts_delete');
return this.doFetch<StatusOK>(
`${this.getPostRoute(postId)}`,
{method: 'delete'},
@@ -2354,8 +2232,6 @@ export default class Client4 {
};
getFlaggedPosts = (userId: string, channelId = '', teamId = '', page = 0, perPage = PER_PAGE_DEFAULT) => {
this.trackEvent('api', 'api_posts_get_flagged', {team_id: teamId});
return this.doFetch<PostList>(
`${this.getUserRoute(userId)}/posts/flagged${buildQueryString({channel_id: channelId, team_id: teamId, page, per_page: perPage})}`,
{method: 'get'},
@@ -2363,7 +2239,6 @@ export default class Client4 {
};
getPinnedPosts = (channelId: string) => {
this.trackEvent('api', 'api_posts_get_pinned', {channel_id: channelId});
return this.doFetch<PostList>(
`${this.getChannelRoute(channelId)}/pinned`,
{method: 'get'},
@@ -2371,8 +2246,6 @@ export default class Client4 {
};
markPostAsUnread = (userId: string, postId: string) => {
this.trackEvent('api', 'api_post_set_unread_post');
return this.doFetch<ChannelUnread>(
`${this.getUserRoute(userId)}/posts/${postId}/set_unread`,
{method: 'post', body: JSON.stringify({collapsed_threads_supported: true})},
@@ -2380,8 +2253,6 @@ export default class Client4 {
};
addPostReminder = (userId: string, postId: string, timestamp: number) => {
this.trackEvent('api', 'api_post_set_reminder');
return this.doFetch<StatusOK>(
`${this.getUserRoute(userId)}/posts/${postId}/reminder`,
{method: 'post', body: JSON.stringify({target_time: timestamp})},
@@ -2389,8 +2260,6 @@ export default class Client4 {
};
pinPost = (postId: string) => {
this.trackEvent('api', 'api_posts_pin');
return this.doFetch<StatusOK>(
`${this.getPostRoute(postId)}/pin`,
{method: 'post'},
@@ -2398,8 +2267,6 @@ export default class Client4 {
};
unpinPost = (postId: string) => {
this.trackEvent('api', 'api_posts_unpin');
return this.doFetch<StatusOK>(
`${this.getPostRoute(postId)}/unpin`,
{method: 'post'},
@@ -2428,8 +2295,6 @@ export default class Client4 {
};
addReaction = (userId: string, postId: string, emojiName: string) => {
this.trackEvent('api', 'api_reactions_save', {post_id: postId});
return this.doFetch<Reaction>(
`${this.getReactionsRoute()}`,
{method: 'post', body: JSON.stringify({user_id: userId, post_id: postId, emoji_name: emojiName})},
@@ -2437,8 +2302,6 @@ export default class Client4 {
};
removeReaction = (userId: string, postId: string, emojiName: string) => {
this.trackEvent('api', 'api_reactions_delete', {post_id: postId});
return this.doFetch<StatusOK>(
`${this.getUserRoute(userId)}/posts/${postId}/reactions/${emojiName}`,
{method: 'delete'},
@@ -2453,8 +2316,6 @@ export default class Client4 {
};
searchPostsWithParams = (teamId: string, params: any) => {
this.trackEvent('api', 'api_posts_search', {team_id: teamId});
let route = `${this.getPostsRoute()}/search`;
if (teamId) {
route = `${this.getTeamRoute(teamId)}/posts/search`;
@@ -2471,8 +2332,6 @@ export default class Client4 {
};
searchFilesWithParams = (teamId: string, params: any) => {
this.trackEvent('api', 'api_files_search', {team_id: teamId});
let route = `${this.getFilesRoute()}/search`;
if (teamId) {
route = `${this.getTeamRoute(teamId)}/files/search`;
@@ -2493,12 +2352,6 @@ export default class Client4 {
};
doPostActionWithCookie = (postId: string, actionId: string, actionCookie: string, selectedOption = '') => {
if (selectedOption) {
this.trackEvent('api', 'api_interactive_messages_menu_selected');
} else {
this.trackEvent('api', 'api_interactive_messages_button_clicked');
}
const msg: any = {
selected_option: selectedOption,
};
@@ -2541,7 +2394,6 @@ export default class Client4 {
}
uploadFile = (fileFormData: any, isBookmark?: boolean) => {
this.trackEvent('api', 'api_files_upload');
const request: any = {
method: 'post',
body: fileFormData,
@@ -2572,8 +2424,6 @@ export default class Client4 {
};
unacknowledgePost = (postId: string, userId: string) => {
this.trackEvent('api', 'api_posts_unack');
return this.doFetch<null>(
`${this.getUserRoute(userId)}/posts/${postId}/ack`,
{method: 'delete'},
@@ -2716,8 +2566,6 @@ export default class Client4 {
// Integration Routes
createIncomingWebhook = (hook: IncomingWebhook) => {
this.trackEvent('api', 'api_integrations_created', {team_id: hook.team_id});
return this.doFetch<IncomingWebhook>(
`${this.getIncomingHooksRoute()}`,
{method: 'post', body: JSON.stringify(hook)},
@@ -2749,8 +2597,6 @@ export default class Client4 {
};
removeIncomingWebhook = (hookId: string) => {
this.trackEvent('api', 'api_integrations_deleted');
return this.doFetch<StatusOK>(
`${this.getIncomingHookRoute(hookId)}`,
{method: 'delete'},
@@ -2758,8 +2604,6 @@ export default class Client4 {
};
updateIncomingWebhook = (hook: IncomingWebhook) => {
this.trackEvent('api', 'api_integrations_updated', {team_id: hook.team_id});
return this.doFetch<IncomingWebhook>(
`${this.getIncomingHookRoute(hook.id)}`,
{method: 'put', body: JSON.stringify(hook)},
@@ -2767,8 +2611,6 @@ export default class Client4 {
};
createOutgoingWebhook = (hook: OutgoingWebhook) => {
this.trackEvent('api', 'api_integrations_created', {team_id: hook.team_id});
return this.doFetch<OutgoingWebhook>(
`${this.getOutgoingHooksRoute()}`,
{method: 'post', body: JSON.stringify(hook)},
@@ -2803,8 +2645,6 @@ export default class Client4 {
};
removeOutgoingWebhook = (hookId: string) => {
this.trackEvent('api', 'api_integrations_deleted');
return this.doFetch<StatusOK>(
`${this.getOutgoingHookRoute(hookId)}`,
{method: 'delete'},
@@ -2812,8 +2652,6 @@ export default class Client4 {
};
updateOutgoingWebhook = (hook: OutgoingWebhook) => {
this.trackEvent('api', 'api_integrations_updated', {team_id: hook.team_id});
return this.doFetch<OutgoingWebhook>(
`${this.getOutgoingHookRoute(hook.id)}`,
{method: 'put', body: JSON.stringify(hook)},
@@ -2856,8 +2694,6 @@ export default class Client4 {
};
executeCommand = (command: string, commandArgs: CommandArgs) => {
this.trackEvent('api', 'api_integrations_used');
return this.doFetch<CommandResponse>(
`${this.getCommandsRoute()}/execute`,
{method: 'post', body: JSON.stringify({command, ...commandArgs})},
@@ -2865,8 +2701,6 @@ export default class Client4 {
};
addCommand = (command: Command) => {
this.trackEvent('api', 'api_integrations_created');
return this.doFetch<Command>(
`${this.getCommandsRoute()}`,
{method: 'post', body: JSON.stringify(command)},
@@ -2874,8 +2708,6 @@ export default class Client4 {
};
editCommand = (command: Command) => {
this.trackEvent('api', 'api_integrations_created');
return this.doFetch<Command>(
`${this.getCommandsRoute()}/${command.id}`,
{method: 'put', body: JSON.stringify(command)},
@@ -2892,8 +2724,6 @@ export default class Client4 {
};
deleteCommand = (id: string) => {
this.trackEvent('api', 'api_integrations_deleted');
return this.doFetch<StatusOK>(
`${this.getCommandsRoute()}/${id}`,
{method: 'delete'},
@@ -2901,8 +2731,6 @@ export default class Client4 {
};
createOAuthApp = (app: OAuthApp) => {
this.trackEvent('api', 'api_apps_register');
return this.doFetch<OAuthApp>(
`${this.getOAuthAppsRoute()}`,
{method: 'post', body: JSON.stringify(app)},
@@ -2966,8 +2794,6 @@ export default class Client4 {
};
createOutgoingOAuthConnection = (teamId: string, connection: OutgoingOAuthConnection) => {
this.trackEvent('api', 'api_outgoing_oauth_connection_register');
return this.doFetch<OutgoingOAuthConnection>(
`${this.getOutgoingOAuthConnectionsRoute()}${buildQueryString({team_id: teamId})}`,
{method: 'post', body: JSON.stringify(connection)},
@@ -2996,8 +2822,6 @@ export default class Client4 {
};
deleteOAuthApp = (appId: string) => {
this.trackEvent('api', 'api_apps_delete');
return this.doFetch<StatusOK>(
`${this.getOAuthAppRoute(appId)}`,
{method: 'delete'},
@@ -3012,8 +2836,6 @@ export default class Client4 {
};
deleteOutgoingOAuthConnection = (connectionId: string) => {
this.trackEvent('api', 'api_apps_delete');
return this.doFetch<StatusOK>(
`${this.getOutgoingOAuthConnectionRoute(connectionId)}`,
{method: 'delete'},
@@ -3021,7 +2843,6 @@ export default class Client4 {
};
submitInteractiveDialog = (data: DialogSubmission) => {
this.trackEvent('api', 'api_interactive_messages_dialog_submitted');
return this.doFetch<SubmitDialogResponse>(
`${this.getBaseRoute()}/actions/dialogs/submit`,
{method: 'post', body: JSON.stringify(data)},
@@ -3031,8 +2852,6 @@ export default class Client4 {
// Emoji Routes
createCustomEmoji = (emoji: CustomEmoji, imageData: File) => {
this.trackEvent('api', 'api_emoji_custom_add');
const formData = new FormData();
formData.append('image', imageData);
formData.append('emoji', JSON.stringify(emoji));
@@ -3076,8 +2895,6 @@ export default class Client4 {
};
deleteCustomEmoji = (emojiId: string) => {
this.trackEvent('api', 'api_emoji_custom_delete');
return this.doFetch<StatusOK>(
`${this.getEmojiRoute(emojiId)}`,
{method: 'delete'},
@@ -3556,8 +3373,6 @@ export default class Client4 {
};
uploadLicense = (fileData: File) => {
this.trackEvent('api', 'api_license_upload');
const formData = new FormData();
formData.append('license', fileData);
@@ -3640,8 +3455,6 @@ export default class Client4 {
};
createScheme = (scheme: Scheme) => {
this.trackEvent('api', 'api_schemes_create');
return this.doFetch<Scheme>(
`${this.getSchemesRoute()}`,
{method: 'post', body: JSON.stringify(scheme)},
@@ -3656,8 +3469,6 @@ export default class Client4 {
};
deleteScheme = (schemeId: string) => {
this.trackEvent('api', 'api_schemes_delete');
return this.doFetch<StatusOK>(
`${this.getSchemesRoute()}/${schemeId}`,
{method: 'delete'},
@@ -3665,8 +3476,6 @@ export default class Client4 {
};
patchScheme = (schemeId: string, schemePatch: Partial<Scheme>) => {
this.trackEvent('api', 'api_schemes_patch', {scheme_id: schemeId});
return this.doFetch<Scheme>(
`${this.getSchemesRoute()}/${schemeId}/patch`,
{method: 'put', body: JSON.stringify(schemePatch)},
@@ -3690,8 +3499,6 @@ export default class Client4 {
// Plugin Routes
uploadPlugin = async (fileData: File, force = false) => {
this.trackEvent('api', 'api_plugin_upload');
const formData = new FormData();
if (force) {
formData.append('force', 'true');
@@ -3710,8 +3517,6 @@ export default class Client4 {
};
installPluginFromUrl = (pluginDownloadUrl: string, force = false) => {
this.trackEvent('api', 'api_install_plugin');
const queryParams = {plugin_download_url: pluginDownloadUrl, force};
return this.doFetch<PluginManifest>(
@@ -3742,8 +3547,6 @@ export default class Client4 {
};
installMarketplacePlugin = (id: string) => {
this.trackEvent('api', 'api_install_marketplace_plugin');
return this.doFetch<MarketplacePlugin>(
`${this.getPluginsMarketplaceRoute()}`,
{method: 'post', body: JSON.stringify({id})},
@@ -3843,7 +3646,6 @@ export default class Client4 {
};
getGroupsNotAssociatedToTeam = (teamID: string, q = '', page = 0, perPage = PER_PAGE_DEFAULT, source = 'ldap') => {
this.trackEvent('api', 'api_groups_get_not_associated_to_team', {team_id: teamID});
return this.doFetch<Group[]>(
`${this.getGroupsRoute()}${buildQueryString({not_associated_to_team: teamID, page, per_page: perPage, q, include_member_count: true, group_source: source})}`,
{method: 'get'},
@@ -3851,7 +3653,6 @@ export default class Client4 {
};
getGroupsNotAssociatedToChannel = (channelID: string, q = '', page = 0, perPage = PER_PAGE_DEFAULT, filterParentTeamPermitted = false, source = 'ldap') => {
this.trackEvent('api', 'api_groups_get_not_associated_to_channel', {channel_id: channelID});
const query = {
not_associated_to_channel: channelID,
page,
@@ -3924,8 +3725,6 @@ export default class Client4 {
};
getGroupsAssociatedToTeam = (teamID: string, q = '', page = 0, perPage = PER_PAGE_DEFAULT, filterAllowReference = false) => {
this.trackEvent('api', 'api_groups_get_associated_to_team', {team_id: teamID});
return this.doFetch<{
groups: Group[];
total_group_count: number;