Skip to content

Commit

Permalink
web-api(fix): allow typed token overrides in supported methods (#1872)
Browse files Browse the repository at this point in the history
  • Loading branch information
zimeg authored Aug 14, 2024
1 parent 3a7d3b5 commit 5fbb3bd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/web-api/src/types/request/admin/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export type AdminAppsApprovedListArguments = Partial<TeamOrEnterpriseID> & Token
& Certified;

// https://api.slack.com/methods/admin.apps.clearResolution
export type AdminAppsClearResolutionArguments = AppID & TeamOrEnterpriseID;
export type AdminAppsClearResolutionArguments = AppID & TeamOrEnterpriseID & TokenOverridable;

// https://api.slack.com/methods/admin.apps.config.lookup
export interface AdminAppsConfigLookupArguments extends TokenOverridable {
Expand Down Expand Up @@ -95,4 +95,4 @@ export type AdminAppsRestrictedListArguments = TeamOrEnterpriseID & Certified &
& CursorPaginationEnabled;

// https://api.slack.com/methods/admin.apps.uninstall
export type AdminAppsUninstallArguments = AppID & TeamOrEnterpriseID;
export type AdminAppsUninstallArguments = AppID & TeamOrEnterpriseID & TokenOverridable;
2 changes: 1 addition & 1 deletion packages/web-api/src/types/request/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ export interface AppsManifestValidateArguments extends Partial<AppID>, TokenOver
}

// https://api.slack.com/methods/apps.uninstall
export interface AppsUninstallArguments extends Pick<OAuthCredentials, 'client_id' | 'client_secret'> {}
export interface AppsUninstallArguments extends Pick<OAuthCredentials, 'client_id' | 'client_secret'>, TokenOverridable {}
20 changes: 20 additions & 0 deletions packages/web-api/test/types/methods/admin.apps.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ expectAssignable<Parameters<typeof web.admin.apps.clearResolution>>([{
team_id: 'T1234',
}]);
expectAssignable<Parameters<typeof web.admin.apps.clearResolution>>([{
token: 'xoxp-example',
app_id: 'A1234',
team_id: 'T1234',
}]);
expectAssignable<Parameters<typeof web.admin.apps.clearResolution>>([{
app_id: 'A1234',
enterprise_id: 'E1234',
}]);
expectAssignable<Parameters<typeof web.admin.apps.clearResolution>>([{
token: 'xoxp-example',
app_id: 'A1234',
enterprise_id: 'E1234',
}]);
Expand Down Expand Up @@ -239,6 +249,16 @@ expectAssignable<Parameters<typeof web.admin.apps.uninstall>>([{
team_id: 'T1234',
}]);
expectAssignable<Parameters<typeof web.admin.apps.uninstall>>([{
token: 'xoxp-example',
app_id: 'A1234',
team_id: 'T1234',
}]);
expectAssignable<Parameters<typeof web.admin.apps.uninstall>>([{
app_id: 'A1234',
enterprise_id: 'E1234',
}]);
expectAssignable<Parameters<typeof web.admin.apps.uninstall>>([{
token: 'xoxp-example',
app_id: 'A1234',
enterprise_id: 'E1234',
}]);
5 changes: 5 additions & 0 deletions packages/web-api/test/types/methods/apps.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,8 @@ expectAssignable<Parameters<typeof web.apps.uninstall>>([{
client_id: '1234.56',
client_secret: 'ABC123',
}]);
expectAssignable<Parameters<typeof web.apps.uninstall>>([{
token: 'xoxb-example',
client_id: '1234.56',
client_secret: 'ABC123',
}]);

0 comments on commit 5fbb3bd

Please sign in to comment.