Skip to content

Commit 74a4330

Browse files
zimegClaude
andcommitted
feat(web-api): add agents.sessions.rename and agents.sessions.setStatus
Mirror the Python SDK (slackapi/python-slack-sdk#1942) for the two agents.sessions methods: - agents.sessions.rename Rename an agent session. - agents.sessions.setStatus Set an agent session's lifecycle status, creating the session if needed. Adds the client.agents.sessions.{rename,setStatus} bindings, the request argument types, and the response types. The response types are generated from the java-slack-sdk API sample logs via scripts/generate-web-api-types.sh; the samples land in slackapi/java-slack-sdk#1633, so the generator must be re-run against java-slack-sdk main once that ships to pick up the final response shape. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent 3082633 commit 74a4330

6 files changed

Lines changed: 103 additions & 0 deletions

File tree

‎packages/web-api/src/methods.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ import type {
9898
AdminWorkflowsPermissionsLookupArguments,
9999
AdminWorkflowsSearchArguments,
100100
AdminWorkflowsUnpublishArguments,
101+
AgentsSessionsRenameArguments,
102+
AgentsSessionsSetStatusArguments,
101103
APITestArguments,
102104
AppsConnectionsOpenArguments,
103105
AppsEventAuthorizationsListArguments,
@@ -368,6 +370,8 @@ import type {
368370
AdminWorkflowsPermissionsLookupResponse,
369371
AdminWorkflowsSearchResponse,
370372
AdminWorkflowsUnpublishResponse,
373+
AgentsSessionsRenameResponse,
374+
AgentsSessionsSetStatusResponse,
371375
ApiTestResponse,
372376
AppsConnectionsOpenResponse,
373377
AppsEventAuthorizationsListResponse,
@@ -1374,6 +1378,24 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
13741378
},
13751379
};
13761380

1381+
public readonly agents = {
1382+
sessions: {
1383+
/**
1384+
* @description Rename an agent session.
1385+
* @see {@link https://docs.slack.dev/reference/methods/agents.sessions.rename `agents.sessions.rename` API reference}.
1386+
*/
1387+
rename: bindApiCall<AgentsSessionsRenameArguments, AgentsSessionsRenameResponse>(this, 'agents.sessions.rename'),
1388+
/**
1389+
* @description Set an agent session's lifecycle status, creating the session if needed.
1390+
* @see {@link https://docs.slack.dev/reference/methods/agents.sessions.setStatus `agents.sessions.setStatus` API reference}.
1391+
*/
1392+
setStatus: bindApiCall<AgentsSessionsSetStatusArguments, AgentsSessionsSetStatusResponse>(
1393+
this,
1394+
'agents.sessions.setStatus',
1395+
),
1396+
},
1397+
};
1398+
13771399
public readonly api = {
13781400
/**
13791401
* @description Checks API calling code.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import type { TokenOverridable } from './common';
2+
3+
// https://docs.slack.dev/reference/methods/agents.sessions.rename
4+
export interface AgentsSessionsRenameArguments extends TokenOverridable {
5+
/** @description Channel ID containing the agent session. */
6+
channel_id: string;
7+
/** @description The title to use for the agent session. */
8+
title: string;
9+
/** @description Message timestamp for thread-based sessions. Omit for session channels. */
10+
thread_ts?: string;
11+
}
12+
13+
// https://docs.slack.dev/reference/methods/agents.sessions.setStatus
14+
export interface AgentsSessionsSetStatusArguments extends TokenOverridable {
15+
/** @description Channel ID containing the agent session. */
16+
channel_id: string;
17+
/** @description The lifecycle status to set. One of: `active`, `processing`, `suspended`, `closed`. */
18+
status: string;
19+
/** @description Message timestamp for thread-based sessions. Omit for session channels. */
20+
thread_ts?: string;
21+
/** @description The title to display for the agent session. */
22+
title?: string;
23+
/** @description Encoded ID of the user who initiated the agent session. */
24+
initiator_user_id?: string;
25+
/**
26+
* @description Emoji to use as the icon for this message. Overrides `icon_url`.
27+
* @example :chart_with_upwards_trend:
28+
*/
29+
icon_emoji?: string;
30+
/**
31+
* @description Image URL to use as the icon for this message.
32+
* @example http://lorempixel.com/48/48
33+
*/
34+
icon_url?: string;
35+
/**
36+
* @description The bot's username to display.
37+
* @example My Bot
38+
*/
39+
username?: string;
40+
}

‎packages/web-api/src/types/request/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export type {
118118
AdminWorkflowsSearchArguments,
119119
AdminWorkflowsUnpublishArguments,
120120
} from './admin/workflows';
121+
export type { AgentsSessionsRenameArguments, AgentsSessionsSetStatusArguments } from './agents';
121122
export type { APITestArguments } from './api';
122123
export type {
123124
AppsConnectionsOpenArguments,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/////////////////////////////////////////////////////////////////////////////////////////
2+
// //
3+
// !!! DO NOT EDIT THIS FILE !!! //
4+
// //
5+
// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. //
6+
// Please refer to the script code to learn how to update the source data. //
7+
// //
8+
/////////////////////////////////////////////////////////////////////////////////////////
9+
10+
import type { WebAPICallResult } from '../../WebClient';
11+
export type AgentsSessionsRenameResponse = WebAPICallResult & {
12+
error?: string;
13+
needed?: string;
14+
ok?: boolean;
15+
provided?: string;
16+
title?: string;
17+
warning?: string;
18+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/////////////////////////////////////////////////////////////////////////////////////////
2+
// //
3+
// !!! DO NOT EDIT THIS FILE !!! //
4+
// //
5+
// This file is auto-generated by scripts/generate-web-api-types.sh in the repository. //
6+
// Please refer to the script code to learn how to update the source data. //
7+
// //
8+
/////////////////////////////////////////////////////////////////////////////////////////
9+
10+
import type { WebAPICallResult } from '../../WebClient';
11+
export type AgentsSessionsSetStatusResponse = WebAPICallResult & {
12+
agent_status?: string;
13+
error?: string;
14+
needed?: string;
15+
ok?: boolean;
16+
provided?: string;
17+
status?: string;
18+
title?: string;
19+
warning?: string;
20+
};

‎packages/web-api/src/types/response/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ export { AdminWorkflowsCollaboratorsRemoveResponse } from './AdminWorkflowsColla
102102
export { AdminWorkflowsPermissionsLookupResponse } from './AdminWorkflowsPermissionsLookupResponse';
103103
export { AdminWorkflowsSearchResponse } from './AdminWorkflowsSearchResponse';
104104
export { AdminWorkflowsUnpublishResponse } from './AdminWorkflowsUnpublishResponse';
105+
export { AgentsSessionsRenameResponse } from './AgentsSessionsRenameResponse';
106+
export { AgentsSessionsSetStatusResponse } from './AgentsSessionsSetStatusResponse';
105107
export { ApiTestResponse } from './ApiTestResponse';
106108
export { AppsConnectionsOpenResponse } from './AppsConnectionsOpenResponse';
107109
export { AppsEventAuthorizationsListResponse } from './AppsEventAuthorizationsListResponse';

0 commit comments

Comments
 (0)