Skip to content

Commit

Permalink
Add team.* APIs for rtm.start migration (#1365)
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Oct 29, 2021
1 parent 30b327c commit ded605c
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 4 deletions.
12 changes: 12 additions & 0 deletions packages/web-api/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ import {
StarsRemoveResponse,
TeamAccessLogsResponse,
TeamBillableInfoResponse,
TeamBillingInfoResponse,
TeamInfoResponse,
TeamIntegrationLogsResponse,
TeamPreferencesListResponse,
TeamProfileGetResponse,
UsergroupsCreateResponse,
UsergroupsDisableResponse,
Expand Down Expand Up @@ -645,9 +647,15 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
public readonly team = {
accessLogs: bindApiCall<TeamAccessLogsArguments, TeamAccessLogsResponse>(this, 'team.accessLogs'),
billableInfo: bindApiCall<TeamBillableInfoArguments, TeamBillableInfoResponse>(this, 'team.billableInfo'),
billing: {
info: bindApiCall<TeamBillingInfoArguments, TeamBillingInfoResponse>(this, 'team.billing.info'),
},
info: bindApiCall<TeamInfoArguments, TeamInfoResponse>(this, 'team.info'),
integrationLogs:
bindApiCall<TeamIntegrationLogsArguments, TeamIntegrationLogsResponse>(this, 'team.integrationLogs'),
preferences: {
list: bindApiCall<TeamPreferencesListArguments, TeamPreferencesListResponse>(this, 'team.preferences.list'),
},
profile: {
get: bindApiCall<TeamProfileGetArguments, TeamProfileGetResponse>(this, 'team.profile.get'),
},
Expand Down Expand Up @@ -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
Expand All @@ -1924,6 +1934,8 @@ export interface TeamProfileGetArguments extends WebAPICallOptions, TokenOverrid
visibility?: 'all' | 'visible' | 'hidden';
team_id?: string;
}
export interface TeamPreferencesListArguments extends WebAPICallOptions, TokenOverridable {
}

/*
* `usergroups.*`
Expand Down
13 changes: 9 additions & 4 deletions packages/web-api/src/response/AppsUninstallResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
}
18 changes: 18 additions & 0 deletions packages/web-api/src/response/TeamBillingInfoResponse.ts
Original file line number Diff line number Diff line change
@@ -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;
};
22 changes: 22 additions & 0 deletions packages/web-api/src/response/TeamPreferencesListResponse.ts
Original file line number Diff line number Diff line change
@@ -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;
};
2 changes: 2 additions & 0 deletions packages/web-api/src/response/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
14 changes: 14 additions & 0 deletions prod-server-integration-tests/test/web-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});

0 comments on commit ded605c

Please sign in to comment.