slack-ruby-client 2.5.2 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +2 -0
  3. data/.github/workflows/update_api.yml +1 -1
  4. data/.rubocop_todo.yml +22 -13
  5. data/CHANGELOG.md +15 -0
  6. data/CONTRIBUTING.md +1 -1
  7. data/Gemfile +3 -0
  8. data/README.md +44 -17
  9. data/bin/commands/admin_conversations.rb +12 -1
  10. data/bin/commands/admin_users.rb +1 -1
  11. data/bin/commands/assistant_search.rb +27 -0
  12. data/bin/commands/canvases.rb +1 -0
  13. data/bin/commands/chat.rb +1 -0
  14. data/bin/commands/conversations_canvases.rb +1 -0
  15. data/bin/commands/files.rb +1 -0
  16. data/bin/commands/functions_distributions_permissions.rb +6 -4
  17. data/bin/commands/usergroups.rb +0 -1
  18. data/examples/files_upload_v2/files_upload_v2.rb +8 -0
  19. data/lib/slack/events/request.rb +3 -1
  20. data/lib/slack/messages/formatting.rb +8 -0
  21. data/lib/slack/utils/security.rb +44 -0
  22. data/lib/slack/version.rb +1 -1
  23. data/lib/slack/web/api/endpoints/admin_conversations.rb +18 -1
  24. data/lib/slack/web/api/endpoints/admin_users.rb +1 -1
  25. data/lib/slack/web/api/endpoints/assistant_search.rb +44 -0
  26. data/lib/slack/web/api/endpoints/canvases.rb +2 -0
  27. data/lib/slack/web/api/endpoints/chat.rb +2 -0
  28. data/lib/slack/web/api/endpoints/conversations.rb +0 -1
  29. data/lib/slack/web/api/endpoints/conversations_canvases.rb +2 -0
  30. data/lib/slack/web/api/endpoints/files.rb +3 -0
  31. data/lib/slack/web/api/endpoints/functions_distributions_permissions.rb +6 -2
  32. data/lib/slack/web/api/endpoints/usergroups.rb +0 -2
  33. data/lib/slack/web/api/endpoints.rb +2 -0
  34. data/lib/slack/web/api/errors.rb +34 -2
  35. data/lib/slack/web/api/helpers/files.rb +32 -22
  36. data/lib/slack/web/api/mixins/conversations.id.rb +23 -1
  37. data/lib/slack/web/api/mixins/ids.id.rb +3 -3
  38. data/lib/slack/web/api/mixins/users.id.rb +16 -1
  39. data/lib/slack/web/config.rb +4 -0
  40. data/lib/slack-ruby-client.rb +3 -1
  41. data/slack-ruby-client.gemspec +1 -1
  42. metadata +7 -4
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+ # This file was auto-generated by lib/tasks/web.rake
3
+
4
+ module Slack
5
+ module Web
6
+ module Api
7
+ module Endpoints
8
+ module AssistantSearch
9
+ #
10
+ # Searches messages across your Slack organization—perfect for broad, specific, and real-time data retrieval.
11
+ #
12
+ # @option options [string] :query
13
+ # User prompt or search query.
14
+ # @option options [string] :action_token
15
+ # Send action_token as received in a message event.
16
+ # @option options [array] :channel_types
17
+ # Mix and match channel types by providing a comma-separated list of any combination of public_channel, private_channel, mpim, im.
18
+ # @option options [array] :content_types
19
+ # Content types to include, a comma-separated list of any combination of messages, files.
20
+ # @option options [Object] :context_channel_id
21
+ # Context channel ID to support scoping the search when applicable.
22
+ # @option options [string] :cursor
23
+ # The cursor returned by the API. Leave this blank for the first request, and use this to get the next page of results.
24
+ # @option options [boolean] :include_bots
25
+ # If you want the results to include bots.
26
+ # @option options [integer] :limit
27
+ # Number of results to return, up to a max of 20. Defaults to 20.
28
+ # @see https://api.slack.com/methods/assistant.search.context
29
+ # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/assistant.search/assistant.search.context.json
30
+ def assistant_search_context(options = {})
31
+ raise ArgumentError, 'Required arguments :query missing' if options[:query].nil?
32
+ if block_given?
33
+ Pagination::Cursor.new(self, :assistant_search_context, options).each do |page|
34
+ yield page
35
+ end
36
+ else
37
+ post('assistant.search.context', options)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -9,6 +9,8 @@ module Slack
9
9
  #
10
10
  # Create canvas for a user
11
11
  #
12
+ # @option options [string] :channel_id
13
+ # Channel ID of the channel the canvas will be tabbed in. This is a required field for free teams.
12
14
  # @option options [Object] :document_content
13
15
  # Structure describing the type and value of the content to create.
14
16
  # @option options [string] :title
@@ -142,6 +142,8 @@ module Slack
142
142
  # A JSON-based array of structured blocks, presented as a URL-encoded string.
143
143
  # @option options [string] :text
144
144
  # How this field works and whether it is required depends on other fields you use in your API call. See below for more detail.
145
+ # @option options [Object] :agent_message_source_type
146
+ # Identify how the message was posted for agentforce BE logging.
145
147
  # @option options [boolean] :as_user
146
148
  # (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.
147
149
  # @option options [string] :icon_emoji
@@ -207,7 +207,6 @@ module Slack
207
207
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations/conversations.kick.json
208
208
  def conversations_kick(options = {})
209
209
  raise ArgumentError, 'Required arguments :channel missing' if options[:channel].nil?
210
- raise ArgumentError, 'Required arguments :user missing' if options[:user].nil?
211
210
  options = options.merge(channel: conversations_id(options)['channel']['id']) if options[:channel]
212
211
  options = options.merge(user: users_id(options)['user']['id']) if options[:user]
213
212
  post('conversations.kick', options)
@@ -13,6 +13,8 @@ module Slack
13
13
  # Channel ID of the channel we create the channel canvas for.
14
14
  # @option options [Object] :document_content
15
15
  # Structure describing the type and value of the content to create.
16
+ # @option options [string] :title
17
+ # Title of the newly created canvas.
16
18
  # @see https://api.slack.com/methods/conversations.canvases.create
17
19
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/conversations.canvases/conversations.canvases.create.json
18
20
  def conversations_canvases_create(options = {})
@@ -11,6 +11,8 @@ module Slack
11
11
  #
12
12
  # @option options [array] :files
13
13
  # Array of file ids and their corresponding (optional) titles.
14
+ # @option options [blocks[] as string] :blocks
15
+ # 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.
14
16
  # @option options [Object] :channel_id
15
17
  # Channel ID where the file will be shared. If not specified the file will be private.
16
18
  # @option options [string] :channels
@@ -23,6 +25,7 @@ module Slack
23
25
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/files/files.completeUploadExternal.json
24
26
  def files_completeUploadExternal(options = {})
25
27
  raise ArgumentError, 'Required arguments :files missing' if options[:files].nil?
28
+ options = encode_options_as_json(options, %i[blocks])
26
29
  post('files.completeUploadExternal', options)
27
30
  end
28
31
 
@@ -24,7 +24,7 @@ module Slack
24
24
  end
25
25
 
26
26
  #
27
- # List the access type of a custom slack function and include the users with access if its permission_type is set to named_entities
27
+ # List the access type of a custom slack function and include the users or team or org ids with access if its permission_type is set to named_entities
28
28
  #
29
29
  # @option options [string] :function_app_id
30
30
  # The encoded ID of the app.
@@ -56,7 +56,7 @@ module Slack
56
56
  end
57
57
 
58
58
  #
59
- # Set the access type of a custom slack function and define the users to be granted access if permission_type is set to named_entities
59
+ # Set the access type of a custom slack function and define the users or team or org ids to be granted access if permission_type is set to named_entities
60
60
  #
61
61
  # @option options [enum] :permission_type
62
62
  # The type of permission that defines how the function can be distributed.
@@ -66,6 +66,10 @@ module Slack
66
66
  # The callback ID defined in the function's definition file.
67
67
  # @option options [string] :function_id
68
68
  # The encoded ID of the function.
69
+ # @option options [array] :org_ids
70
+ # List of org IDs to allow for named_entities permission.
71
+ # @option options [array] :team_ids
72
+ # List of team IDs to allow for named_entities permission.
69
73
  # @option options [array] :user_ids
70
74
  # List of encoded user IDs.
71
75
  # @see https://api.slack.com/methods/functions.distributions.permissions.set
@@ -75,8 +75,6 @@ module Slack
75
75
  # Include the list of users for each User Group.
76
76
  # @option options [string] :team_id
77
77
  # encoded team id to list user groups in, required if org token is used.
78
- # @option options [Object] :usergroup_id
79
- # The id of the usergroup you would like to filter the results down to.
80
78
  # @see https://api.slack.com/methods/usergroups.list
81
79
  # @see https://github.com/slack-ruby/slack-api-ref/blob/master/methods/usergroups/usergroups.list.json
82
80
  def usergroups_list(options = {})
@@ -41,6 +41,7 @@ require_relative 'endpoints/apps_connections'
41
41
  require_relative 'endpoints/apps_datastore'
42
42
  require_relative 'endpoints/apps_event_authorizations'
43
43
  require_relative 'endpoints/apps_manifest'
44
+ require_relative 'endpoints/assistant_search'
44
45
  require_relative 'endpoints/assistant_threads'
45
46
  require_relative 'endpoints/auth'
46
47
  require_relative 'endpoints/auth_teams'
@@ -141,6 +142,7 @@ module Slack
141
142
  include AppsDatastore
142
143
  include AppsEventAuthorizations
143
144
  include AppsManifest
145
+ include AssistantSearch
144
146
  include AssistantThreads
145
147
  include Auth
146
148
  include AuthTeams
@@ -112,6 +112,7 @@ module Slack
112
112
  class CanvasGloballyDisabled < SlackError; end
113
113
  class CanvasNotFound < SlackError; end
114
114
  class CanvasTabCreationFailed < SlackError; end
115
+ class ChannelAlreadyExists < SlackError; end
115
116
  class ChannelArchived < SlackError; end
116
117
  class ChannelCannotBeUnshared < SlackError; end
117
118
  class ChannelCanvasAlreadyExists < SlackError; end
@@ -137,6 +138,7 @@ module Slack
137
138
  class ConnectedUserDenied < SlackError; end
138
139
  class ConnectionLimitExceeded < SlackError; end
139
140
  class ConnectionLimitExceededPending < SlackError; end
141
+ class ContextChannelNotFound < SlackError; end
140
142
  class CouldNotArchiveChannel < SlackError; end
141
143
  class CouldNotConvertChannel < SlackError; end
142
144
  class CouldNotCreateChannel < SlackError; end
@@ -242,6 +244,7 @@ module Slack
242
244
  class FeatureNotAvailable < SlackError; end
243
245
  class FeatureNotEnabled < SlackError; end
244
246
  class FetchMembersFailed < SlackError; end
247
+ class FileAlreadyAdded < SlackError; end
245
248
  class FileCommentNotFound < SlackError; end
246
249
  class FileDeleted < SlackError; end
247
250
  class FileDeletingDisabled < SlackError; end
@@ -256,7 +259,7 @@ module Slack
256
259
  class ForbiddenTeam < SlackError; end
257
260
  class FreeTeamCanvasTabAlreadyExists < SlackError; end
258
261
  class FreeTeamNotAllowed < SlackError; end
259
- class FreeTeamsCannotCreateStandaloneCanvases < SlackError; end
262
+ class FreeTeamsCannotCreateNonTabbedCanvases < SlackError; end
260
263
  class FreeTeamsCannotEditStandaloneCanvases < SlackError; end
261
264
  class FunctionExecutionNotFound < SlackError; end
262
265
  class FunctionNotFound < SlackError; end
@@ -272,6 +275,7 @@ module Slack
272
275
  class InsecureRequest < SlackError; end
273
276
  class InternalError < SlackError; end
274
277
  class InvalidAction < SlackError; end
278
+ class InvalidActionToken < SlackError; end
275
279
  class InvalidActor < SlackError; end
276
280
  class InvalidApp < SlackError; end
277
281
  class InvalidAppActionType < SlackError; end
@@ -326,6 +330,8 @@ module Slack
326
330
  class InvalidNameRequired < SlackError; end
327
331
  class InvalidNameSpecials < SlackError; end
328
332
  class InvalidNamedEntities < SlackError; end
333
+ class InvalidOooMessage < SlackError; end
334
+ class InvalidOrgId < SlackError; end
329
335
  class InvalidOutputs < SlackError; end
330
336
  class InvalidParameters < SlackError; end
331
337
  class InvalidParentType < SlackError; end
@@ -352,6 +358,7 @@ module Slack
352
358
  class InvalidSortDir < SlackError; end
353
359
  class InvalidSource < SlackError; end
354
360
  class InvalidStartTime < SlackError; end
361
+ class InvalidStartsWithAt < SlackError; end
355
362
  class InvalidStepStatus < SlackError; end
356
363
  class InvalidTargetTeam < SlackError; end
357
364
  class InvalidTeam < SlackError; end
@@ -402,6 +409,7 @@ module Slack
402
409
  class LegacyConnectionLimitExceeded < SlackError; end
403
410
  class LimitRequired < SlackError; end
404
411
  class LinkNotFound < SlackError; end
412
+ class ListRecordCommentFetchFailed < SlackError; end
405
413
  class MalwareDetected < SlackError; end
406
414
  class ManagedChannelNotSupported < SlackError; end
407
415
  class MarkdownTextConflict < SlackError; end
@@ -427,6 +435,8 @@ module Slack
427
435
  class MissingFileData < SlackError; end
428
436
  class MissingPostType < SlackError; end
429
437
  class MissingProfileId < SlackError; end
438
+ class MissingQuery < SlackError; end
439
+ class MissingRecordChannelConfig < SlackError; end
430
440
  class MissingResource < SlackError; end
431
441
  class MissingScope < SlackError; end
432
442
  class MissingSource < SlackError; end
@@ -451,6 +461,7 @@ module Slack
451
461
  class NameTakenInOrg < SlackError; end
452
462
  class NameTooLong < SlackError; end
453
463
  class NamedEntitiesCannotBeEmpty < SlackError; end
464
+ class NoAccess < SlackError; end
454
465
  class NoActiveSessions < SlackError; end
455
466
  class NoAliasSelected < SlackError; end
456
467
  class NoBotUserForApp < SlackError; end
@@ -502,6 +513,7 @@ module Slack
502
513
  class NotInTeam < SlackError; end
503
514
  class NotOwner < SlackError; end
504
515
  class NotPaid < SlackError; end
516
+ class NotPermitted < SlackError; end
505
517
  class NotPinnable < SlackError; end
506
518
  class NotPinned < SlackError; end
507
519
  class NotReactable < SlackError; end
@@ -536,9 +548,11 @@ module Slack
536
548
  class PrimaryUsergroupNotFound < SlackError; end
537
549
  class ProfileSetFailed < SlackError; end
538
550
  class ProvidersNotFound < SlackError; end
551
+ class PublicFileTypeNotAllowed < SlackError; end
539
552
  class PublicVideoNotAllowed < SlackError; end
540
553
  class PublishedAppOnly < SlackError; end
541
554
  class PushLimitReached < SlackError; end
555
+ class QueryTooLong < SlackError; end
542
556
  class RateLimited < SlackError; end
543
557
  class Ratelimit < SlackError; end
544
558
  class Ratelimited < SlackError; end
@@ -618,6 +632,7 @@ module Slack
618
632
  class TooManyNamedEntities < SlackError; end
619
633
  class TooManyPins < SlackError; end
620
634
  class TooManyReactions < SlackError; end
635
+ class TooManyTabs < SlackError; end
621
636
  class TooManyTargetTeams < SlackError; end
622
637
  class TooManyTeams < SlackError; end
623
638
  class TooManyTeamsProvided < SlackError; end
@@ -674,6 +689,7 @@ module Slack
674
689
  class UsergroupNotFound < SlackError; end
675
690
  class UsergroupNotLinkedToTeam < SlackError; end
676
691
  class UsergroupTeamNotProvisioned < SlackError; end
692
+ class UsernameSame < SlackError; end
677
693
  class UsersListNotSupplied < SlackError; end
678
694
  class UsersNotFound < SlackError; end
679
695
  class ValidationErrors < SlackError; end
@@ -789,6 +805,7 @@ module Slack
789
805
  'canvas_globally_disabled' => CanvasGloballyDisabled,
790
806
  'canvas_not_found' => CanvasNotFound,
791
807
  'canvas_tab_creation_failed' => CanvasTabCreationFailed,
808
+ 'channel_already_exists' => ChannelAlreadyExists,
792
809
  'channel_archived' => ChannelArchived,
793
810
  'channel_cannot_be_unshared' => ChannelCannotBeUnshared,
794
811
  'channel_canvas_already_exists' => ChannelCanvasAlreadyExists,
@@ -814,6 +831,7 @@ module Slack
814
831
  'connected_user_denied' => ConnectedUserDenied,
815
832
  'connection_limit_exceeded' => ConnectionLimitExceeded,
816
833
  'connection_limit_exceeded_pending' => ConnectionLimitExceededPending,
834
+ 'context_channel_not_found' => ContextChannelNotFound,
817
835
  'could_not_archive_channel' => CouldNotArchiveChannel,
818
836
  'could_not_convert_channel' => CouldNotConvertChannel,
819
837
  'could_not_create_channel' => CouldNotCreateChannel,
@@ -919,6 +937,7 @@ module Slack
919
937
  'feature_not_available' => FeatureNotAvailable,
920
938
  'feature_not_enabled' => FeatureNotEnabled,
921
939
  'fetch_members_failed' => FetchMembersFailed,
940
+ 'file_already_added' => FileAlreadyAdded,
922
941
  'file_comment_not_found' => FileCommentNotFound,
923
942
  'file_deleted' => FileDeleted,
924
943
  'file_deleting_disabled' => FileDeletingDisabled,
@@ -933,7 +952,7 @@ module Slack
933
952
  'forbidden_team' => ForbiddenTeam,
934
953
  'free_team_canvas_tab_already_exists' => FreeTeamCanvasTabAlreadyExists,
935
954
  'free_team_not_allowed' => FreeTeamNotAllowed,
936
- 'free_teams_cannot_create_standalone_canvases' => FreeTeamsCannotCreateStandaloneCanvases,
955
+ 'free_teams_cannot_create_non_tabbed_canvases' => FreeTeamsCannotCreateNonTabbedCanvases,
937
956
  'free_teams_cannot_edit_standalone_canvases' => FreeTeamsCannotEditStandaloneCanvases,
938
957
  'function_execution_not_found' => FunctionExecutionNotFound,
939
958
  'function_not_found' => FunctionNotFound,
@@ -949,6 +968,7 @@ module Slack
949
968
  'insecure_request' => InsecureRequest,
950
969
  'internal_error' => InternalError,
951
970
  'invalid_action' => InvalidAction,
971
+ 'invalid_action_token' => InvalidActionToken,
952
972
  'invalid_actor' => InvalidActor,
953
973
  'invalid_app' => InvalidApp,
954
974
  'invalid_app_action_type' => InvalidAppActionType,
@@ -1003,6 +1023,8 @@ module Slack
1003
1023
  'invalid_name_required' => InvalidNameRequired,
1004
1024
  'invalid_name_specials' => InvalidNameSpecials,
1005
1025
  'invalid_named_entities' => InvalidNamedEntities,
1026
+ 'invalid_ooo_message' => InvalidOooMessage,
1027
+ 'invalid_org_id' => InvalidOrgId,
1006
1028
  'invalid_outputs' => InvalidOutputs,
1007
1029
  'invalid_parameters' => InvalidParameters,
1008
1030
  'invalid_parent_type' => InvalidParentType,
@@ -1029,6 +1051,7 @@ module Slack
1029
1051
  'invalid_sort_dir' => InvalidSortDir,
1030
1052
  'invalid_source' => InvalidSource,
1031
1053
  'invalid_start_time' => InvalidStartTime,
1054
+ 'invalid_starts_with_at' => InvalidStartsWithAt,
1032
1055
  'invalid_step_status' => InvalidStepStatus,
1033
1056
  'invalid_target_team' => InvalidTargetTeam,
1034
1057
  'invalid_team' => InvalidTeam,
@@ -1079,6 +1102,7 @@ module Slack
1079
1102
  'legacy_connection_limit_exceeded' => LegacyConnectionLimitExceeded,
1080
1103
  'limit_required' => LimitRequired,
1081
1104
  'link_not_found' => LinkNotFound,
1105
+ 'list_record_comment_fetch_failed' => ListRecordCommentFetchFailed,
1082
1106
  'malware_detected' => MalwareDetected,
1083
1107
  'managed_channel_not_supported' => ManagedChannelNotSupported,
1084
1108
  'markdown_text_conflict' => MarkdownTextConflict,
@@ -1104,6 +1128,8 @@ module Slack
1104
1128
  'missing_file_data' => MissingFileData,
1105
1129
  'missing_post_type' => MissingPostType,
1106
1130
  'missing_profile_id' => MissingProfileId,
1131
+ 'missing_query' => MissingQuery,
1132
+ 'missing_record_channel_config' => MissingRecordChannelConfig,
1107
1133
  'missing_resource' => MissingResource,
1108
1134
  'missing_scope' => MissingScope,
1109
1135
  'missing_source' => MissingSource,
@@ -1128,6 +1154,7 @@ module Slack
1128
1154
  'name_taken_in_org' => NameTakenInOrg,
1129
1155
  'name_too_long' => NameTooLong,
1130
1156
  'named_entities_cannot_be_empty' => NamedEntitiesCannotBeEmpty,
1157
+ 'no_access' => NoAccess,
1131
1158
  'no_active_sessions' => NoActiveSessions,
1132
1159
  'no_alias_selected' => NoAliasSelected,
1133
1160
  'no_bot_user_for_app' => NoBotUserForApp,
@@ -1179,6 +1206,7 @@ module Slack
1179
1206
  'not_in_team' => NotInTeam,
1180
1207
  'not_owner' => NotOwner,
1181
1208
  'not_paid' => NotPaid,
1209
+ 'not_permitted' => NotPermitted,
1182
1210
  'not_pinnable' => NotPinnable,
1183
1211
  'not_pinned' => NotPinned,
1184
1212
  'not_reactable' => NotReactable,
@@ -1213,9 +1241,11 @@ module Slack
1213
1241
  'primary_usergroup_not_found' => PrimaryUsergroupNotFound,
1214
1242
  'profile_set_failed' => ProfileSetFailed,
1215
1243
  'providers_not_found' => ProvidersNotFound,
1244
+ 'public_file_type_not_allowed' => PublicFileTypeNotAllowed,
1216
1245
  'public_video_not_allowed' => PublicVideoNotAllowed,
1217
1246
  'published_app_only' => PublishedAppOnly,
1218
1247
  'push_limit_reached' => PushLimitReached,
1248
+ 'query_too_long' => QueryTooLong,
1219
1249
  'rate_limited' => RateLimited,
1220
1250
  'ratelimit' => Ratelimit,
1221
1251
  'ratelimited' => Ratelimited,
@@ -1295,6 +1325,7 @@ module Slack
1295
1325
  'too_many_named_entities' => TooManyNamedEntities,
1296
1326
  'too_many_pins' => TooManyPins,
1297
1327
  'too_many_reactions' => TooManyReactions,
1328
+ 'too_many_tabs' => TooManyTabs,
1298
1329
  'too_many_target_teams' => TooManyTargetTeams,
1299
1330
  'too_many_teams' => TooManyTeams,
1300
1331
  'too_many_teams_provided' => TooManyTeamsProvided,
@@ -1351,6 +1382,7 @@ module Slack
1351
1382
  'usergroup_not_found' => UsergroupNotFound,
1352
1383
  'usergroup_not_linked_to_team' => UsergroupNotLinkedToTeam,
1353
1384
  'usergroup_team_not_provisioned' => UsergroupTeamNotProvisioned,
1385
+ 'username_same' => UsernameSame,
1354
1386
  'users_list_not_supplied' => UsersListNotSupplied,
1355
1387
  'users_not_found' => UsersNotFound,
1356
1388
  'validation_errors' => ValidationErrors,
@@ -13,6 +13,8 @@ module Slack
13
13
  # Name of the file being uploaded.
14
14
  # @option params [string] :content
15
15
  # File contents via a POST variable.
16
+ # @option params [Array<Hash>] :files
17
+ # Array of file objects with :filename, :content, and optionally :title, :alt_txt, :snippet_type.
16
18
  # @option params [string] :alt_txt
17
19
  # Description of image for screen-reader.
18
20
  # @option params [string] :snippet_type
@@ -32,8 +34,16 @@ module Slack
32
34
  # Never use a reply's ts value; use its parent instead.
33
35
  # Also make sure to provide only one channel when using 'thread_ts'.
34
36
  def files_upload_v2(params = {})
35
- %i[filename content].each do |param|
36
- raise ArgumentError, "Required argument :#{param} missing" if params[param].nil?
37
+ files_to_upload = if params[:files] && params[:files].is_a?(Array)
38
+ params[:files]
39
+ else
40
+ [params.slice(:filename, :content, :title, :alt_txt, :snippet_type)]
41
+ end
42
+
43
+ files_to_upload.each_with_index do |file, index|
44
+ %i[filename content].each do |param|
45
+ raise ArgumentError, "Required argument :#{param} missing in file (#{index})" if file[param].nil?
46
+ end
37
47
  end
38
48
 
39
49
  channel_params = %i[channel channels channel_id].map { |param| params[param] }.compact
@@ -53,31 +63,31 @@ module Slack
53
63
  complete_upload_request_params[:channel_id] = params[:channel_id]
54
64
  end
55
65
 
56
- content = params[:content]
57
- title = params[:title] || params[:filename]
66
+ uploaded_files = files_to_upload.map do |file|
67
+ content = file[:content]
68
+ title = file[:title] || file[:filename]
58
69
 
59
- upload_url_request_params = params.slice(:filename, :alt_txt, :snippet_type)
60
- upload_url_request_params[:length] = content.bytesize
70
+ upload_url_request_params = file.slice(:filename, :alt_txt, :snippet_type)
71
+ upload_url_request_params[:length] = content.bytesize
61
72
 
62
- # Get the upload url.
63
- get_upload_url_response = files_getUploadURLExternal(upload_url_request_params)
64
- upload_url = get_upload_url_response[:upload_url]
65
- file_id = get_upload_url_response[:file_id]
73
+ get_upload_url_response = files_getUploadURLExternal(upload_url_request_params)
74
+ upload_url = get_upload_url_response[:upload_url]
75
+ file_id = get_upload_url_response[:file_id]
66
76
 
67
- # Upload the file.
68
- ::Faraday::Connection.new(upload_url, options) do |connection|
69
- connection.request :multipart
70
- connection.request :url_encoded
71
- connection.use ::Slack::Web::Faraday::Response::WrapError
72
- connection.response :logger, logger if logger
73
- connection.adapter adapter
74
- end.post do |request|
75
- request.body = content
76
- end
77
+ ::Faraday::Connection.new(upload_url, options) do |connection|
78
+ connection.request :multipart
79
+ connection.request :url_encoded
80
+ connection.use ::Slack::Web::Faraday::Response::WrapError
81
+ connection.response :logger, logger if logger
82
+ connection.adapter adapter
83
+ end.post do |request|
84
+ request.body = content
85
+ end
77
86
 
78
- # Complete the upload.
79
- complete_upload_request_params[:files] = [{ id: file_id, title: title }].to_json
87
+ { id: file_id, title: title }
88
+ end
80
89
 
90
+ complete_upload_request_params[:files] = uploaded_files.to_json
81
91
  files_completeUploadExternal(complete_upload_request_params)
82
92
  end
83
93
  end
@@ -12,11 +12,33 @@ module Slack
12
12
  #
13
13
  # @option options [channel] :channel
14
14
  # Channel to get ID for, prefixed with #.
15
+ # @option options [string] :team_id
16
+ # The team id to search for channels in, required if token belongs to org-wide app.
17
+ # This field will be ignored if the API call is sent using a workspace-level token.
18
+ # @option options [boolean] :id_exclude_archived
19
+ # Set to true to exclude archived channels from the search
20
+ # @option options [integer] :id_limit
21
+ # The page size used for conversations_list calls required to find the channel's ID
22
+ # @option options [string] :id_types
23
+ # The types of conversations to use when searching for the ID. A comma-separated list
24
+ # containing one or more of public_channel, private_channel, mpim, im
15
25
  def conversations_id(options = {})
16
26
  name = options[:channel]
17
27
  raise ArgumentError, 'Required arguments :channel missing' if name.nil?
18
28
 
19
- id_for :channel, name, '#', :conversations_list, :channels, 'channel_not_found'
29
+ id_for(
30
+ key: :channel,
31
+ name: name,
32
+ prefix: '#',
33
+ enum_method: :conversations_list,
34
+ list_method: :channels,
35
+ options: {
36
+ team_id: options.fetch(:team_id, nil),
37
+ exclude_archived: options.fetch(:id_exclude_archived, nil),
38
+ limit: options.fetch(:id_limit, Slack::Web.config.conversations_id_page_size),
39
+ types: options.fetch(:id_types, nil)
40
+ }.compact
41
+ )
20
42
  end
21
43
  end
22
44
  end
@@ -6,16 +6,16 @@ module Slack
6
6
  module Ids
7
7
  private
8
8
 
9
- def id_for(key, name, prefix, enum_method, list_method, not_found_error)
9
+ def id_for(key:, name:, prefix:, enum_method:, list_method:, options: {})
10
10
  return { 'ok' => true, key.to_s => { 'id' => name } } unless name[0] == prefix
11
11
 
12
- public_send enum_method do |list|
12
+ public_send(enum_method, **options) do |list|
13
13
  list.public_send(list_method).each do |li|
14
14
  return Slack::Messages::Message.new('ok' => true, key.to_s => { 'id' => li.id }) if li.name == name[1..-1]
15
15
  end
16
16
  end
17
17
 
18
- raise Slack::Web::Api::Errors::SlackError, not_found_error
18
+ raise Slack::Web::Api::Errors::SlackError, "#{key}_not_found"
19
19
  end
20
20
  end
21
21
  end
@@ -12,11 +12,26 @@ module Slack
12
12
  #
13
13
  # @option options [user] :user
14
14
  # User to get ID for, prefixed with '@'.
15
+ # @option options [string] :team_id
16
+ # The team id to search for users in, required if token belongs to org-wide app.
17
+ # This field will be ignored if the API call is sent using a workspace-level token.
18
+ # @option options [integer] :id_limit
19
+ # The page size used for users_list calls required to find the user's ID
15
20
  def users_id(options = {})
16
21
  name = options[:user]
17
22
  raise ArgumentError, 'Required arguments :user missing' if name.nil?
18
23
 
19
- id_for :user, name, '@', :users_list, :members, 'user_not_found'
24
+ id_for(
25
+ key: :user,
26
+ name: name,
27
+ prefix: '@',
28
+ enum_method: :users_list,
29
+ list_method: :members,
30
+ options: {
31
+ team_id: options.fetch(:team_id, nil),
32
+ limit: options.fetch(:id_limit, Slack::Web.config.users_id_page_size)
33
+ }.compact
34
+ )
20
35
  end
21
36
  end
22
37
  end
@@ -15,6 +15,8 @@ module Slack
15
15
  timeout
16
16
  open_timeout
17
17
  default_page_size
18
+ conversations_id_page_size
19
+ users_id_page_size
18
20
  default_max_retries
19
21
  adapter
20
22
  ].freeze
@@ -32,6 +34,8 @@ module Slack
32
34
  self.timeout = nil
33
35
  self.open_timeout = nil
34
36
  self.default_page_size = 100
37
+ self.conversations_id_page_size = nil
38
+ self.users_id_page_size = nil
35
39
  self.default_max_retries = 100
36
40
  self.adapter = ::Faraday.default_adapter
37
41
  end
@@ -22,7 +22,7 @@ end
22
22
  begin
23
23
  require 'openssl'
24
24
  rescue LoadError # rubocop:disable Lint/SuppressedException
25
- # Used in slack/web/config
25
+ # Used in slack/web/config and slack/utils/security
26
26
  end
27
27
  require_relative 'slack/web/config'
28
28
  require_relative 'slack/web/api/errors/slack_error'
@@ -57,3 +57,5 @@ require_relative 'slack/real_time/client'
57
57
  # Events API
58
58
  require_relative 'slack/events/config'
59
59
  require_relative 'slack/events/request'
60
+
61
+ require_relative 'slack/utils/security'
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.homepage = 'http://github.com/slack-ruby/slack-ruby-client'
18
18
  s.licenses = ['MIT']
19
19
  s.summary = 'Slack Web and RealTime API client.'
20
- s.add_dependency 'faraday', '>= 2.0'
20
+ s.add_dependency 'faraday', '>= 2.0.1'
21
21
  s.add_dependency 'faraday-mashify'
22
22
  s.add_dependency 'faraday-multipart'
23
23
  s.add_dependency 'gli'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-19 00:00:00.000000000 Z
11
+ date: 2025-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: 2.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: 2.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday-mashify
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -166,6 +166,7 @@ files:
166
166
  - bin/commands/apps_datastore.rb
167
167
  - bin/commands/apps_event_authorizations.rb
168
168
  - bin/commands/apps_manifest.rb
169
+ - bin/commands/assistant_search.rb
169
170
  - bin/commands/assistant_threads.rb
170
171
  - bin/commands/auth.rb
171
172
  - bin/commands/auth_teams.rb
@@ -269,6 +270,7 @@ files:
269
270
  - lib/slack/real_time/stores/base.rb
270
271
  - lib/slack/real_time/stores/starter.rb
271
272
  - lib/slack/real_time/stores/store.rb
273
+ - lib/slack/utils/security.rb
272
274
  - lib/slack/version.rb
273
275
  - lib/slack/web/api/endpoints.rb
274
276
  - lib/slack/web/api/endpoints/admin_analytics.rb
@@ -311,6 +313,7 @@ files:
311
313
  - lib/slack/web/api/endpoints/apps_datastore.rb
312
314
  - lib/slack/web/api/endpoints/apps_event_authorizations.rb
313
315
  - lib/slack/web/api/endpoints/apps_manifest.rb
316
+ - lib/slack/web/api/endpoints/assistant_search.rb
314
317
  - lib/slack/web/api/endpoints/assistant_threads.rb
315
318
  - lib/slack/web/api/endpoints/auth.rb
316
319
  - lib/slack/web/api/endpoints/auth_teams.rb