Skip to content

Commit

Permalink
feat (web-api): Add support for assistant.* API (#2042)
Browse files Browse the repository at this point in the history
  • Loading branch information
misscoded authored Sep 27, 2024
1 parent e62f9e9 commit e69a76d
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 0 deletions.
74 changes: 74 additions & 0 deletions packages/web-api/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ import {
AppsManifestUpdateResponse,
AppsManifestValidateResponse,
AppsUninstallResponse,
AssistantThreadsSetStatusResponse,
AssistantThreadsSetSuggestedPromptsResponse,
AssistantThreadsSetTitleResponse,
AuthRevokeResponse,
AuthTeamsListResponse,
AuthTestResponse,
Expand Down Expand Up @@ -553,6 +556,35 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
uninstall: bindApiCall<AppsUninstallArguments, AppsUninstallResponse>(this, 'apps.uninstall'),
};

public readonly assistant = {
threads: {
/**
* @description Set loading status to indicate that the app is building a response.
* @see {@link https://api.slack.com/methods/assistant.threads.setStatus `assistant.threads.setStatus` API reference}.
*/
setStatus: bindApiCall<AssistantThreadsSetStatusArguments, AssistantThreadsSetStatusResponse>(
this,
'assistant.threads.setStatus',
),
/**
* @description Set suggested prompts for the user. Can suggest up to four prompts.
* @see {@link https://api.slack.com/methods/assistant.threads.setSuggestedPrompts `assistant.threads.setSuggestedPrompts` API reference}.
*/
setSuggestedPrompts: bindApiCall<
AssistantThreadsSetSuggestedPromptsArguments,
AssistantThreadsSetSuggestedPromptsResponse
>(this, 'assistant.threads.setSuggestedPrompts'),
/**
* @description Set the title of the thread. This is shown when a user views the app's chat history.
* @see {@link https://api.slack.com/methods/assistant.threads.setTitle `assistant.threads.setTitle` API reference}.
*/
setTitle: bindApiCall<AssistantThreadsSetTitleArguments, AssistantThreadsSetTitleResponse>(
this,
'assistant.threads.setTitle',
),
},
};

public readonly auth = {
revoke: bindApiCall<AuthRevokeArguments, AuthRevokeResponse>(this, 'auth.revoke'),
teams: {
Expand Down Expand Up @@ -1456,6 +1488,48 @@ export interface AppsUninstallArguments extends WebAPICallOptions {
client_secret: string;
}

/*
* `assistant.*`
*/
// https://api.slack.com/methods/assistant.threads.setStatus
export interface AssistantThreadsSetStatusArguments extends WebAPICallOptions, TokenOverridable {
/** @description Channel ID containing the assistant thread. */
channel_id: string;
/** @description Status of the assistant (e.g. 'is thinking...') */
status: string;
/** @description Message timestamp of the thread. */
thread_ts: string;
}

// https://api.slack.com/methods/assistant.threads.setSuggestedPrompts
export interface AssistantThreadsSetSuggestedPromptsArguments extends WebAPICallOptions, TokenOverridable {
/** @description Channel ID containing the assistant thread. */
channel_id: string;
/** @description Prompt suggestions that appear when opening assistant thread. */
prompts: [AssistantPrompt, ...AssistantPrompt[]];
/** @description Message timestamp of the thread. */
thread_ts: string;
/** @description Title for the prompts. */
title?: string;
}

interface AssistantPrompt {
/** @description Title of the prompt. */
title: string;
/** @description Message of the prompt. */
message: string;
}

// https://api.slack.com/methods/assistant.threads.setTitle
export interface AssistantThreadsSetTitleArguments extends WebAPICallOptions, TokenOverridable {
/** @description Channel ID containing the assistant thread. */
channel_id: string;
/** @description Message timestamp of the thread. */
thread_ts: string;
/** @description Title of the thread. */
title: string;
}

/*
* `auth.*`
*/
Expand Down
18 changes: 18 additions & 0 deletions packages/web-api/src/response/AssistantThreadsSetStatusResponse.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 AssistantThreadsSetStatusResponse = WebAPICallResult & {
error?: string;
needed?: string;
ok?: boolean;
provided?: string;
warning?: string;
};
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 AssistantThreadsSetSuggestedPromptsResponse = WebAPICallResult & {
error?: string;
needed?: string;
ok?: boolean;
provided?: string;
warning?: string;
};
18 changes: 18 additions & 0 deletions packages/web-api/src/response/AssistantThreadsSetTitleResponse.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 AssistantThreadsSetTitleResponse = WebAPICallResult & {
error?: string;
needed?: string;
ok?: boolean;
provided?: string;
warning?: string;
};
3 changes: 3 additions & 0 deletions packages/web-api/src/response/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ export { AppsPermissionsScopesListResponse } from './AppsPermissionsScopesListRe
export { AppsPermissionsUsersListResponse } from './AppsPermissionsUsersListResponse';
export { AppsPermissionsUsersRequestResponse } from './AppsPermissionsUsersRequestResponse';
export { AppsUninstallResponse } from './AppsUninstallResponse';
export { AssistantThreadsSetStatusResponse } from './AssistantThreadsSetStatusResponse';
export { AssistantThreadsSetSuggestedPromptsResponse } from './AssistantThreadsSetSuggestedPromptsResponse';
export { AssistantThreadsSetTitleResponse } from './AssistantThreadsSetTitleResponse';
export { AuthRevokeResponse } from './AuthRevokeResponse';
export { AuthTeamsListResponse } from './AuthTeamsListResponse';
export { AuthTestResponse } from './AuthTestResponse';
Expand Down

0 comments on commit e69a76d

Please sign in to comment.