Skip to content

Commit 59f200a

Browse files
author
Fil Maj
authoredOct 7, 2024··
web-api(feat): add support for conversations.requestShared.list API (#2072)
1 parent 01d9d2d commit 59f200a

File tree

6 files changed

+133
-2
lines changed

6 files changed

+133
-2
lines changed
 

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

+10
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ import type {
165165
ConversationsRepliesArguments,
166166
ConversationsRequestSharedInviteApproveArguments,
167167
ConversationsRequestSharedInviteDenyArguments,
168+
ConversationsRequestSharedInviteListArguments,
168169
ConversationsSetPurposeArguments,
169170
ConversationsSetTopicArguments,
170171
ConversationsUnarchiveArguments,
@@ -417,6 +418,7 @@ import type {
417418
ConversationsRepliesResponse,
418419
ConversationsRequestSharedInviteApproveResponse,
419420
ConversationsRequestSharedInviteDenyResponse,
421+
ConversationsRequestSharedInviteListResponse,
420422
ConversationsSetPurposeResponse,
421423
ConversationsSetTopicResponse,
422424
ConversationsUnarchiveResponse,
@@ -1772,6 +1774,14 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
17721774
this,
17731775
'conversations.requestSharedInvite.deny',
17741776
),
1777+
/**
1778+
* @description Lists requests to add external users to channels with ability to filter.
1779+
* @see {@link https://api.slack.com/methods/conversations.requestSharedInvite.list `conversations.requestSharedInvite.list` API reference}.
1780+
*/
1781+
list: bindApiCallWithOptionalArgument<
1782+
ConversationsRequestSharedInviteListArguments,
1783+
ConversationsRequestSharedInviteListResponse
1784+
>(this, 'conversations.requestSharedInvite.list'),
17751785
},
17761786
/**
17771787
* @description Sets the purpose for a conversation.

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

+22-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ export interface ConversationsRepliesArguments
192192
TimelinePaginationEnabled {}
193193

194194
// https://api.slack.com/methods/conversations.requestSharedInvite.approve
195-
export interface ConversationsRequestSharedInviteApproveArguments extends InviteID, Partial<ChannelID> {
195+
export interface ConversationsRequestSharedInviteApproveArguments
196+
extends InviteID,
197+
Partial<ChannelID>,
198+
TokenOverridable {
196199
/**
197200
* @description Whether the invited team will have post-only permissions in the channel.
198201
* Will override the value on the requested invite.
@@ -211,7 +214,24 @@ export interface ConversationsRequestSharedInviteApproveArguments extends Invite
211214
}
212215

213216
// https://api.slack.com/methods/conversations.requestSharedInvite.deny
214-
export interface ConversationsRequestSharedInviteDenyArguments extends InviteID, Message {}
217+
export interface ConversationsRequestSharedInviteDenyArguments extends InviteID, Message, TokenOverridable {}
218+
219+
// https://api.slack.com/methods/conversations.requestSharedInvite.list
220+
export type ConversationsRequestSharedInviteListArguments = OptionalArgument<
221+
CursorPaginationEnabled &
222+
TokenOverridable & {
223+
/** @description When `true` approved invitation requests will be returned, otherwise they will be excluded. */
224+
include_approved?: boolean;
225+
/** @description When `true` denied invitation requests will be returned, otherwise they will be excluded. */
226+
include_denied?: boolean;
227+
/** @description When `true` expired invitation requests will be returned, otherwise they will be excluded. */
228+
include_expired?: boolean;
229+
/** @description An optional list of invitation ids to look up. */
230+
invite_ids?: string[];
231+
/** @description Optional filter to return invitation requests for the inviting user. */
232+
user_id?: string;
233+
}
234+
>;
215235

216236
// https://api.slack.com/methods/conversations.setPurpose
217237
export interface ConversationsSetPurposeArguments extends Channel, TokenOverridable {

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

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export type {
110110
ConversationsRepliesArguments,
111111
ConversationsRequestSharedInviteApproveArguments,
112112
ConversationsRequestSharedInviteDenyArguments,
113+
ConversationsRequestSharedInviteListArguments,
113114
ConversationsSetPurposeArguments,
114115
ConversationsSetTopicArguments,
115116
ConversationsUnarchiveArguments,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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 ConversationsRequestSharedInviteListResponse = WebAPICallResult & {
12+
invite_requests?: InviteRequest[];
13+
ok?: boolean;
14+
};
15+
16+
export interface InviteRequest {
17+
channel?: Channel;
18+
date_created?: number;
19+
date_last_updated?: number;
20+
expires_at?: number;
21+
id?: string;
22+
inviting_team?: Team;
23+
inviting_user?: InvitingUser;
24+
is_external_limited?: boolean;
25+
target_user?: TargetUser;
26+
}
27+
28+
export interface Channel {
29+
connections?: Connection[];
30+
date_created?: number;
31+
id?: string;
32+
is_im?: boolean;
33+
is_private?: boolean;
34+
name?: string;
35+
pending_connections?: any[];
36+
previous_connections?: any[];
37+
}
38+
39+
export interface Connection {
40+
is_private?: boolean;
41+
team?: Team;
42+
}
43+
44+
export interface Team {
45+
avatar_base_url?: string;
46+
date_created?: number;
47+
domain?: string;
48+
icon?: Icon;
49+
id?: string;
50+
is_verified?: boolean;
51+
name?: string;
52+
requires_sponsorship?: boolean;
53+
}
54+
55+
export interface Icon {
56+
image_102?: string;
57+
image_132?: string;
58+
image_230?: string;
59+
image_34?: string;
60+
image_44?: string;
61+
image_68?: string;
62+
image_88?: string;
63+
image_default?: boolean;
64+
}
65+
66+
export interface InvitingUser {
67+
id?: string;
68+
name?: string;
69+
profile?: Profile;
70+
team_id?: string;
71+
updated?: number;
72+
who_can_share_contact_card?: string;
73+
}
74+
75+
export interface Profile {
76+
avatar_hash?: string;
77+
display_name?: string;
78+
display_name_normalized?: string;
79+
email?: string;
80+
image_192?: string;
81+
image_24?: string;
82+
image_32?: string;
83+
image_48?: string;
84+
image_512?: string;
85+
image_72?: string;
86+
real_name?: string;
87+
real_name_normalized?: string;
88+
team?: string;
89+
}
90+
91+
export interface TargetUser {
92+
recipient_email?: string;
93+
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ export { ConversationsRenameResponse } from './ConversationsRenameResponse';
188188
export { ConversationsRepliesResponse } from './ConversationsRepliesResponse';
189189
export { ConversationsRequestSharedInviteApproveResponse } from './ConversationsRequestSharedInviteApproveResponse';
190190
export { ConversationsRequestSharedInviteDenyResponse } from './ConversationsRequestSharedInviteDenyResponse';
191+
export { ConversationsRequestSharedInviteListResponse } from './ConversationsRequestSharedInviteListResponse';
191192
export { ConversationsSetPurposeResponse } from './ConversationsSetPurposeResponse';
192193
export { ConversationsSetTopicResponse } from './ConversationsSetTopicResponse';
193194
export { ConversationsUnarchiveResponse } from './ConversationsUnarchiveResponse';

‎packages/web-api/test/types/methods/conversations.test-d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,12 @@ expectAssignable<Parameters<typeof web.conversations.requestSharedInvite.deny>>(
378378
},
379379
]);
380380

381+
// conversations.requestSharedInvite.list
382+
// -- sad path
383+
// -- happy path
384+
expectAssignable<Parameters<typeof web.conversations.requestSharedInvite.list>>([{}]); // all optional args
385+
expectAssignable<Parameters<typeof web.conversations.requestSharedInvite.list>>([]); // no arg is fine
386+
381387
// conversations.setPurpose
382388
// -- sad path
383389
expectError(web.conversations.setPurpose()); // lacking argument

0 commit comments

Comments
 (0)
Please sign in to comment.