diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f9925ea..35057840 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### 3.0.1 (Next) +* [#574](https://github.com/slack-ruby/slack-ruby-client/pull/574): Update API from [slack-api-ref@bd5dd34](https://github.com/slack-ruby/slack-api-ref/commit/bd5dd34) - [@slack-ruby-ci-bot](https://github.com/apps/slack-ruby-ci-bot). * Your contribution here. * [#576](https://github.com/slack-ruby/slack-ruby-client/pull/576): Add support for `blocks` in `files_upload_v2` - [@childish-sambino](https://github.com/childish-sambino). diff --git a/bin/commands/admin_functions.rb b/bin/commands/admin_functions.rb index b97d8eaa..5f7d4461 100644 --- a/bin/commands/admin_functions.rb +++ b/bin/commands/admin_functions.rb @@ -6,11 +6,12 @@ module Cli class App desc 'AdminFunctions methods.' command 'admin_functions' do |g| - g.desc 'Look up functions by a set of apps' - g.long_desc %( Look up functions by a set of apps ) + g.desc 'Look up functions by a set of apps.' + g.long_desc %( Look up functions by a set of apps. ) g.command 'list' do |c| c.flag 'team_id', desc: 'The team context to retrieve functions from.' c.flag 'app_ids', desc: 'Comma-separated array of app IDs to get functions for; max 50.' + c.flag 'include_non_distributed_functions', desc: 'Whether to also include functions that are not yet distributed to any users in the function count. This is needed for admins that are approving an app request and will only work if the team owns the app.' c.flag 'cursor', desc: 'Set cursor to next_cursor returned by the previous call to list items in the next page.' c.flag 'limit', desc: 'The number of results that will be returned by the API on each invocation. Must be between 1 and 1000, both inclusive.' c.action do |_global_options, options, _args| diff --git a/bin/commands/admin_functions_permissions.rb b/bin/commands/admin_functions_permissions.rb index 7f4ea3fd..b363daac 100644 --- a/bin/commands/admin_functions_permissions.rb +++ b/bin/commands/admin_functions_permissions.rb @@ -15,8 +15,8 @@ class App end end - g.desc 'Set the visibility of a Slack function and define the users or workspaces if it is set to named_entities' - g.long_desc %( Set the visibility of a Slack function and define the users or workspaces if it is set to named_entities ) + g.desc 'Set the visibility of a Slack function and define the users or workspaces if it is set to named_entities.' + g.long_desc %( Set the visibility of a Slack function and define the users or workspaces if it is set to named_entities. ) g.command 'set' do |c| c.flag 'function_id', desc: 'The function ID to set permissions for.' c.flag 'visibility', desc: 'The function visibility.' diff --git a/bin/commands/admin_users.rb b/bin/commands/admin_users.rb index 372b9119..28857d0f 100644 --- a/bin/commands/admin_users.rb +++ b/bin/commands/admin_users.rb @@ -19,6 +19,16 @@ class App end end + g.desc 'Fetches the expiration timestamp for a guest' + g.long_desc %( Fetches the expiration timestamp for a guest ) + g.command 'getExpiration' do |c| + c.flag 'user_id', desc: 'The ID of the guest user to get the expiration for.' + c.flag 'target_team', desc: 'If an org token is passed in and this team is on the org, it will operate on the workspace level on the specified team. Otherwise it will operate on the org or team in context.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.admin_users_getExpiration(options)) + end + end + g.desc 'Invite a user to a workspace.' g.long_desc %( Invite a user to a workspace. ) g.command 'invite' do |c| diff --git a/bin/commands/assistant_search.rb b/bin/commands/assistant_search.rb index a70eba90..78164c53 100644 --- a/bin/commands/assistant_search.rb +++ b/bin/commands/assistant_search.rb @@ -13,18 +13,21 @@ class App c.flag 'action_token', desc: 'Send action_token as received in a message event.' c.flag 'channel_types', desc: 'Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.' c.flag 'content_types', desc: 'Content types to include, a comma-separated list of any combination of messages, files, channels, users.' - c.flag 'include_bots', desc: 'If you want the results to include bots.' + c.flag 'include_bots', desc: 'Whether the results should include bots.' + c.flag 'include_deleted_users', desc: 'Whether to include deleted users in the user search results. Defaults to false.' c.flag 'before', desc: 'UNIX timestamp filter. If present, filters for results before this date.' c.flag 'after', desc: 'UNIX timestamp filter. If present, filters for results after this date.' c.flag 'include_context_messages', desc: 'Whether to include context messages surrounding the main message result. Defaults to false if unspecified.' c.flag 'context_channel_id', desc: 'Context channel ID to support scoping the search when applicable.' - c.flag 'cursor', desc: 'The cursor returned by the API. Leave this blank for the first request, and use this to get the next page of results.' + c.flag 'cursor', desc: 'The cursor returned by the API. Leave this blank for the first request and use this to get the next page of results.' c.flag 'limit', desc: 'Number of results to return, up to a max of 20. Defaults to 20.' c.flag 'sort', desc: 'The field to sort the results by. Defaults to score. Can be one of: score, timestamp.' c.flag 'sort_dir', desc: 'The direction to sort the results by. Defaults to desc.' c.flag 'include_message_blocks', desc: 'Whether to return the message blocks in the response.' c.flag 'highlight', desc: 'Whether to highlight the search query in the results. Defaults to false if unspecified.' - c.flag 'term_clauses', desc: 'A list of term clauses. A term clause is a string with search terms. Search results returned will match every term clause specified (i.e. conjunctive normal form).' + c.flag 'term_clauses', desc: 'A list of term clauses. A term clause is a string with search terms. Search results returned will match every term clause specified (i.e., conjunctive normal form).' + c.flag 'modifiers', desc: 'A string containing only modifiers in the format of modifier:value. Search results returned will match the modifier value. For now modifiers only affect term clauses.' + c.flag 'include_archived_channels', desc: 'Whether to include archived channels in the search results.' c.action do |_global_options, options, _args| puts JSON.dump(@client.assistant_search_context(options)) end diff --git a/bin/commands/assistant_threads.rb b/bin/commands/assistant_threads.rb index 6d89cf14..128d5c4b 100644 --- a/bin/commands/assistant_threads.rb +++ b/bin/commands/assistant_threads.rb @@ -12,6 +12,7 @@ class App c.flag 'channel_id', desc: 'Channel ID containing the assistant thread.' c.flag 'thread_ts', desc: 'Message timestamp of the thread of where to set the status.' c.flag 'status', desc: "Status of the specified bot user, e.g. 'is thinking...'." + c.flag 'loading_messages', desc: 'The list of messages to rotate through as a loading indicator.' c.action do |_global_options, options, _args| puts JSON.dump(@client.assistant_threads_setStatus(options)) end diff --git a/bin/commands/chat.rb b/bin/commands/chat.rb index 7057e170..90f8d58d 100644 --- a/bin/commands/chat.rb +++ b/bin/commands/chat.rb @@ -6,6 +6,17 @@ module Cli class App desc 'Chat methods.' command 'chat' do |g| + g.desc 'Appends text to an existing streaming conversation.' + g.long_desc %( Appends text to an existing streaming conversation. ) + g.command 'appendStream' do |c| + c.flag 'channel', desc: 'An encoded ID that represents a channel, private group, or DM.' + c.flag 'ts', desc: 'The timestamp of the streaming message.' + c.flag 'markdown_text', desc: 'Accepts message text formatted in markdown. Limit this field to 12,000 characters. This text is what will be appended to the message received so far.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.chat_appendStream(options)) + end + end + g.desc 'Execute a slash command in a public channel (undocumented)' g.long_desc %( Execute a slash command in a public channel ) g.command 'command' do |c| @@ -87,6 +98,7 @@ class App 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 'channel', desc: 'An encoded ID or channel name that represents a channel, private group, or IM channel to send the message to. See below for more details.' + c.flag 'current_draft_last_updated_ts', desc: "This field represents the timestamp of the draft's last update at the time this API is called. If the current message is a draft, this field can be provided to ensure synchronization with the server." 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.' @@ -127,18 +139,45 @@ class App end end + g.desc 'Starts a new streaming conversation.' + g.long_desc %( Starts a new streaming conversation. ) + g.command 'startStream' do |c| + c.flag 'channel', desc: 'An encoded ID that represents a channel, private group, or DM.' + c.flag 'markdown_text', desc: 'Accepts message text formatted in markdown. Limit this field to 12,000 characters.' + c.flag 'thread_ts', desc: "Provide another message's ts value to reply to. Streamed messages should always be replies to a user request." + c.flag 'recipient_user_id', desc: 'The encoded ID of the user to receive the streaming text. Required when streaming to channels.' + c.flag 'recipient_team_id', desc: 'The encoded ID of the team the user receiving the streaming text belongs to. Required when streaming to channels.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.chat_startStream(options)) + end + end + + g.desc 'Stops a streaming conversation.' + g.long_desc %( Stops a streaming conversation. ) + g.command 'stopStream' do |c| + c.flag 'channel', desc: 'An encoded ID that represents a channel, private group, or DM.' + c.flag 'ts', desc: 'The timestamp of the streaming message.' + c.flag 'markdown_text', desc: 'Accepts message text formatted in markdown. Limit this field to 12,000 characters.' + c.flag 'blocks', desc: 'A list of blocks that will be rendered at the bottom of the finalized message.' + c.flag 'metadata', desc: 'JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace.' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.chat_stopStream(options)) + end + end + g.desc 'Provide custom unfurl behavior for user-posted URLs' g.long_desc %( Provide custom unfurl behavior for user-posted URLs ) g.command 'unfurl' do |c| c.flag 'channel', desc: 'Channel ID of the message. Both channel and ts must be provided together, or unfurl_id and source must be provided together.' c.flag 'ts', desc: 'Timestamp of the message to add unfurl behavior to.' - c.flag 'unfurls', desc: 'URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments.' + c.flag 'unfurls', desc: 'URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments. Either unfurls or metadata must be provided.' c.flag 'user_auth_message', desc: 'Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior. Provides two buttons, Not now or Never ask me again.' c.flag 'user_auth_required', desc: 'Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain.' c.flag 'user_auth_url', desc: 'Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.' c.flag 'user_auth_blocks', desc: 'Provide a JSON based array of structured blocks presented as URL-encoded string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior.' c.flag 'unfurl_id', desc: 'The ID of the link to unfurl. Both unfurl_id and source must be provided together, or channel and ts must be provided together.' c.flag 'source', desc: 'The source of the link to unfurl. The source may either be composer, when the link is inside the message composer, or conversations_history, when the link has been posted to a conversation.' + c.flag 'metadata', desc: 'JSON object with entity_type and entity_payload fields, presented as a URL-encoded string. Either unfurls or metadata must be provided.' c.action do |_global_options, options, _args| puts JSON.dump(@client.chat_unfurl(options)) end diff --git a/bin/commands/entity.rb b/bin/commands/entity.rb new file mode 100644 index 00000000..057fa48f --- /dev/null +++ b/bin/commands/entity.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Cli + class App + desc 'Entity methods.' + command 'entity' do |g| + g.desc 'Provide custom flexpane behavior for Work Objects. Apps call this endpoint to send per-user flexpane metadata to the client.' + g.long_desc %( Provide custom flexpane behavior for Work Objects. Apps call this endpoint to send per-user flexpane metadata to the client. ) + g.command 'presentDetails' do |c| + c.flag 'metadata', desc: 'URL-encoded JSON object containing flexpane metadata from the app that will be conformed to a Work Object metadata schema, keyed by entity ID.' + c.flag 'trigger_id', desc: 'A reference to the original user action that initiated the request.' + c.flag 'user_auth_required', desc: 'Set to true (or 1) to indicate that the user must authenticate to view full flexpane data.' + c.flag 'user_auth_url', desc: 'A custom URL to which users are directed for authentication if required.' + c.flag 'error', desc: '' + c.action do |_global_options, options, _args| + puts JSON.dump(@client.entity_presentDetails(options)) + end + end + end + end + end +end diff --git a/bin/commands/files.rb b/bin/commands/files.rb index e8c3e0b2..07187215 100644 --- a/bin/commands/files.rb +++ b/bin/commands/files.rb @@ -12,7 +12,7 @@ class App c.flag 'files', desc: 'Array of file ids and their corresponding (optional) titles.' c.flag 'channel_id', desc: 'Channel ID where the file will be shared. If not specified the file will be private.' c.flag 'thread_ts', desc: "Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead. Also make sure to provide only one channel when using 'thread_ts'." - c.flag 'channels', desc: 'Comma-separated string of channel IDs where the file will be shared.' + c.flag 'channels', desc: 'Comma-separated string of channel IDs or user IDs where the file will be shared.' c.flag 'initial_comment', desc: 'The message text introducing the file in specified channels.' c.flag 'blocks', desc: 'A JSON-based array of structured rich text blocks, presented as a URL-encoded string. If the initial_comment field is provided, the blocks field is ignored.' c.action do |_global_options, options, _args| diff --git a/bin/commands/oauth_v2.rb b/bin/commands/oauth_v2.rb index d3eabd2f..5d142b8e 100644 --- a/bin/commands/oauth_v2.rb +++ b/bin/commands/oauth_v2.rb @@ -12,6 +12,7 @@ class App c.flag 'client_id', desc: 'Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme.' c.flag 'client_secret', desc: 'Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme.' c.flag 'code', desc: 'The code param returned via the OAuth callback.' + c.flag 'code_verifier', desc: 'The code_verifier param used to generate the code_challenge originally. Used for PKCE.' c.flag 'redirect_uri', desc: 'This must match the originally submitted URI (if one was sent).' c.flag 'grant_type', desc: 'The grant_type param as described in the OAuth spec.' c.flag 'refresh_token', desc: 'The refresh_token param as described in the OAuth spec.' diff --git a/lib/slack/web/api/endpoints.rb b/lib/slack/web/api/endpoints.rb index 2401b97e..622e80ea 100644 --- a/lib/slack/web/api/endpoints.rb +++ b/lib/slack/web/api/endpoints.rb @@ -61,6 +61,7 @@ require_relative 'endpoints/dialog' require_relative 'endpoints/dnd' require_relative 'endpoints/emoji' +require_relative 'endpoints/entity' require_relative 'endpoints/files' require_relative 'endpoints/files_comments' require_relative 'endpoints/files_remote' @@ -166,6 +167,7 @@ module Endpoints include Dialog include Dnd include Emoji + include Entity include Files include FilesComments include FilesRemote diff --git a/lib/slack/web/api/endpoints/admin_functions.rb b/lib/slack/web/api/endpoints/admin_functions.rb index 0e5a2b6e..7cdd47ff 100644 --- a/lib/slack/web/api/endpoints/admin_functions.rb +++ b/lib/slack/web/api/endpoints/admin_functions.rb @@ -7,12 +7,14 @@ module Api module Endpoints module AdminFunctions # - # Look up functions by a set of apps + # Look up functions by a set of apps. # # @option options [Object] :team_id # The team context to retrieve functions from. # @option options [array] :app_ids # Comma-separated array of app IDs to get functions for; max 50. + # @option options [boolean] :include_non_distributed_functions + # Whether to also include functions that are not yet distributed to any users in the function count. This is needed for admins that are approving an app request and will only work if the team owns the app. # @option options [string] :cursor # Set cursor to next_cursor returned by the previous call to list items in the next page. # @option options [integer] :limit diff --git a/lib/slack/web/api/endpoints/admin_functions_permissions.rb b/lib/slack/web/api/endpoints/admin_functions_permissions.rb index ba459307..acb2a674 100644 --- a/lib/slack/web/api/endpoints/admin_functions_permissions.rb +++ b/lib/slack/web/api/endpoints/admin_functions_permissions.rb @@ -19,7 +19,7 @@ def admin_functions_permissions_lookup(options = {}) end # - # Set the visibility of a Slack function and define the users or workspaces if it is set to named_entities + # Set the visibility of a Slack function and define the users or workspaces if it is set to named_entities. # # @option options [string] :function_id # The function ID to set permissions for. diff --git a/lib/slack/web/api/endpoints/admin_users.rb b/lib/slack/web/api/endpoints/admin_users.rb index 629b944f..1825990e 100644 --- a/lib/slack/web/api/endpoints/admin_users.rb +++ b/lib/slack/web/api/endpoints/admin_users.rb @@ -27,6 +27,19 @@ def admin_users_assign(options = {}) post('admin.users.assign', options) end + # + # Fetches the expiration timestamp for a guest + # + # @option options [Object] :user_id + # The ID of the guest user to get the expiration for. + # @option options [Object] :target_team + # If an org token is passed in and this team is on the org, it will operate on the workspace level on the specified team. Otherwise it will operate on the org or team in context. + # @see https://api.slack.com/methods/admin.users.getExpiration + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/admin.users/admin.users.getExpiration.json + def admin_users_getExpiration(options = {}) + post('admin.users.getExpiration', options) + end + # # Invite a user to a workspace. # diff --git a/lib/slack/web/api/endpoints/assistant_search.rb b/lib/slack/web/api/endpoints/assistant_search.rb index d27c4e75..2af068c3 100644 --- a/lib/slack/web/api/endpoints/assistant_search.rb +++ b/lib/slack/web/api/endpoints/assistant_search.rb @@ -18,7 +18,9 @@ module AssistantSearch # @option options [array] :content_types # Content types to include, a comma-separated list of any combination of messages, files, channels, users. # @option options [boolean] :include_bots - # If you want the results to include bots. + # Whether the results should include bots. + # @option options [boolean] :include_deleted_users + # Whether to include deleted users in the user search results. Defaults to false. # @option options [integer] :before # UNIX timestamp filter. If present, filters for results before this date. # @option options [integer] :after @@ -28,7 +30,7 @@ module AssistantSearch # @option options [Object] :context_channel_id # Context channel ID to support scoping the search when applicable. # @option options [string] :cursor - # The cursor returned by the API. Leave this blank for the first request, and use this to get the next page of results. + # The cursor returned by the API. Leave this blank for the first request and use this to get the next page of results. # @option options [integer] :limit # Number of results to return, up to a max of 20. Defaults to 20. # @option options [enum] :sort @@ -40,7 +42,11 @@ module AssistantSearch # @option options [boolean] :highlight # Whether to highlight the search query in the results. Defaults to false if unspecified. # @option options [array] :term_clauses - # A list of term clauses. A term clause is a string with search terms. Search results returned will match every term clause specified (i.e. conjunctive normal form). + # A list of term clauses. A term clause is a string with search terms. Search results returned will match every term clause specified (i.e., conjunctive normal form). + # @option options [string] :modifiers + # A string containing only modifiers in the format of modifier:value. Search results returned will match the modifier value. For now modifiers only affect term clauses. + # @option options [boolean] :include_archived_channels + # Whether to include archived channels in the search results. # @see https://api.slack.com/methods/assistant.search.context # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/assistant.search/assistant.search.context.json def assistant_search_context(options = {}) diff --git a/lib/slack/web/api/endpoints/assistant_threads.rb b/lib/slack/web/api/endpoints/assistant_threads.rb index ff4f381e..e45d0825 100644 --- a/lib/slack/web/api/endpoints/assistant_threads.rb +++ b/lib/slack/web/api/endpoints/assistant_threads.rb @@ -9,12 +9,14 @@ module AssistantThreads # # Set the status for an AI assistant thread. # - # @option options [Object] :channel_id + # @option options [string] :channel_id # Channel ID containing the assistant thread. # @option options [string] :thread_ts # Message timestamp of the thread of where to set the status. # @option options [string] :status # Status of the specified bot user, e.g. 'is thinking...'. + # @option options [array] :loading_messages + # The list of messages to rotate through as a loading indicator. # @see https://api.slack.com/methods/assistant.threads.setStatus # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/assistant.threads/assistant.threads.setStatus.json def assistant_threads_setStatus(options = {}) diff --git a/lib/slack/web/api/endpoints/chat.rb b/lib/slack/web/api/endpoints/chat.rb index 548add21..2a75caf1 100644 --- a/lib/slack/web/api/endpoints/chat.rb +++ b/lib/slack/web/api/endpoints/chat.rb @@ -6,6 +6,25 @@ module Web module Api module Endpoints module Chat + # + # Appends text to an existing streaming conversation. + # + # @option options [channel] :channel + # An encoded ID that represents a channel, private group, or DM. + # @option options [timestamp] :ts + # The timestamp of the streaming message. + # @option options [string] :markdown_text + # Accepts message text formatted in markdown. Limit this field to 12,000 characters. This text is what will be appended to the message received so far. + # @see https://api.slack.com/methods/chat.appendStream + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.appendStream.json + def chat_appendStream(options = {}) + raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil? + raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil? + raise ArgumentError, 'Required arguments :markdown_text missing' if options[:markdown_text].nil? + options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] + post('chat.appendStream', options) + end + # # Execute a slash command in a public channel (undocumented) # @@ -142,6 +161,8 @@ def chat_postEphemeral(options = {}) # A JSON-based array of structured blocks, presented as a URL-encoded string. # @option options [channel] :channel # An encoded ID or channel name that represents a channel, private group, or IM channel to send the message to. See below for more details. + # @option options [string] :current_draft_last_updated_ts + # This field represents the timestamp of the draft's last update at the time this API is called. If the current message is a draft, this field can be provided to ensure synchronization with the server. # @option options [string] :icon_emoji # Emoji to use as the icon for this message. Overrides icon_url. # @option options [string] :icon_url @@ -218,6 +239,51 @@ def chat_scheduleMessage(options = {}) post('chat.scheduleMessage', options) end + # + # Starts a new streaming conversation. + # + # @option options [channel] :channel + # An encoded ID that represents a channel, private group, or DM. + # @option options [string] :markdown_text + # Accepts message text formatted in markdown. Limit this field to 12,000 characters. + # @option options [string] :thread_ts + # Provide another message's ts value to reply to. Streamed messages should always be replies to a user request. + # @option options [Object] :recipient_user_id + # The encoded ID of the user to receive the streaming text. Required when streaming to channels. + # @option options [string] :recipient_team_id + # The encoded ID of the team the user receiving the streaming text belongs to. Required when streaming to channels. + # @see https://api.slack.com/methods/chat.startStream + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.startStream.json + def chat_startStream(options = {}) + raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil? + raise ArgumentError, 'Required arguments :thread_ts missing' if options[:thread_ts].nil? + options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] + post('chat.startStream', options) + end + + # + # Stops a streaming conversation. + # + # @option options [channel] :channel + # An encoded ID that represents a channel, private group, or DM. + # @option options [timestamp] :ts + # The timestamp of the streaming message. + # @option options [string] :markdown_text + # Accepts message text formatted in markdown. Limit this field to 12,000 characters. + # @option options [Object] :blocks + # A list of blocks that will be rendered at the bottom of the finalized message. + # @option options [string] :metadata + # JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. + # @see https://api.slack.com/methods/chat.stopStream + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.stopStream.json + def chat_stopStream(options = {}) + raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil? + raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil? + options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] + options = encode_options_as_json(options, %i[metadata]) + post('chat.stopStream', options) + end + # # Provide custom unfurl behavior for user-posted URLs # @@ -226,7 +292,7 @@ def chat_scheduleMessage(options = {}) # @option options [timestamp] :ts # Timestamp of the message to add unfurl behavior to. # @option options [string] :unfurls - # URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments. + # URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments. Either unfurls or metadata must be provided. # @option options [string] :user_auth_message # Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior. Provides two buttons, Not now or Never ask me again. # @option options [boolean] :user_auth_required @@ -239,14 +305,13 @@ def chat_scheduleMessage(options = {}) # The ID of the link to unfurl. Both unfurl_id and source must be provided together, or channel and ts must be provided together. # @option options [enum] :source # The source of the link to unfurl. The source may either be composer, when the link is inside the message composer, or conversations_history, when the link has been posted to a conversation. + # @option options [string] :metadata + # JSON object with entity_type and entity_payload fields, presented as a URL-encoded string. Either unfurls or metadata must be provided. # @see https://api.slack.com/methods/chat.unfurl # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/chat/chat.unfurl.json def chat_unfurl(options = {}) - raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil? - raise ArgumentError, 'Required arguments :ts missing' if options[:ts].nil? - raise ArgumentError, 'Required arguments :unfurls missing' if options[:unfurls].nil? options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel] - options = encode_options_as_json(options, %i[unfurls user_auth_blocks]) + options = encode_options_as_json(options, %i[unfurls user_auth_blocks metadata]) post('chat.unfurl', options) end diff --git a/lib/slack/web/api/endpoints/entity.rb b/lib/slack/web/api/endpoints/entity.rb new file mode 100644 index 00000000..91dcc29e --- /dev/null +++ b/lib/slack/web/api/endpoints/entity.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +module Slack + module Web + module Api + module Endpoints + module Entity + # + # Provide custom flexpane behavior for Work Objects. Apps call this endpoint to send per-user flexpane metadata to the client. + # + # @option options [object] :metadata + # URL-encoded JSON object containing flexpane metadata from the app that will be conformed to a Work Object metadata schema, keyed by entity ID. + # @option options [string] :trigger_id + # A reference to the original user action that initiated the request. + # @option options [boolean] :user_auth_required + # Set to true (or 1) to indicate that the user must authenticate to view full flexpane data. + # @option options [string] :user_auth_url + # A custom URL to which users are directed for authentication if required. + # @option options [Object] :error + # @see https://api.slack.com/methods/entity.presentDetails + # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/entity/entity.presentDetails.json + def entity_presentDetails(options = {}) + raise ArgumentError, 'Required arguments :trigger_id missing' if options[:trigger_id].nil? + options = encode_options_as_json(options, %i[metadata]) + post('entity.presentDetails', options) + end + end + end + end + end +end diff --git a/lib/slack/web/api/endpoints/files.rb b/lib/slack/web/api/endpoints/files.rb index 0d735603..eeeecb73 100644 --- a/lib/slack/web/api/endpoints/files.rb +++ b/lib/slack/web/api/endpoints/files.rb @@ -16,7 +16,7 @@ module Files # @option options [string] :thread_ts # Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead. Also make sure to provide only one channel when using 'thread_ts'. # @option options [string] :channels - # Comma-separated string of channel IDs where the file will be shared. + # Comma-separated string of channel IDs or user IDs where the file will be shared. # @option options [string] :initial_comment # The message text introducing the file in specified channels. # @option options [string] :blocks diff --git a/lib/slack/web/api/endpoints/oauth_v2.rb b/lib/slack/web/api/endpoints/oauth_v2.rb index d33d8d77..bfb8ca45 100644 --- a/lib/slack/web/api/endpoints/oauth_v2.rb +++ b/lib/slack/web/api/endpoints/oauth_v2.rb @@ -15,6 +15,8 @@ module OauthV2 # Issued when you created your application. If possible, avoid sending client_id and client_secret as parameters in your request and instead supply the Client ID and Client Secret using the HTTP Basic authentication scheme. # @option options [string] :code # The code param returned via the OAuth callback. + # @option options [string] :code_verifier + # The code_verifier param used to generate the code_challenge originally. Used for PKCE. # @option options [string] :redirect_uri # This must match the originally submitted URI (if one was sent). # @option options [string] :grant_type diff --git a/lib/slack/web/api/errors.rb b/lib/slack/web/api/errors.rb index 4bd8df17..7b7ce336 100644 --- a/lib/slack/web/api/errors.rb +++ b/lib/slack/web/api/errors.rb @@ -7,6 +7,7 @@ module Api module Errors class AccessDenied < SlackError; end class AccessTokenExchangeFailed < SlackError; end + class Accesslimited < SlackError; end class AccountInactive < SlackError; end class ActionAlreadyInProgress < SlackError; end class AdminUnauthorized < SlackError; end @@ -31,6 +32,7 @@ class ApprovalInactive < SlackError; end class ApprovalNotFound < SlackError; end class ArchiveNotSupported < SlackError; end class AsUserNotSupported < SlackError; end + class AssistantSearchContextDisabled < SlackError; end class AtLeastOneSessionSettingRequired < SlackError; end class AttachmentPayloadLimitExceeded < SlackError; end class AuthMismatch < SlackError; end @@ -166,9 +168,14 @@ class DatastoreMigrationInProgress < SlackError; end class DefaultChannelRestricted < SlackError; end class DefaultOrgWideChannel < SlackError; end class DeleteNotAllowed < SlackError; end + class DeprecatedEndpoint < SlackError; end class DescriptionTooLong < SlackError; end class DiscoverabilitySettingInvalid < SlackError; end class DomainTaken < SlackError; end + class DraftAlreadyDeleted < SlackError; end + class DraftAlreadySent < SlackError; end + class DraftHasConflict < SlackError; end + class DraftNotFound < SlackError; end class DuplicateChannelNotFound < SlackError; end class DuplicateExternalId < SlackError; end class DuplicateMessageNotFound < SlackError; end @@ -183,6 +190,7 @@ class EmojiNotFound < SlackError; end class EndpointUnavailable < SlackError; end class EnterpriseIsRestricted < SlackError; end class EnterpriseNotFound < SlackError; end + class EntityMetadataDoesNotMatchTrigger < SlackError; end class EntityNotFound < SlackError; end class ErrorAddingCollaborators < SlackError; end class ErrorBadFormat < SlackError; end @@ -198,6 +206,7 @@ class ErrorModifyingWorkflows < SlackError; end class ErrorNameTaken < SlackError; end class ErrorNameTakenI18n < SlackError; end class ErrorNoImage < SlackError; end + class ErrorProcessingMetadata < SlackError; end class ErrorRemovingCollaborators < SlackError; end class ErrorTooBig < SlackError; end class ErrorUnpublishingWorkflows < SlackError; end @@ -288,8 +297,10 @@ class InvalidActor < SlackError; end class InvalidApp < SlackError; end class InvalidAppActionType < SlackError; end class InvalidAppId < SlackError; end + class InvalidArgName < SlackError; end class InvalidArgs < SlackError; end class InvalidArguments < SlackError; end + class InvalidArrayArg < SlackError; end class InvalidAttachment < SlackError; end class InvalidAttachments < SlackError; end class InvalidAuth < SlackError; end @@ -302,9 +313,11 @@ class InvalidChannelId < SlackError; end class InvalidChannelProvided < SlackError; end class InvalidChannelType < SlackError; end class InvalidChannelsLimit < SlackError; end + class InvalidCharset < SlackError; end class InvalidChildType < SlackError; end class InvalidClientId < SlackError; end class InvalidCode < SlackError; end + class InvalidCodeVerifier < SlackError; end class InvalidColumnId < SlackError; end class InvalidColumnType < SlackError; end class InvalidCopyAndSchemaArgs < SlackError; end @@ -322,6 +335,7 @@ class InvalidEntityId < SlackError; end class InvalidEventContext < SlackError; end class InvalidExternalId < SlackError; end class InvalidFieldOrData < SlackError; end + class InvalidFormData < SlackError; end class InvalidGrantType < SlackError; end class InvalidGroupProvided < SlackError; end class InvalidHostTeam < SlackError; end @@ -330,6 +344,7 @@ class InvalidLimit < SlackError; end class InvalidLink < SlackError; end class InvalidManifest < SlackError; end class InvalidMessage < SlackError; end + class InvalidMetadata < SlackError; end class InvalidMetadataFilterKeys < SlackError; end class InvalidMetadataFormat < SlackError; end class InvalidMetadataSchema < SlackError; end @@ -347,6 +362,7 @@ class InvalidParentType < SlackError; end class InvalidPermissionType < SlackError; end class InvalidPermissions < SlackError; end class InvalidPhoneNumber < SlackError; end + class InvalidPostType < SlackError; end class InvalidPresence < SlackError; end class InvalidPrimaryColumn < SlackError; end class InvalidPrivacy < SlackError; end @@ -410,6 +426,7 @@ class InvitedUserNotReactivated < SlackError; end class InviteeCantSeeChannel < SlackError; end class InvitorCannotSeeChannel < SlackError; end class IsArchived < SlackError; end + class IsBot < SlackError; end class IsIdpManaged < SlackError; end class IsInactive < SlackError; end class IsPendingConnectedToOrg < SlackError; end @@ -433,8 +450,10 @@ class MemberAnalyticsDisabled < SlackError; end class MemberLimitExceeded < SlackError; end class MessageLimitExceeded < SlackError; end class MessageNotFound < SlackError; end + class MessageNotInStreamingState < SlackError; end class MessageTooLong < SlackError; end class MessagesTabDisabled < SlackError; end + class MessagingProcessingFailed < SlackError; end class MetadataMustBeSentFromApp < SlackError; end class MetadataNotAvailable < SlackError; end class MetadataOnlyDoesNotSupportDate < SlackError; end @@ -451,8 +470,13 @@ class MissingChannel < SlackError; end class MissingDialog < SlackError; end class MissingDuration < SlackError; end class MissingFileData < SlackError; end + class MissingInteractivityUrl < SlackError; end + class MissingOptionsLoadUrl < SlackError; end + class MissingPostType < SlackError; end class MissingProfileId < SlackError; end class MissingQuery < SlackError; end + class MissingRecipientTeamId < SlackError; end + class MissingRecipientUserId < SlackError; end class MissingRecordChannelConfig < SlackError; end class MissingResource < SlackError; end class MissingScope < SlackError; end @@ -491,6 +515,7 @@ class NoImageUploaded < SlackError; end class NoItemSpecified < SlackError; end class NoLocalUserOnTeam < SlackError; end class NoPermission < SlackError; end + class NoPerms < SlackError; end class NoPin < SlackError; end class NoReaction < SlackError; end class NoRefreshToken < SlackError; end @@ -540,6 +565,7 @@ class NotVisible < SlackError; end class OauthAuthorizationUrlMismatch < SlackError; end class OneOrMoreInvalidChannels < SlackError; end class OrgLevelEmailDisplayDisabled < SlackError; end + class OrgLoginRequired < SlackError; end class OrgNotConnected < SlackError; end class OrgNotFound < SlackError; end class OrgResolutionRequired < SlackError; end @@ -560,6 +586,7 @@ class PartialFailure < SlackError; end class PartialProfileSetFailed < SlackError; end class PermissionDenied < SlackError; end class PermissionTypeRequired < SlackError; end + class PkceNotAllowed < SlackError; end class PlanUpgradeRequired < SlackError; end class PolicyNotFound < SlackError; end class PostContentsTooLarge < SlackError; end @@ -584,6 +611,7 @@ class RecordNotFound < SlackError; end class RequestAlreadyResolved < SlackError; end class RequestIdOrAppIdIsRequired < SlackError; end class RequestIdRequiredForCustomIntegrations < SlackError; end + class RequestTimeout < SlackError; end class ReservedName < SlackError; end class ResizedButStillTooLarge < SlackError; end class RestrictedAction < SlackError; end @@ -598,6 +626,7 @@ class RowIdNotProvided < SlackError; end class RowNotFound < SlackError; end class RtmConnectRequired < SlackError; end class SentRecently < SlackError; end + class ServiceUnavailable < SlackError; end class SessionInvalidationFailed < SlackError; end class SessionNotFound < SlackError; end class SessionResetNotAllowed < SlackError; end @@ -619,6 +648,7 @@ class SudoRequired < SlackError; end class TargetTeamMustBeSpecifiedInOrgContext < SlackError; end class TargetTeamNotFound < SlackError; end class TargetTeamNotOnOrg < SlackError; end + class TeamAddedToOrg < SlackError; end class TeamIdOrOrgRequired < SlackError; end class TeamIdRequiredForEnterprise < SlackError; end class TeamNotConnected < SlackError; end @@ -633,6 +663,7 @@ class ThreadNotFound < SlackError; end class TimeInPast < SlackError; end class TimeTooFar < SlackError; end class TokenAlreadyExchanged < SlackError; end + class TokenExpired < SlackError; end class TokenNotFound < SlackError; end class TokenRevoked < SlackError; end class TokenRotationNotEnabled < SlackError; end @@ -662,6 +693,7 @@ class TriggerExchanged < SlackError; end class TriggerExpired < SlackError; end class TriggerNotFound < SlackError; end class TriggerTypeIdNotFound < SlackError; end + class TwoFactorSetupRequired < SlackError; end class UnableToDelete < SlackError; end class UnableToFetchCustomEmojis < SlackError; end class UnableToLinkIdpGroupAndChannel < SlackError; end @@ -689,6 +721,7 @@ class UrlInMessage < SlackError; end class UrlRestrictionNotSupported < SlackError; end class UserAlreadyDeleted < SlackError; end class UserAlreadyTeamMember < SlackError; end + class UserAuthUrlMissing < SlackError; end class UserCannotCreateChannel < SlackError; end class UserCannotManagePublicChannels < SlackError; end class UserCannotManageWorkspace < SlackError; end @@ -699,6 +732,7 @@ class UserIsAlreadyDeleted < SlackError; end class UserIsBot < SlackError; end class UserIsDeactivated < SlackError; end class UserIsNotAGuest < SlackError; end + class UserIsNotGuest < SlackError; end class UserIsRestricted < SlackError; end class UserMustBeAdmin < SlackError; end class UserMustBeInWorkspace < SlackError; end @@ -721,6 +755,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end ERROR_CLASSES = { 'access_denied' => AccessDenied, 'access_token_exchange_failed' => AccessTokenExchangeFailed, + 'accesslimited' => Accesslimited, 'account_inactive' => AccountInactive, 'action_already_in_progress' => ActionAlreadyInProgress, 'admin_unauthorized' => AdminUnauthorized, @@ -745,6 +780,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'approval_not_found' => ApprovalNotFound, 'archive_not_supported' => ArchiveNotSupported, 'as_user_not_supported' => AsUserNotSupported, + 'assistant_search_context_disabled' => AssistantSearchContextDisabled, 'at_least_one_session_setting_required' => AtLeastOneSessionSettingRequired, 'attachment_payload_limit_exceeded' => AttachmentPayloadLimitExceeded, 'auth_mismatch' => AuthMismatch, @@ -880,9 +916,14 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'default_channel_restricted' => DefaultChannelRestricted, 'default_org_wide_channel' => DefaultOrgWideChannel, 'delete_not_allowed' => DeleteNotAllowed, + 'deprecated_endpoint' => DeprecatedEndpoint, 'description_too_long' => DescriptionTooLong, 'discoverability_setting_invalid' => DiscoverabilitySettingInvalid, 'domain_taken' => DomainTaken, + 'draft_already_deleted' => DraftAlreadyDeleted, + 'draft_already_sent' => DraftAlreadySent, + 'draft_has_conflict' => DraftHasConflict, + 'draft_not_found' => DraftNotFound, 'duplicate_channel_not_found' => DuplicateChannelNotFound, 'duplicate_external_id' => DuplicateExternalId, 'duplicate_message_not_found' => DuplicateMessageNotFound, @@ -897,6 +938,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'endpoint_unavailable' => EndpointUnavailable, 'enterprise_is_restricted' => EnterpriseIsRestricted, 'enterprise_not_found' => EnterpriseNotFound, + 'entity_metadata_does_not_match_trigger' => EntityMetadataDoesNotMatchTrigger, 'entity_not_found' => EntityNotFound, 'error_adding_collaborators' => ErrorAddingCollaborators, 'error_bad_format' => ErrorBadFormat, @@ -912,6 +954,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'error_name_taken' => ErrorNameTaken, 'error_name_taken_i18n' => ErrorNameTakenI18n, 'error_no_image' => ErrorNoImage, + 'error_processing_metadata' => ErrorProcessingMetadata, 'error_removing_collaborators' => ErrorRemovingCollaborators, 'error_too_big' => ErrorTooBig, 'error_unpublishing_workflows' => ErrorUnpublishingWorkflows, @@ -1002,8 +1045,10 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invalid_app' => InvalidApp, 'invalid_app_action_type' => InvalidAppActionType, 'invalid_app_id' => InvalidAppId, + 'invalid_arg_name' => InvalidArgName, 'invalid_args' => InvalidArgs, 'invalid_arguments' => InvalidArguments, + 'invalid_array_arg' => InvalidArrayArg, 'invalid_attachment' => InvalidAttachment, 'invalid_attachments' => InvalidAttachments, 'invalid_auth' => InvalidAuth, @@ -1016,9 +1061,11 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invalid_channel_provided' => InvalidChannelProvided, 'invalid_channel_type' => InvalidChannelType, 'invalid_channels_limit' => InvalidChannelsLimit, + 'invalid_charset' => InvalidCharset, 'invalid_child_type' => InvalidChildType, 'invalid_client_id' => InvalidClientId, 'invalid_code' => InvalidCode, + 'invalid_code_verifier' => InvalidCodeVerifier, 'invalid_column_id' => InvalidColumnId, 'invalid_column_type' => InvalidColumnType, 'invalid_copy_and_schema_args' => InvalidCopyAndSchemaArgs, @@ -1036,6 +1083,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invalid_event_context' => InvalidEventContext, 'invalid_external_id' => InvalidExternalId, 'invalid_field_or_data' => InvalidFieldOrData, + 'invalid_form_data' => InvalidFormData, 'invalid_grant_type' => InvalidGrantType, 'invalid_group_provided' => InvalidGroupProvided, 'invalid_host_team' => InvalidHostTeam, @@ -1044,6 +1092,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invalid_link' => InvalidLink, 'invalid_manifest' => InvalidManifest, 'invalid_message' => InvalidMessage, + 'invalid_metadata' => InvalidMetadata, 'invalid_metadata_filter_keys' => InvalidMetadataFilterKeys, 'invalid_metadata_format' => InvalidMetadataFormat, 'invalid_metadata_schema' => InvalidMetadataSchema, @@ -1061,6 +1110,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invalid_permission_type' => InvalidPermissionType, 'invalid_permissions' => InvalidPermissions, 'invalid_phone_number' => InvalidPhoneNumber, + 'invalid_post_type' => InvalidPostType, 'invalid_presence' => InvalidPresence, 'invalid_primary_column' => InvalidPrimaryColumn, 'invalid_privacy' => InvalidPrivacy, @@ -1124,6 +1174,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'invitee_cant_see_channel' => InviteeCantSeeChannel, 'invitor_cannot_see_channel' => InvitorCannotSeeChannel, 'is_archived' => IsArchived, + 'is_bot' => IsBot, 'is_idp_managed' => IsIdpManaged, 'is_inactive' => IsInactive, 'is_pending_connected_to_org' => IsPendingConnectedToOrg, @@ -1147,8 +1198,10 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'member_limit_exceeded' => MemberLimitExceeded, 'message_limit_exceeded' => MessageLimitExceeded, 'message_not_found' => MessageNotFound, + 'message_not_in_streaming_state' => MessageNotInStreamingState, 'message_too_long' => MessageTooLong, 'messages_tab_disabled' => MessagesTabDisabled, + 'messaging_processing_failed' => MessagingProcessingFailed, 'metadata_must_be_sent_from_app' => MetadataMustBeSentFromApp, 'metadata_not_available' => MetadataNotAvailable, 'metadata_only_does_not_support_date' => MetadataOnlyDoesNotSupportDate, @@ -1165,8 +1218,13 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'missing_dialog' => MissingDialog, 'missing_duration' => MissingDuration, 'missing_file_data' => MissingFileData, + 'missing_interactivity_url' => MissingInteractivityUrl, + 'missing_options_load_url' => MissingOptionsLoadUrl, + 'missing_post_type' => MissingPostType, 'missing_profile_id' => MissingProfileId, 'missing_query' => MissingQuery, + 'missing_recipient_team_id' => MissingRecipientTeamId, + 'missing_recipient_user_id' => MissingRecipientUserId, 'missing_record_channel_config' => MissingRecordChannelConfig, 'missing_resource' => MissingResource, 'missing_scope' => MissingScope, @@ -1205,6 +1263,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'no_item_specified' => NoItemSpecified, 'no_local_user_on_team' => NoLocalUserOnTeam, 'no_permission' => NoPermission, + 'no_perms' => NoPerms, 'no_pin' => NoPin, 'no_reaction' => NoReaction, 'no_refresh_token' => NoRefreshToken, @@ -1254,6 +1313,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'oauth_authorization_url_mismatch' => OauthAuthorizationUrlMismatch, 'one_or_more_invalid_channels' => OneOrMoreInvalidChannels, 'org_level_email_display_disabled' => OrgLevelEmailDisplayDisabled, + 'org_login_required' => OrgLoginRequired, 'org_not_connected' => OrgNotConnected, 'org_not_found' => OrgNotFound, 'org_resolution_required' => OrgResolutionRequired, @@ -1274,6 +1334,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'partial_profile_set_failed' => PartialProfileSetFailed, 'permission_denied' => PermissionDenied, 'permission_type_required' => PermissionTypeRequired, + 'pkce_not_allowed' => PkceNotAllowed, 'plan_upgrade_required' => PlanUpgradeRequired, 'policy_not_found' => PolicyNotFound, 'post_contents_too_large' => PostContentsTooLarge, @@ -1298,6 +1359,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'request_already_resolved' => RequestAlreadyResolved, 'request_id_or_app_id_is_required' => RequestIdOrAppIdIsRequired, 'request_id_required_for_custom_integrations' => RequestIdRequiredForCustomIntegrations, + 'request_timeout' => RequestTimeout, 'reserved_name' => ReservedName, 'resized_but_still_too_large' => ResizedButStillTooLarge, 'restricted_action' => RestrictedAction, @@ -1312,6 +1374,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'row_not_found' => RowNotFound, 'rtm_connect_required' => RtmConnectRequired, 'sent_recently' => SentRecently, + 'service_unavailable' => ServiceUnavailable, 'session_invalidation_failed' => SessionInvalidationFailed, 'session_not_found' => SessionNotFound, 'session_reset_not_allowed' => SessionResetNotAllowed, @@ -1333,6 +1396,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'target_team_must_be_specified_in_org_context' => TargetTeamMustBeSpecifiedInOrgContext, 'target_team_not_found' => TargetTeamNotFound, 'target_team_not_on_org' => TargetTeamNotOnOrg, + 'team_added_to_org' => TeamAddedToOrg, 'team_id_or_org_required' => TeamIdOrOrgRequired, 'team_id_required_for_enterprise' => TeamIdRequiredForEnterprise, 'team_not_connected' => TeamNotConnected, @@ -1347,6 +1411,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'time_in_past' => TimeInPast, 'time_too_far' => TimeTooFar, 'token_already_exchanged' => TokenAlreadyExchanged, + 'token_expired' => TokenExpired, 'token_not_found' => TokenNotFound, 'token_revoked' => TokenRevoked, 'token_rotation_not_enabled' => TokenRotationNotEnabled, @@ -1376,6 +1441,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'trigger_expired' => TriggerExpired, 'trigger_not_found' => TriggerNotFound, 'trigger_type_id_not_found' => TriggerTypeIdNotFound, + 'two_factor_setup_required' => TwoFactorSetupRequired, 'unable_to_delete' => UnableToDelete, 'unable_to_fetch_custom_emojis' => UnableToFetchCustomEmojis, 'unable_to_link_idp_group_and_channel' => UnableToLinkIdpGroupAndChannel, @@ -1403,6 +1469,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'url_restriction_not_supported' => UrlRestrictionNotSupported, 'user_already_deleted' => UserAlreadyDeleted, 'user_already_team_member' => UserAlreadyTeamMember, + 'user_auth_url_missing' => UserAuthUrlMissing, 'user_cannot_create_channel' => UserCannotCreateChannel, 'user_cannot_manage_public_channels' => UserCannotManagePublicChannels, 'user_cannot_manage_workspace' => UserCannotManageWorkspace, @@ -1413,6 +1480,7 @@ class WorkflowsExportCsvNotEnabled < SlackError; end 'user_is_bot' => UserIsBot, 'user_is_deactivated' => UserIsDeactivated, 'user_is_not_a_guest' => UserIsNotAGuest, + 'user_is_not_guest' => UserIsNotGuest, 'user_is_restricted' => UserIsRestricted, 'user_must_be_admin' => UserMustBeAdmin, 'user_must_be_in_workspace' => UserMustBeInWorkspace, diff --git a/lib/slack/web/api/slack-api-ref b/lib/slack/web/api/slack-api-ref index bd5dd34c..32757867 160000 --- a/lib/slack/web/api/slack-api-ref +++ b/lib/slack/web/api/slack-api-ref @@ -1 +1 @@ -Subproject commit bd5dd34cc34916223f8616b6e709de691d5ea4cb +Subproject commit 32757867a5d54838b71403fbf45bc4c081abdf23 diff --git a/spec/slack/web/api/endpoints/chat_spec.rb b/spec/slack/web/api/endpoints/chat_spec.rb index e1ee9160..81b4c7d7 100644 --- a/spec/slack/web/api/endpoints/chat_spec.rb +++ b/spec/slack/web/api/endpoints/chat_spec.rb @@ -5,6 +5,17 @@ RSpec.describe Slack::Web::Api::Endpoints::Chat do let(:client) { Slack::Web::Client.new } + context 'chat_appendStream' do + it 'requires channel' do + expect { client.chat_appendStream(ts: %q[], markdown_text: %q[**This is bold text**]) }.to raise_error ArgumentError, /Required arguments :channel missing/ + end + it 'requires ts' do + expect { client.chat_appendStream(channel: %q[], markdown_text: %q[**This is bold text**]) }.to raise_error ArgumentError, /Required arguments :ts missing/ + end + it 'requires markdown_text' do + expect { client.chat_appendStream(channel: %q[], ts: %q[]) }.to raise_error ArgumentError, /Required arguments :markdown_text missing/ + end + end context 'chat_command' do it 'requires channel' do expect { client.chat_command(command: %q[/who]) }.to raise_error ArgumentError, /Required arguments :channel missing/ @@ -150,19 +161,30 @@ client.chat_scheduleMessage(attachments: {:data=>["data"]}, channel: %q[], post_at: %q[299876400], blocks: {:data=>["data"]}, metadata: {:data=>["data"]}) end end - context 'chat_unfurl' do + context 'chat_startStream' do it 'requires channel' do - expect { client.chat_unfurl(ts: %q[], unfurls: %q[]) }.to raise_error ArgumentError, /Required arguments :channel missing/ + expect { client.chat_startStream(thread_ts: %q[1721609600]) }.to raise_error ArgumentError, /Required arguments :channel missing/ + end + it 'requires thread_ts' do + expect { client.chat_startStream(channel: %q[]) }.to raise_error ArgumentError, /Required arguments :thread_ts missing/ + end + end + context 'chat_stopStream' do + it 'requires channel' do + expect { client.chat_stopStream(ts: %q[]) }.to raise_error ArgumentError, /Required arguments :channel missing/ end it 'requires ts' do - expect { client.chat_unfurl(channel: %q[], unfurls: %q[]) }.to raise_error ArgumentError, /Required arguments :ts missing/ + expect { client.chat_stopStream(channel: %q[]) }.to raise_error ArgumentError, /Required arguments :ts missing/ end - it 'requires unfurls' do - expect { client.chat_unfurl(channel: %q[], ts: %q[]) }.to raise_error ArgumentError, /Required arguments :unfurls missing/ + it 'encodes metadata as json' do + expect(client).to receive(:post).with('chat.stopStream', {channel: %q[], ts: %q[], metadata: %q[{"data":["data"]}]}) + client.chat_stopStream(channel: %q[], ts: %q[], metadata: {:data=>["data"]}) end - it 'encodes unfurls, user_auth_blocks as json' do - expect(client).to receive(:post).with('chat.unfurl', {channel: %q[], ts: %q[], unfurls: %q[{"data":["data"]}], user_auth_blocks: %q[{"data":["data"]}]}) - client.chat_unfurl(channel: %q[], ts: %q[], unfurls: {:data=>["data"]}, user_auth_blocks: {:data=>["data"]}) + end + context 'chat_unfurl' do + it 'encodes unfurls, user_auth_blocks, metadata as json' do + expect(client).to receive(:post).with('chat.unfurl', {unfurls: %q[{"data":["data"]}], user_auth_blocks: %q[{"data":["data"]}], metadata: %q[{"data":["data"]}]}) + client.chat_unfurl(unfurls: {:data=>["data"]}, user_auth_blocks: {:data=>["data"]}, metadata: {:data=>["data"]}) end end context 'chat_update' do diff --git a/spec/slack/web/api/endpoints/entity_spec.rb b/spec/slack/web/api/endpoints/entity_spec.rb new file mode 100644 index 00000000..4fa5bcca --- /dev/null +++ b/spec/slack/web/api/endpoints/entity_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true +# This file was auto-generated by lib/tasks/web.rake + +require 'spec_helper' + +RSpec.describe Slack::Web::Api::Endpoints::Entity do + let(:client) { Slack::Web::Client.new } + context 'entity_presentDetails' do + it 'requires trigger_id' do + expect { client.entity_presentDetails }.to raise_error ArgumentError, /Required arguments :trigger_id missing/ + end + it 'encodes metadata as json' do + expect(client).to receive(:post).with('entity.presentDetails', {trigger_id: %q[], metadata: %q[{"data":["data"]}]}) + client.entity_presentDetails(trigger_id: %q[], metadata: {:data=>["data"]}) + end + end +end diff --git a/spec/slack/web/api/endpoints/slackLists_items_spec.rb b/spec/slack/web/api/endpoints/slackLists_items_spec.rb index b4771e4b..ac81052a 100644 --- a/spec/slack/web/api/endpoints/slackLists_items_spec.rb +++ b/spec/slack/web/api/endpoints/slackLists_items_spec.rb @@ -44,7 +44,7 @@ expect { client.slackLists_items_update(cells: %q[[{"row_id":"Rec014K005UQJ","column_id":"Col014K005UQJ","user":["U01284PCR98", "U0137181B5H"]}]]) }.to raise_error ArgumentError, /Required arguments :list_id missing/ end it 'requires cells' do - expect { client.slackLists_items_update(list_id: %q[F03PSRPN4CE]) }.to raise_error ArgumentError, /Required arguments :cells missing/ + expect { client.slackLists_items_update(list_id: %q[F01ABCDE2FG]) }.to raise_error ArgumentError, /Required arguments :cells missing/ end end end