From 041060e9c67d91d5fde63a5c49b6bea8eacf1eb9 Mon Sep 17 00:00:00 2001 From: Kazuhiro Sera Date: Sat, 30 Oct 2021 00:08:08 +0900 Subject: [PATCH] Add team.* APIs for rtm.start migration --- packages/web-api/src/methods.ts | 12 ++++++++++ .../src/response/AppsUninstallResponse.ts | 13 +++++++---- .../src/response/TeamBillingInfoResponse.ts | 18 +++++++++++++++ .../response/TeamPreferencesListResponse.ts | 22 +++++++++++++++++++ packages/web-api/src/response/index.ts | 2 ++ prod-server-integration-tests/test/web-api.js | 14 ++++++++++++ 6 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 packages/web-api/src/response/TeamBillingInfoResponse.ts create mode 100644 packages/web-api/src/response/TeamPreferencesListResponse.ts diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index ec9d6a6ff..d79d8f28c 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -170,8 +170,10 @@ import { StarsRemoveResponse, TeamAccessLogsResponse, TeamBillableInfoResponse, + TeamBillingInfoResponse, TeamInfoResponse, TeamIntegrationLogsResponse, + TeamPreferencesListResponse, TeamProfileGetResponse, UsergroupsCreateResponse, UsergroupsDisableResponse, @@ -645,9 +647,15 @@ export abstract class Methods extends EventEmitter { public readonly team = { accessLogs: bindApiCall(this, 'team.accessLogs'), billableInfo: bindApiCall(this, 'team.billableInfo'), + billing: { + info: bindApiCall(this, 'team.billing.info'), + }, info: bindApiCall(this, 'team.info'), integrationLogs: bindApiCall(this, 'team.integrationLogs'), + preferences: { + list: bindApiCall(this, 'team.preferences.list'), + }, profile: { get: bindApiCall(this, 'team.profile.get'), }, @@ -1906,6 +1914,8 @@ export interface TeamBillableInfoArguments extends WebAPICallOptions, TokenOverr user?: string; team_id?: string; } +export interface TeamBillingInfoArguments extends WebAPICallOptions, TokenOverridable { +} export interface TeamInfoArguments extends WebAPICallOptions, TokenOverridable { // Team to get info on, if omitted, will return information about the current team. // Will only return team that the authenticated token is allowed to see through external shared channels @@ -1924,6 +1934,8 @@ export interface TeamProfileGetArguments extends WebAPICallOptions, TokenOverrid visibility?: 'all' | 'visible' | 'hidden'; team_id?: string; } +export interface TeamPreferencesListArguments extends WebAPICallOptions, TokenOverridable { +} /* * `usergroups.*` diff --git a/packages/web-api/src/response/AppsUninstallResponse.ts b/packages/web-api/src/response/AppsUninstallResponse.ts index edfb8c344..4167920a7 100644 --- a/packages/web-api/src/response/AppsUninstallResponse.ts +++ b/packages/web-api/src/response/AppsUninstallResponse.ts @@ -10,8 +10,13 @@ import { WebAPICallResult } from '../WebClient'; export type AppsUninstallResponse = WebAPICallResult & { - ok?: boolean; - error?: string; - needed?: string; - provided?: string; + ok?: boolean; + error?: string; + response_metadata?: ResponseMetadata; + needed?: string; + provided?: string; }; + +export interface ResponseMetadata { + messages?: string[]; +} diff --git a/packages/web-api/src/response/TeamBillingInfoResponse.ts b/packages/web-api/src/response/TeamBillingInfoResponse.ts new file mode 100644 index 000000000..6d5ecfb83 --- /dev/null +++ b/packages/web-api/src/response/TeamBillingInfoResponse.ts @@ -0,0 +1,18 @@ +/* eslint-disable */ +///////////////////////////////////////////////////////////////////////////////////////// +// // +// !!! DO NOT EDIT THIS FILE !!! // +// // +// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. // +// Please refer to the script code to learn how to update the source data. // +// // +///////////////////////////////////////////////////////////////////////////////////////// + +import { WebAPICallResult } from '../WebClient'; +export type TeamBillingInfoResponse = WebAPICallResult & { + ok?: boolean; + error?: string; + needed?: string; + provided?: string; + plan?: string; +}; diff --git a/packages/web-api/src/response/TeamPreferencesListResponse.ts b/packages/web-api/src/response/TeamPreferencesListResponse.ts new file mode 100644 index 000000000..397c3b55f --- /dev/null +++ b/packages/web-api/src/response/TeamPreferencesListResponse.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +///////////////////////////////////////////////////////////////////////////////////////// +// // +// !!! DO NOT EDIT THIS FILE !!! // +// // +// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. // +// Please refer to the script code to learn how to update the source data. // +// // +///////////////////////////////////////////////////////////////////////////////////////// + +import { WebAPICallResult } from '../WebClient'; +export type TeamPreferencesListResponse = WebAPICallResult & { + ok?: boolean; + msg_edit_window_mins?: number; + allow_message_deletion?: boolean; + display_real_names?: boolean; + disable_file_uploads?: string; + who_can_post_general?: string; + error?: string; + needed?: string; + provided?: string; +}; diff --git a/packages/web-api/src/response/index.ts b/packages/web-api/src/response/index.ts index 63149f91d..3c43a5fe7 100644 --- a/packages/web-api/src/response/index.ts +++ b/packages/web-api/src/response/index.ts @@ -222,8 +222,10 @@ export { StarsListResponse } from './StarsListResponse'; export { StarsRemoveResponse } from './StarsRemoveResponse'; export { TeamAccessLogsResponse } from './TeamAccessLogsResponse'; export { TeamBillableInfoResponse } from './TeamBillableInfoResponse'; +export { TeamBillingInfoResponse } from './TeamBillingInfoResponse'; export { TeamInfoResponse } from './TeamInfoResponse'; export { TeamIntegrationLogsResponse } from './TeamIntegrationLogsResponse'; +export { TeamPreferencesListResponse } from './TeamPreferencesListResponse'; export { TeamProfileGetResponse } from './TeamProfileGetResponse'; export { UsergroupsCreateResponse } from './UsergroupsCreateResponse'; export { UsergroupsDisableResponse } from './UsergroupsDisableResponse'; diff --git a/prod-server-integration-tests/test/web-api.js b/prod-server-integration-tests/test/web-api.js index cd3fd98db..c34b044de 100644 --- a/prod-server-integration-tests/test/web-api.js +++ b/prod-server-integration-tests/test/web-api.js @@ -122,4 +122,18 @@ describe('Web APIs', function () { }); }); }); + + describe('team.* for rtm.start migration', function () { + + it('should work with a bot token (team.billing.info)', async function () { + const response = await botClient.team.billing.info(); + logger.info(response); + assert.isUndefined(response.error); + }); + it('should work with a bot token (team.preferences.list)', async function () { + const response = await botClient.team.preferences.list(); + logger.info(response); + assert.isUndefined(response.error); + }); + }); }); \ No newline at end of file