diff --git a/.changeset/grumpy-jobs-poke.md b/.changeset/grumpy-jobs-poke.md new file mode 100644 index 000000000..e1add0dd0 --- /dev/null +++ b/.changeset/grumpy-jobs-poke.md @@ -0,0 +1,5 @@ +--- +"@slack/web-api": minor +--- + +feat: add support for apps.user.connection.update diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index b02e5dd7a..d6e584d9e 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -106,6 +106,7 @@ import type { AppsManifestUpdateArguments, AppsManifestValidateArguments, AppsUninstallArguments, + AppsUserConnectionUpdateArguments, AssistantThreadsSetStatusArguments, AssistantThreadsSetSuggestedPromptsArguments, AssistantThreadsSetTitleArguments, @@ -379,6 +380,7 @@ import type { AppsManifestUpdateResponse, AppsManifestValidateResponse, AppsUninstallResponse, + AppsUserConnectionUpdateResponse, AssistantThreadsSetStatusResponse, AssistantThreadsSetSuggestedPromptsResponse, AssistantThreadsSetTitleResponse, @@ -1469,6 +1471,18 @@ export abstract class Methods extends EventEmitter { * @see {@link https://docs.slack.dev/reference/methods/apps.uninstall `apps.uninstall` API reference}. */ uninstall: bindApiCall(this, 'apps.uninstall'), + user: { + connection: { + /** + * @description Updates the connection status between a user and an app. + * @see {@link https://docs.slack.dev/reference/methods/apps.user.connection.update `apps.user.connection.update` API reference}. + */ + update: bindApiCall( + this, + 'apps.user.connection.update', + ), + }, + }, }; public readonly auth = { diff --git a/packages/web-api/src/types/request/apps.ts b/packages/web-api/src/types/request/apps.ts index 47a97b36f..7c0e063e6 100644 --- a/packages/web-api/src/types/request/apps.ts +++ b/packages/web-api/src/types/request/apps.ts @@ -32,6 +32,14 @@ export interface AppsManifestValidateArguments extends Partial, TokenOver manifest: Manifest; } +// https://docs.slack.dev/reference/methods/apps.user.connection.update +export interface AppsUserConnectionUpdateArguments extends TokenOverridable { + /** @description The identifier for the user receiving the status update. */ + user_id: string; + /** @description The connection status value to assign to the user. `connected` or `disconnected`. */ + status: string; +} + // https://docs.slack.dev/reference/methods/apps.uninstall export interface AppsUninstallArguments extends Pick, diff --git a/packages/web-api/src/types/request/index.ts b/packages/web-api/src/types/request/index.ts index ebd44bd2f..fb387f1d4 100644 --- a/packages/web-api/src/types/request/index.ts +++ b/packages/web-api/src/types/request/index.ts @@ -127,6 +127,7 @@ export type { AppsManifestUpdateArguments, AppsManifestValidateArguments, AppsUninstallArguments, + AppsUserConnectionUpdateArguments, } from './apps'; export type { AssistantThreadsSetStatusArguments, diff --git a/packages/web-api/src/types/response/AppsUserConnectionUpdateResponse.ts b/packages/web-api/src/types/response/AppsUserConnectionUpdateResponse.ts new file mode 100644 index 000000000..8e26b98b4 --- /dev/null +++ b/packages/web-api/src/types/response/AppsUserConnectionUpdateResponse.ts @@ -0,0 +1,17 @@ +///////////////////////////////////////////////////////////////////////////////////////// +// // +// !!! 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 type { WebAPICallResult } from '../../WebClient'; +export type AppsUserConnectionUpdateResponse = WebAPICallResult & { + error?: string; + needed?: string; + ok?: boolean; + provided?: string; + warning?: string; +}; diff --git a/packages/web-api/src/types/response/index.ts b/packages/web-api/src/types/response/index.ts index 433659455..e1c324253 100644 --- a/packages/web-api/src/types/response/index.ts +++ b/packages/web-api/src/types/response/index.ts @@ -116,6 +116,7 @@ export { AppsPermissionsScopesListResponse } from './AppsPermissionsScopesListRe export { AppsPermissionsUsersListResponse } from './AppsPermissionsUsersListResponse'; export { AppsPermissionsUsersRequestResponse } from './AppsPermissionsUsersRequestResponse'; export { AppsUninstallResponse } from './AppsUninstallResponse'; +export { AppsUserConnectionUpdateResponse } from './AppsUserConnectionUpdateResponse'; export { AssistantThreadsSetStatusResponse } from './AssistantThreadsSetStatusResponse'; export { AssistantThreadsSetSuggestedPromptsResponse } from './AssistantThreadsSetSuggestedPromptsResponse'; export { AssistantThreadsSetTitleResponse } from './AssistantThreadsSetTitleResponse'; diff --git a/packages/web-api/test/types/methods/apps.test-d.ts b/packages/web-api/test/types/methods/apps.test-d.ts index a59b9cdc8..8c9a38189 100644 --- a/packages/web-api/test/types/methods/apps.test-d.ts +++ b/packages/web-api/test/types/methods/apps.test-d.ts @@ -103,6 +103,34 @@ expectAssignable>([ }, ]); +// apps.user.connection.update +// -- sad path +expectError(web.apps.user.connection.update()); // lacking argument +expectError(web.apps.user.connection.update({})); // empty argument +expectError( + web.apps.user.connection.update({ + user_id: 'U1234', // missing status + }), +); +expectError( + web.apps.user.connection.update({ + status: 'connected', // missing user_id + }), +); +// -- happy path +expectAssignable>([ + { + user_id: 'U1234', + status: 'connected', + }, +]); +expectAssignable>([ + { + user_id: 'U1234', + status: 'disconnected', + }, +]); + // apps.uninstall // -- sad path expectError(web.apps.uninstall()); // lacking argument