Skip to content

Commit 2d884a2

Browse files
committed
Re-order methods
1 parent 3d8746f commit 2d884a2

2 files changed

Lines changed: 284 additions & 284 deletions

File tree

slack/web/async_client.py

Lines changed: 144 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,150 @@ async def admin_apps_restricted_list(self, **kwargs) -> AsyncSlackResponse:
122122
"admin.apps.restricted.list", http_verb="GET", params=kwargs
123123
)
124124

125+
async def admin_conversations_create(
126+
self, *, is_private: bool, name: str, **kwargs
127+
) -> AsyncSlackResponse:
128+
"""Create a public or private channel-based conversation.
129+
130+
Args:
131+
is_private (bool): When true, creates a private channel instead of a public channel
132+
name (str): Name of the public or private channel to create.
133+
org_wide (bool): When true, the channel will be available org-wide.
134+
Note: if the channel is not org_wide=true, you must specify a team_id for this channel
135+
team_id (str): The workspace to create the channel in.
136+
Note: this argument is required unless you set org_wide=true.
137+
138+
"""
139+
kwargs.update({"is_private": is_private, "name": name})
140+
return await self.api_call("admin.conversations.create", json=kwargs)
141+
142+
async def admin_conversations_delete(
143+
self, *, channel_id: str, **kwargs
144+
) -> AsyncSlackResponse:
145+
"""Delete a public or private channel.
146+
147+
Args:
148+
channel_id (str): The channel to delete.
149+
150+
"""
151+
kwargs.update({"channel_id": channel_id})
152+
return await self.api_call("admin.conversations.delete", json=kwargs)
153+
154+
async def admin_conversations_invite(
155+
self, *, channel_id: str, user_ids: Union[str, List[str]], **kwargs
156+
) -> AsyncSlackResponse:
157+
"""Invite a user to a public or private channel.
158+
159+
Args:
160+
channel_id (str): The channel that the users will be invited to.
161+
user_ids (str or list): The users to invite.
162+
"""
163+
kwargs.update({"channel_id": channel_id})
164+
if isinstance(user_ids, list):
165+
kwargs.update({"user_ids": ",".join(user_ids)})
166+
else:
167+
kwargs.update({"user_ids": user_ids})
168+
# NOTE: the endpoint is unable to handle Content-Type: application/json as of Sep 3, 2020.
169+
return await self.api_call("admin.conversations.invite", params=kwargs)
170+
171+
async def admin_conversations_archive(
172+
self, *, channel_id: str, **kwargs
173+
) -> AsyncSlackResponse:
174+
"""Archive a public or private channel.
175+
176+
Args:
177+
channel_id (str): The channel to archive.
178+
"""
179+
kwargs.update({"channel_id": channel_id})
180+
return await self.api_call("admin.conversations.archive", json=kwargs)
181+
182+
async def admin_conversations_unarchive(
183+
self, *, channel_id: str, **kwargs
184+
) -> AsyncSlackResponse:
185+
"""Unarchive a public or private channel.
186+
187+
Args:
188+
channel_id (str): The channel to unarchive.
189+
"""
190+
kwargs.update({"channel_id": channel_id})
191+
return await self.api_call("admin.conversations.unarchive", json=kwargs)
192+
193+
async def admin_conversations_rename(
194+
self, *, channel_id: str, name: str, **kwargs
195+
) -> AsyncSlackResponse:
196+
"""Rename a public or private channel.
197+
198+
Args:
199+
channel_id (str): The channel to rename.
200+
name (str): The name to rename the channel to.
201+
"""
202+
kwargs.update({"channel_id": channel_id, "name": name})
203+
return await self.api_call("admin.conversations.rename", json=kwargs)
204+
205+
async def admin_conversations_search(self, **kwargs) -> AsyncSlackResponse:
206+
"""Search for public or private channels in an Enterprise organization."""
207+
return await self.api_call("admin.conversations.search", json=kwargs)
208+
209+
async def admin_conversations_convertToPrivate(
210+
self, *, channel_id: str, **kwargs
211+
) -> AsyncSlackResponse:
212+
"""Convert a public channel to a private channel.
213+
214+
Args:
215+
channel_id (str): The channel to convert to private.
216+
"""
217+
kwargs.update({"channel_id": channel_id})
218+
return await self.api_call("admin.conversations.convertToPrivate", json=kwargs)
219+
220+
async def admin_conversations_setConversationPrefs(
221+
self, *, channel_id: str, prefs: Union[str, dict], **kwargs
222+
) -> AsyncSlackResponse:
223+
"""Set the posting permissions for a public or private channel.
224+
225+
Args:
226+
channel_id (str): The channel to set the prefs for
227+
prefs (str or dict): The prefs for this channel in a stringified JSON format.
228+
"""
229+
kwargs.update({"channel_id": channel_id, "prefs": prefs})
230+
return await self.api_call(
231+
"admin.conversations.setConversationPrefs", json=kwargs
232+
)
233+
234+
async def admin_conversations_getConversationPrefs(
235+
self, *, channel_id: str, **kwargs
236+
) -> AsyncSlackResponse:
237+
"""Get conversation preferences for a public or private channel.
238+
239+
Args:
240+
channel_id (str): The channel to get the preferences for.
241+
"""
242+
kwargs.update({"channel_id": channel_id})
243+
return await self.api_call(
244+
"admin.conversations.getConversationPrefs", json=kwargs
245+
)
246+
247+
async def admin_conversations_disconnectShared(
248+
self, *, channel_id: str, **kwargs
249+
) -> AsyncSlackResponse:
250+
"""Disconnect a connected channel from one or more workspaces.
251+
252+
Args:
253+
channel_id (str): The channel to be disconnected from some workspaces.
254+
"""
255+
kwargs.update({"channel_id": channel_id})
256+
return await self.api_call("admin.conversations.disconnectShared", json=kwargs)
257+
258+
async def admin_conversations_ekm_listOriginalConnectedChannelInfo(
259+
self, **kwargs
260+
) -> AsyncSlackResponse:
261+
"""List all disconnected channels—i.e.,
262+
channels that were once connected to other workspaces and then disconnected—and
263+
the corresponding original channel IDs for key revocation with EKM.
264+
"""
265+
return await self.api_call(
266+
"admin.conversations.ekm.listOriginalConnectedChannelInfo", params=kwargs
267+
)
268+
125269
async def admin_conversations_restrictAccess_addGroup(
126270
self, *, channel_id: str, group_id: str, **kwargs
127271
) -> AsyncSlackResponse:
@@ -2176,147 +2320,3 @@ async def views_publish(
21762320
else:
21772321
kwargs.update({"view": view})
21782322
return await self.api_call("views.publish", json=kwargs)
2179-
2180-
async def admin_conversations_create(
2181-
self, *, is_private: bool, name: str, **kwargs
2182-
) -> AsyncSlackResponse:
2183-
"""Create a public or private channel-based conversation.
2184-
2185-
Args:
2186-
is_private (bool): When true, creates a private channel instead of a public channel
2187-
name (str): Name of the public or private channel to create.
2188-
org_wide (bool): When true, the channel will be available org-wide.
2189-
Note: if the channel is not org_wide=true, you must specify a team_id for this channel
2190-
team_id (str): The workspace to create the channel in.
2191-
Note: this argument is required unless you set org_wide=true.
2192-
2193-
"""
2194-
kwargs.update({"is_private": is_private, "name": name})
2195-
return await self.api_call("admin.conversations.create", json=kwargs)
2196-
2197-
async def admin_conversations_delete(
2198-
self, *, channel_id: str, **kwargs
2199-
) -> AsyncSlackResponse:
2200-
"""Delete a public or private channel.
2201-
2202-
Args:
2203-
channel_id (str): The channel to delete.
2204-
2205-
"""
2206-
kwargs.update({"channel_id": channel_id})
2207-
return await self.api_call("admin.conversations.delete", json=kwargs)
2208-
2209-
async def admin_conversations_invite(
2210-
self, *, channel_id: str, user_ids: Union[str, List[str]], **kwargs
2211-
) -> AsyncSlackResponse:
2212-
"""Invite a user to a public or private channel.
2213-
2214-
Args:
2215-
channel_id (str): The channel that the users will be invited to.
2216-
user_ids (str or list): The users to invite.
2217-
"""
2218-
kwargs.update({"channel_id": channel_id})
2219-
if isinstance(user_ids, list):
2220-
kwargs.update({"user_ids": ",".join(user_ids)})
2221-
else:
2222-
kwargs.update({"user_ids": user_ids})
2223-
# NOTE: the endpoint is unable to handle Content-Type: application/json as of Sep 3, 2020.
2224-
return await self.api_call("admin.conversations.invite", params=kwargs)
2225-
2226-
async def admin_conversations_archive(
2227-
self, *, channel_id: str, **kwargs
2228-
) -> AsyncSlackResponse:
2229-
"""Archive a public or private channel.
2230-
2231-
Args:
2232-
channel_id (str): The channel to archive.
2233-
"""
2234-
kwargs.update({"channel_id": channel_id})
2235-
return await self.api_call("admin.conversations.archive", json=kwargs)
2236-
2237-
async def admin_conversations_unarchive(
2238-
self, *, channel_id: str, **kwargs
2239-
) -> AsyncSlackResponse:
2240-
"""Unarchive a public or private channel.
2241-
2242-
Args:
2243-
channel_id (str): The channel to unarchive.
2244-
"""
2245-
kwargs.update({"channel_id": channel_id})
2246-
return await self.api_call("admin.conversations.unarchive", json=kwargs)
2247-
2248-
async def admin_conversations_rename(
2249-
self, *, channel_id: str, name: str, **kwargs
2250-
) -> AsyncSlackResponse:
2251-
"""Rename a public or private channel.
2252-
2253-
Args:
2254-
channel_id (str): The channel to rename.
2255-
name (str): The name to rename the channel to.
2256-
"""
2257-
kwargs.update({"channel_id": channel_id, "name": name})
2258-
return await self.api_call("admin.conversations.rename", json=kwargs)
2259-
2260-
async def admin_conversations_search(self, **kwargs) -> AsyncSlackResponse:
2261-
"""Search for public or private channels in an Enterprise organization."""
2262-
return await self.api_call("admin.conversations.search", json=kwargs)
2263-
2264-
async def admin_conversations_convertToPrivate(
2265-
self, *, channel_id: str, **kwargs
2266-
) -> AsyncSlackResponse:
2267-
"""Convert a public channel to a private channel.
2268-
2269-
Args:
2270-
channel_id (str): The channel to convert to private.
2271-
"""
2272-
kwargs.update({"channel_id": channel_id})
2273-
return await self.api_call("admin.conversations.convertToPrivate", json=kwargs)
2274-
2275-
async def admin_conversations_setConversationPrefs(
2276-
self, *, channel_id: str, prefs: Union[str, dict], **kwargs
2277-
) -> AsyncSlackResponse:
2278-
"""Set the posting permissions for a public or private channel.
2279-
2280-
Args:
2281-
channel_id (str): The channel to set the prefs for
2282-
prefs (str or dict): The prefs for this channel in a stringified JSON format.
2283-
"""
2284-
kwargs.update({"channel_id": channel_id, "prefs": prefs})
2285-
return await self.api_call(
2286-
"admin.conversations.setConversationPrefs", json=kwargs
2287-
)
2288-
2289-
async def admin_conversations_getConversationPrefs(
2290-
self, *, channel_id: str, **kwargs
2291-
) -> AsyncSlackResponse:
2292-
"""Get conversation preferences for a public or private channel.
2293-
2294-
Args:
2295-
channel_id (str): The channel to get the preferences for.
2296-
"""
2297-
kwargs.update({"channel_id": channel_id})
2298-
return await self.api_call(
2299-
"admin.conversations.getConversationPrefs", json=kwargs
2300-
)
2301-
2302-
async def admin_conversations_disconnectShared(
2303-
self, *, channel_id: str, **kwargs
2304-
) -> AsyncSlackResponse:
2305-
"""Disconnect a connected channel from one or more workspaces.
2306-
2307-
Args:
2308-
channel_id (str): The channel to be disconnected from some workspaces.
2309-
"""
2310-
kwargs.update({"channel_id": channel_id})
2311-
return await self.api_call("admin.conversations.disconnectShared", json=kwargs)
2312-
2313-
async def admin_conversations_ekm_listOriginalConnectedChannelInfo(
2314-
self, **kwargs
2315-
) -> AsyncSlackResponse:
2316-
"""List all disconnected channels—i.e.,
2317-
channels that were once connected to other workspaces and then disconnected—and
2318-
the corresponding original channel IDs for key revocation with EKM.
2319-
"""
2320-
return await self.api_call(
2321-
"admin.conversations.ekm.listOriginalConnectedChannelInfo", params=kwargs
2322-
)

0 commit comments

Comments
 (0)