diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index 1e2b2485c..a8a92df49 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -216,6 +216,7 @@ import type { TeamAccessLogsArguments, TeamBillableInfoArguments, TeamBillingInfoArguments, + TeamExternalTeamsDisconnectArguments, TeamExternalTeamsListArguments, TeamInfoArguments, TeamIntegrationLogsArguments, @@ -462,6 +463,7 @@ import type { TeamAccessLogsResponse, TeamBillableInfoResponse, TeamBillingInfoResponse, + TeamExternalTeamsDisconnectResponse, TeamExternalTeamsListResponse, TeamInfoResponse, TeamIntegrationLogsResponse, @@ -1944,11 +1946,16 @@ export abstract class Methods extends EventEmitter { info: bindApiCall(this, 'team.billing.info'), }, externalTeams: { + /** + * @description Disconnect an external organization. + * @see {@link https://api.slack.com/methods/team.externalTeams.disconnect `team.externalTeams.disconnect` API reference}. + */ + disconnect: bindApiCall(this, 'team.externalTeams.disconnect'), /** * @description Returns a list of all the external teams connected and details about the connection. * @see {@link https://api.slack.com/methods/team.externalTeams.list `team.externalTeams.list` API reference}. */ - lookup: bindApiCall(this, 'team.externalTeams.list'), + list: bindApiCall(this, 'team.externalTeams.list'), }, /** * @description Gets information about the current team. diff --git a/packages/web-api/src/types/request/common.ts b/packages/web-api/src/types/request/common.ts index 6ae527a59..2a7cf7f6e 100644 --- a/packages/web-api/src/types/request/common.ts +++ b/packages/web-api/src/types/request/common.ts @@ -53,17 +53,21 @@ export interface LocaleAware { /** * Some API methods take a `team_id` - different interfaces here so that we can provide a different JSDoc. + * Unfortunately some of our APIs don't use a consistent team ID parameter name. */ export interface TeamID { /** @description The encoded team ID. */ team_id: string; } - export interface OptionalTeamAssignable { /** @description If using an org token, `team_id` is required. */ team_id?: string; } +export interface TargetTeam { + /** @description The team or enterprise id of the other party. */ + target_team?: string; +} // Some APIs (admin.teams.settings.setDefaultChannels, admin.conversations.*) require a minimum-1-item channel array diff --git a/packages/web-api/src/types/request/conversations.ts b/packages/web-api/src/types/request/conversations.ts index 54e6b9400..b7b05bd44 100644 --- a/packages/web-api/src/types/request/conversations.ts +++ b/packages/web-api/src/types/request/conversations.ts @@ -4,6 +4,7 @@ import type { CursorPaginationEnabled, LocaleAware, OptionalTeamAssignable, + TargetTeam, TimelinePaginationEnabled, TokenOverridable, } from './common'; @@ -37,10 +38,6 @@ interface Message extends Channel { /** @description Unique identifier of message. */ ts: string; } -interface TargetTeam { - /** @description The team or enterprise id of the other party involved in the invitation. */ - target_team?: string; -} interface UserIDs { /** List of user IDs to receive this invite. Either `emails` or `user_ids` must be provided. */ user_ids: string[]; diff --git a/packages/web-api/src/types/request/team.ts b/packages/web-api/src/types/request/team.ts index 7151647d5..b6bb5ca53 100644 --- a/packages/web-api/src/types/request/team.ts +++ b/packages/web-api/src/types/request/team.ts @@ -3,6 +3,7 @@ import { CursorPaginationEnabled, OptionalTeamAssignable, SortDir, + TargetTeam, TokenOverridable, TraditionalPagingEnabled, } from './common'; @@ -25,6 +26,8 @@ OptionalTeamAssignable & { }>; // https://api.slack.com/methods/team.billing.info export type TeamBillingInfoArguments = OptionalArgument; +// https://api.slack.com/methods/team.externalTeams.disconnect +export type TeamExternalTeamsDisconnectArguments = TokenOverridable & Required; // https://api.slack.com/methods/team.externalTeams.list export type TeamExternalTeamsListArguments = OptionalArgument>([]); // no arg is fin // -- sad path // -- happy path expectAssignable>([{}]); // all optional arguments -expectAssignable>([]); // no arg is fine + +// team.externalTeams.disconnect +// -- sad path +expectError(web.team.externalTeams.disconnect()); // lacking argument +expectError(web.team.externalTeams.disconnect({})); // missing `target_team` +// -- happy path +expectAssignable>([{ + target_team: 'T1234', +}]); + +// team.externalTeams.list +// -- sad path +// -- happy path +expectAssignable>([{}]); // all optional args // team.info // -- sad path