-
Notifications
You must be signed in to change notification settings - Fork 663
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow using WebClient APIs without argument (#1809)
- Loading branch information
Showing
45 changed files
with
146 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/** Omit all keys K from possible union types T */ | ||
export type ExcludeFromUnion<T, K extends string> = T extends T ? Omit<T, K> : never; | ||
/** Allows to explicitly declare a function parameter as optional */ | ||
export type OptionalArgument<T> = T | void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
// https://api.slack.com/methods/api.test | ||
export interface APITestArguments { | ||
import { OptionalArgument } from '../helpers'; | ||
|
||
export type APITestArguments = OptionalArgument<{ | ||
/** @description Error response to return. */ | ||
error?: string; | ||
} | ||
}>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
import type { CursorPaginationEnabled, TokenOverridable } from './common'; | ||
import { OptionalArgument } from '../helpers'; | ||
|
||
// https://api.slack.com/methods/auth.revoke | ||
export interface AuthRevokeArguments extends TokenOverridable { | ||
export type AuthRevokeArguments = OptionalArgument<TokenOverridable & { | ||
/** | ||
* @description Setting this parameter to `true` triggers a testing mode where the specified token | ||
* will not actually be revoked. | ||
*/ | ||
test?: boolean; | ||
} | ||
}>; | ||
|
||
// https://api.slack.com/methods/auth.teams.list | ||
export interface AuthTeamsListArguments extends TokenOverridable, CursorPaginationEnabled { | ||
export type AuthTeamsListArguments = OptionalArgument<TokenOverridable & CursorPaginationEnabled & { | ||
/** | ||
* @description Whether to return icon paths for each workspace. | ||
* An icon path represents a URI pointing to the image signifying the workspace. | ||
* Defaults to `false`. | ||
*/ | ||
include_icon?: boolean; | ||
} | ||
}>; | ||
|
||
// https://api.slack.com/methods/auth.test | ||
export interface AuthTestArguments extends TokenOverridable { } | ||
export type AuthTestArguments = OptionalArgument<TokenOverridable>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import type { OptionalTeamAssignable, TokenOverridable } from './common'; | ||
import { OptionalArgument } from '../helpers'; | ||
|
||
// https://api.slack.com/methods/bots.info | ||
export interface BotsInfoArguments extends TokenOverridable, OptionalTeamAssignable { | ||
export type BotsInfoArguments = OptionalArgument<TokenOverridable & OptionalTeamAssignable & { | ||
/** @description Bot ID, which starts with 'B', to retrieve information about. */ | ||
bot?: string; | ||
} | ||
}>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { TokenOverridable } from './common'; | ||
import { OptionalArgument } from '../helpers'; | ||
// https://api.slack.com/methods/emoji.list | ||
export interface EmojiListArguments extends TokenOverridable { | ||
export type EmojiListArguments = OptionalArgument<TokenOverridable & { | ||
/** @description Include a list of categories for Unicode emoji and the emoji in each category. */ | ||
include_categories?: boolean; | ||
} | ||
}>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import type { OAuthCredentials, OAuthGrantRefresh } from './common'; | ||
import { OptionalArgument } from '../helpers'; | ||
|
||
// https://api.slack.com/methods/openid.connect.token | ||
export interface OpenIDConnectTokenArguments extends OAuthCredentials, OAuthGrantRefresh {} | ||
// https://api.slack.com/methods/openid.connect.userInfo | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface OpenIDConnectUserInfoArguments {} | ||
export type OpenIDConnectUserInfoArguments = OptionalArgument<object>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.