Skip to content

Commit

Permalink
Update API from slack-api-ref@3ec3c10 (2024-11-10)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow committed Nov 10, 2024
1 parent 4d5d8da commit edc0133
Show file tree
Hide file tree
Showing 26 changed files with 458 additions and 32 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* [#525](https://github.com/slack-ruby/slack-ruby-client/pull/525): Exclude spec files from gem package - [@amatsuda](https://github.com/amatsuda).
* [#527](https://github.com/slack-ruby/slack-ruby-client/pull/527): Explicitly require `racc` and `ostruct` - [@dblock](https://github.com/dblock).
* [#528](https://github.com/slack-ruby/slack-ruby-client/pull/528): Don't treat asterisks in list items as italic in markdown - [@rspeicher](https://github.com/rspeicher).
* [#524](https://github.com/slack-ruby-client/pulls/524): Update API from [slack-api-ref@3ec3c10](https://github.com/slack-ruby/slack-api-ref/commit/3ec3c10) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot).
* Your contribution here.

### 2.4.0 (2024/07/14)
Expand Down
21 changes: 21 additions & 0 deletions bin/commands/admin_conversations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ class App
end
end

g.desc 'Link a Salesforce record to a channel'
g.long_desc %( Link a Salesforce record to a channel )
g.command 'linkObjects' do |c|
c.flag 'channel', desc: 'Channel ID for Slack channel that will be linked to a Salesforce record.'
c.flag 'record_id', desc: 'Salesforce record ID (15 or 18 digit accepted). See here for how to look up record ID.'
c.flag 'salesforce_org_id', desc: 'Salesforce org ID (15 or 18 digit accepted). See here for how to look up Salesforce org ID.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.admin_conversations_linkObjects(options))
end
end

g.desc 'Returns channels on the given team using the filters.'
g.long_desc %( Returns channels on the given team using the filters. )
g.command 'lookup' do |c|
Expand Down Expand Up @@ -222,6 +233,16 @@ class App
puts JSON.dump(@client.admin_conversations_unarchive(options))
end
end

g.desc 'Unlink a Salesforce record from a channel'
g.long_desc %( Unlink a Salesforce record from a channel )
g.command 'unlinkObjects' do |c|
c.flag 'channel', desc: 'Channel ID for Slack channel that will be unlinked from the Salesforce record.'
c.flag 'new_name', desc: 'Channel name you would like to give to the channel that is being unlinked from the Salesforce record.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.admin_conversations_unlinkObjects(options))
end
end
end
end
end
Expand Down
1 change: 1 addition & 0 deletions bin/commands/admin_users_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class App
g.long_desc %( Revoke a single session for a user. The user will be forced to login to Slack. )
g.command 'invalidate' do |c|
c.flag 'session_id', desc: 'ID of the session to invalidate.'
c.flag 'user_id', desc: 'ID of the user that the session belongs to.'
c.flag 'team_id', desc: 'ID of the workspace that the session belongs to.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.admin_users_session_invalidate(options))
Expand Down
45 changes: 45 additions & 0 deletions bin/commands/assistant_threads.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

module Slack
module Cli
class App
desc 'AssistantThreads methods.'
command 'assistant_threads' do |g|
g.desc 'Set the status for an AI assistant thread.'
g.long_desc %( Set the status for an AI assistant thread. )
g.command 'setStatus' do |c|
c.flag 'channel_id', desc: 'Channel ID containing the assistant thread.'
c.flag 'status', desc: "Status of the specified bot user, e.g. 'is thinking...'."
c.flag 'thread_ts', desc: 'Message timestamp of the thread of where to set the status.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.assistant_threads_setStatus(options))
end
end

g.desc 'Set suggested prompts for the given assistant thread'
g.long_desc %( Set suggested prompts for the given assistant thread )
g.command 'setSuggestedPrompts' do |c|
c.flag 'channel_id', desc: 'Channel ID containing the assistant thread.'
c.flag 'prompts', desc: 'Each prompt should be supplied with its title and message attribute.'
c.flag 'thread_ts', desc: 'Message timestamp of the thread to set suggested prompts for.'
c.flag 'title', desc: 'Title for the list of provided prompts. For example: Suggested Prompts, Related Questions.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.assistant_threads_setSuggestedPrompts(options))
end
end

g.desc 'Set the title for the given assistant thread'
g.long_desc %( Set the title for the given assistant thread )
g.command 'setTitle' do |c|
c.flag 'channel_id', desc: 'Channel ID containing the assistant thread.'
c.flag 'thread_ts', desc: 'Message timestamp of the thread to set suggested prompts for.'
c.flag 'title', desc: 'The title to use for the thread.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.assistant_threads_setTitle(options))
end
end
end
end
end
end
8 changes: 4 additions & 4 deletions bin/commands/canvases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module Cli
class App
desc 'Canvases methods.'
command 'canvases' do |g|
g.desc 'Create Canvas for a user.'
g.long_desc %( Create Canvas for a user. )
g.desc 'Create canvas for a user'
g.long_desc %( Create canvas for a user )
g.command 'create' do |c|
c.flag 'document_content', desc: 'Structure describing the type and value of the content to create.'
c.flag 'title', desc: 'Title of the newly created canvas.'
Expand All @@ -16,8 +16,8 @@ class App
end
end

g.desc 'Deletes a canvas.'
g.long_desc %( Deletes a canvas. )
g.desc 'Deletes a canvas'
g.long_desc %( Deletes a canvas )
g.command 'delete' do |c|
c.flag 'canvas_id', desc: 'Encoded ID of the canvas.'
c.action do |_global_options, options, _args|
Expand Down
4 changes: 2 additions & 2 deletions bin/commands/chat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ class App
g.desc 'Sends a message to a channel.'
g.long_desc %( Sends a message to a channel. )
g.command 'postMessage' do |c|
c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.'
c.flag 'channel', desc: 'An encoded ID that represents a channel, private group, or IM channel to send the message to. See below for more details.'
c.flag 'attachments', desc: 'A JSON-based array of structured attachments, presented as a URL-encoded string.'
c.flag 'blocks', desc: 'A JSON-based array of structured blocks, presented as a URL-encoded string.'
c.flag 'text', desc: 'How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.'
c.flag 'as_user', desc: '(Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic Slack apps. See authorship below.'
c.flag 'as_user', desc: '(Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic apps. See legacy as_user parameter below.'
c.flag 'icon_emoji', desc: 'Emoji to use as the icon for this message. Overrides icon_url.'
c.flag 'icon_url', desc: 'URL to an image to use as the icon for this message.'
c.flag 'link_names', desc: 'Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead.'
Expand Down
10 changes: 5 additions & 5 deletions bin/commands/conversations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class App
g.command 'inviteShared' do |c|
c.flag 'channel', desc: "ID of the channel on your team that you'd like to share."
c.flag 'emails', desc: 'Optional email to receive this invite. Either emails or user_ids must be provided. Only one email or one user ID may be invited at a time.'
c.flag 'external_limited', desc: 'Optional boolean on whether invite is to a external limited member. Defaults to true.'
c.flag 'external_limited', desc: 'Optional boolean on whether invite is to an external limited member. Defaults to true.'
c.flag 'user_ids', desc: 'Optional user_id to receive this invite. Either emails or user_ids must be provided. Only one email or one user ID may be invited at a time.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_inviteShared(options))
Expand Down Expand Up @@ -228,11 +228,11 @@ class App
end
end

g.desc 'Sets the purpose for a conversation.'
g.long_desc %( Sets the purpose for a conversation. )
g.desc 'Sets the channel description.'
g.long_desc %( Sets the channel description. )
g.command 'setPurpose' do |c|
c.flag 'channel', desc: 'Conversation to set the purpose of.'
c.flag 'purpose', desc: 'A new, specialer purpose.'
c.flag 'channel', desc: 'Channel to set the description of.'
c.flag 'purpose', desc: 'The description.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_setPurpose(options))
end
Expand Down
4 changes: 2 additions & 2 deletions bin/commands/conversations_canvases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module Cli
class App
desc 'ConversationsCanvases methods.'
command 'conversations_canvases' do |g|
g.desc 'Create a Channel Canvas for a channel.'
g.long_desc %( Create a Channel Canvas for a channel. )
g.desc 'Create a channel canvas for a channel'
g.long_desc %( Create a channel canvas for a channel )
g.command 'create' do |c|
c.flag 'channel_id', desc: 'Channel ID of the channel we create the channel canvas for.'
c.flag 'document_content', desc: 'Structure describing the type and value of the content to create.'
Expand Down
48 changes: 48 additions & 0 deletions bin/commands/conversations_requestSharedInvite.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true
# This file was auto-generated by lib/tasks/web.rake

module Slack
module Cli
class App
desc 'ConversationsRequestsharedinvite methods.'
command 'conversations_requestSharedInvite' do |g|
g.desc 'Approves a request to add an external user to a channel and sends them a Slack Connect invite'
g.long_desc %( Approves a request to add an external user to a channel and sends them a Slack Connect invite )
g.command 'approve' do |c|
c.flag 'invite_id', desc: 'ID of the requested shared channel invite to approve.'
c.flag 'channel_id', desc: 'Optional channel_id to which external user will be invited to. Will override the value on the requested invite.'
c.flag 'is_external_limited', desc: 'Optional boolean on whether the invited team will have post-only permissions in the channel. Will override the value on the requested invite.'
c.flag 'message', desc: 'Object describing the text to send along with the invite. If this object is specified, both text and is_override are required properties. If is_override is set to true, text will override the original invitation message. Otherwise, text will be appended to the original invitation message. The total length of the message cannot exceed 560 characters. If is_override is set to false, the length of text and the user specified message on the invite request in total must be less than 560 characters.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_requestSharedInvite_approve(options))
end
end

g.desc 'Denies a request to invite an external user to a channel'
g.long_desc %( Denies a request to invite an external user to a channel )
g.command 'deny' do |c|
c.flag 'invite_id', desc: 'ID of the requested shared channel invite to deny.'
c.flag 'message', desc: 'Optional message explaining why the request to invite was denied.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_requestSharedInvite_deny(options))
end
end

g.desc 'Lists requests to add external users to channels with ability to filter.'
g.long_desc %( Lists requests to add external users to channels with ability to filter. )
g.command 'list' do |c|
c.flag 'cursor', desc: "Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. See pagination for more detail."
c.flag 'include_approved', desc: 'When true approved invitation requests will be returned, otherwise they will be excluded.'
c.flag 'include_denied', desc: 'When true denied invitation requests will be returned, otherwise they will be excluded.'
c.flag 'include_expired', desc: 'When true expired invitation requests will be returned, otherwise they will be excluded.'
c.flag 'invite_ids', desc: 'An optional list of invitation ids to look up.'
c.flag 'limit', desc: 'The number of items to return. Must be between 1 - 1000 (inclusive).'
c.flag 'user_id', desc: 'Optional filter to return invitation requests for the inviting user.'
c.action do |_global_options, options, _args|
puts JSON.dump(@client.conversations_requestSharedInvite_list(options))
end
end
end
end
end
end
2 changes: 2 additions & 0 deletions bin/commands/usergroups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class App
c.flag 'name', desc: 'A name for the User Group. Must be unique among User Groups.'
c.flag 'channels', desc: 'A comma separated string of encoded channel IDs for which the User Group uses as a default.'
c.flag 'description', desc: 'A short description of the User Group.'
c.flag 'enable_section', desc: 'Configure this user group to show as a sidebar section for all group members. Note: Only relevant if group has 1 or more default channels added.'
c.flag 'handle', desc: 'A mention handle. Must be unique among channels, users and User Groups.'
c.flag 'include_count', desc: 'Include the number of users in each User Group.'
c.flag 'team_id', desc: 'Encoded team id where the user group has to be created, required if org token is used.'
Expand Down Expand Up @@ -60,6 +61,7 @@ class App
c.flag 'usergroup', desc: 'The encoded ID of the User Group to update.'
c.flag 'channels', desc: 'A comma separated string of encoded channel IDs for which the User Group uses as a default.'
c.flag 'description', desc: 'A short description of the User Group.'
c.flag 'enable_section', desc: 'Configure this user group to show as a sidebar section for all group members. Note: Only relevant if group has 1 or more default channels added.'
c.flag 'handle', desc: 'A mention handle. Must be unique among channels, users and User Groups.'
c.flag 'include_count', desc: 'Include the number of users in the User Group.'
c.flag 'name', desc: 'A name for the User Group. Must be unique among User Groups.'
Expand Down
4 changes: 4 additions & 0 deletions lib/slack/web/api/endpoints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
require_relative 'endpoints/apps_datastore'
require_relative 'endpoints/apps_event_authorizations'
require_relative 'endpoints/apps_manifest'
require_relative 'endpoints/assistant_threads'
require_relative 'endpoints/auth'
require_relative 'endpoints/auth_teams'
require_relative 'endpoints/bookmarks'
Expand All @@ -55,6 +56,7 @@
require_relative 'endpoints/conversations'
require_relative 'endpoints/conversations_canvases'
require_relative 'endpoints/conversations_externalInvitePermissions'
require_relative 'endpoints/conversations_requestSharedInvite'
require_relative 'endpoints/dialog'
require_relative 'endpoints/dnd'
require_relative 'endpoints/emoji'
Expand Down Expand Up @@ -139,6 +141,7 @@ module Endpoints
include AppsDatastore
include AppsEventAuthorizations
include AppsManifest
include AssistantThreads
include Auth
include AuthTeams
include Bookmarks
Expand All @@ -153,6 +156,7 @@ module Endpoints
include Conversations
include ConversationsCanvases
include ConversationsExternalinvitepermissions
include ConversationsRequestsharedinvite
include Dialog
include Dnd
include Emoji
Expand Down
35 changes: 35 additions & 0 deletions lib/slack/web/api/endpoints/admin_conversations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,25 @@ def admin_conversations_invite(options = {})
post('admin.conversations.invite', options)
end

#
# Link a Salesforce record to a channel
#
# @option options [channel] :channel
# Channel ID for Slack channel that will be linked to a Salesforce record.
# @option options [string] :record_id
# Salesforce record ID (15 or 18 digit accepted). See here for how to look up record ID.
# @option options [string] :salesforce_org_id
# Salesforce org ID (15 or 18 digit accepted). See here for how to look up Salesforce org ID.
# @see https://api.slack.com/methods/admin.conversations.linkObjects
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.linkObjects.json
def admin_conversations_linkObjects(options = {})
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
raise ArgumentError, 'Required arguments :record_id missing' if options[:record_id].nil?
raise ArgumentError, 'Required arguments :salesforce_org_id missing' if options[:salesforce_org_id].nil?
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
post('admin.conversations.linkObjects', options)
end

#
# Returns channels on the given team using the filters.
#
Expand Down Expand Up @@ -338,6 +357,22 @@ def admin_conversations_unarchive(options = {})
raise ArgumentError, 'Required arguments :channel_id missing' if options[:channel_id].nil?
post('admin.conversations.unarchive', options)
end

#
# Unlink a Salesforce record from a channel
#
# @option options [channel] :channel
# Channel ID for Slack channel that will be unlinked from the Salesforce record.
# @option options [string] :new_name
# Channel name you would like to give to the channel that is being unlinked from the Salesforce record.
# @see https://api.slack.com/methods/admin.conversations.unlinkObjects
# @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.conversations/admin.conversations.unlinkObjects.json
def admin_conversations_unlinkObjects(options = {})
raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
raise ArgumentError, 'Required arguments :new_name missing' if options[:new_name].nil?
options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
post('admin.conversations.unlinkObjects', options)
end
end
end
end
Expand Down
Loading

0 comments on commit edc0133

Please sign in to comment.