diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f88af5b7..bbb6af8c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,15 +1,15 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2025-09-06 23:33:08 UTC using RuboCop version 1.80.2. +# on 2025-09-21 13:03:00 UTC using RuboCop version 1.80.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 3 +# Offense count: 4 # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: - Max: 50 + Max: 49 # Offense count: 1 # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. @@ -20,7 +20,7 @@ Metrics/BlockLength: # Offense count: 1 # Configuration parameters: CountComments, CountAsOne. Metrics/ClassLength: - Max: 127 + Max: 132 # Offense count: 2 # Configuration parameters: AllowedMethods, AllowedPatterns. diff --git a/README.md b/README.md index 89cbd186..1ceb9181 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ This is a maintained, machine-readable version of the Slack API Docs, generated [Known undocumented methods and groups](https://github.com/ErikKalkoken/slackApiDoc) have been added manually. -* [methods](methods/undocumented): Undocumented methods. -* [groups](groups/undocumented): Undocumented groups. +* [methods](methods/_undocumented): Undocumented methods. +* [groups](groups/_undocumented): Undocumented groups. ### It needs an update! diff --git a/groups/undocumented/users.admin.json b/groups/_undocumented/users.admin.json similarity index 100% rename from groups/undocumented/users.admin.json rename to groups/_undocumented/users.admin.json diff --git a/groups/undocumented/users.prefs.json b/groups/_undocumented/users.prefs.json similarity index 100% rename from groups/undocumented/users.prefs.json rename to groups/_undocumented/users.prefs.json diff --git a/methods/_patches/admin/admin.users.session.invalidate.json b/methods/_patches/admin/admin.users.session.invalidate.json new file mode 100644 index 00000000..8ab931d1 --- /dev/null +++ b/methods/_patches/admin/admin.users.session.invalidate.json @@ -0,0 +1,11 @@ +{ + "arg_groups": [ + { + "args": [ + "user_id" + ], + "desc": "Exactly one of these arguments is required to identify the session that is to be invalidated, user_id is preferred and team_id will be deprecated and eventually removed on January 15, 2025.", + "mutually_exclusive": true + } + ] +} \ No newline at end of file diff --git a/methods/_patches/chat/chat.postEphemeral.json b/methods/_patches/chat/chat.postEphemeral.json new file mode 100644 index 00000000..083025d3 --- /dev/null +++ b/methods/_patches/chat/chat.postEphemeral.json @@ -0,0 +1,13 @@ +{ + "arg_groups": [ + { + "args": [ + "attachments", + "blocks", + "text" + ], + "desc": "One of these arguments in addition to text is required to describe the content of the message. When attachments or blocks are included, text will be used as fallback text for notifications only.", + "mutually_exclusive": false + } + ] +} \ No newline at end of file diff --git a/methods/_patches/chat/chat.postMessage.json b/methods/_patches/chat/chat.postMessage.json new file mode 100644 index 00000000..083025d3 --- /dev/null +++ b/methods/_patches/chat/chat.postMessage.json @@ -0,0 +1,13 @@ +{ + "arg_groups": [ + { + "args": [ + "attachments", + "blocks", + "text" + ], + "desc": "One of these arguments in addition to text is required to describe the content of the message. When attachments or blocks are included, text will be used as fallback text for notifications only.", + "mutually_exclusive": false + } + ] +} \ No newline at end of file diff --git a/methods/_patches/chat/chat.scheduleMessage.json b/methods/_patches/chat/chat.scheduleMessage.json new file mode 100644 index 00000000..083025d3 --- /dev/null +++ b/methods/_patches/chat/chat.scheduleMessage.json @@ -0,0 +1,13 @@ +{ + "arg_groups": [ + { + "args": [ + "attachments", + "blocks", + "text" + ], + "desc": "One of these arguments in addition to text is required to describe the content of the message. When attachments or blocks are included, text will be used as fallback text for notifications only.", + "mutually_exclusive": false + } + ] +} \ No newline at end of file diff --git a/methods/_patches/chat/chat.update.json b/methods/_patches/chat/chat.update.json new file mode 100644 index 00000000..083025d3 --- /dev/null +++ b/methods/_patches/chat/chat.update.json @@ -0,0 +1,13 @@ +{ + "arg_groups": [ + { + "args": [ + "attachments", + "blocks", + "text" + ], + "desc": "One of these arguments in addition to text is required to describe the content of the message. When attachments or blocks are included, text will be used as fallback text for notifications only.", + "mutually_exclusive": false + } + ] +} \ No newline at end of file diff --git a/methods/_patches/functions/functions.distributions.permissions.set.json b/methods/_patches/functions/functions.distributions.permissions.set.json new file mode 100644 index 00000000..c780d773 --- /dev/null +++ b/methods/_patches/functions/functions.distributions.permissions.set.json @@ -0,0 +1,11 @@ +{ + "arg_groups": [ + { + "args": [ + "permission_type" + ], + "desc": ".", + "mutually_exclusive": true + } + ] +} \ No newline at end of file diff --git a/methods/_patches/views/views.open.json b/methods/_patches/views/views.open.json new file mode 100644 index 00000000..fe042c04 --- /dev/null +++ b/methods/_patches/views/views.open.json @@ -0,0 +1,12 @@ +{ + "arg_groups": [ + { + "args": [ + "trigger_id", + "interactivity_pointer" + ], + "desc": "One of these arguments is required to open a view for a user.", + "mutually_exclusive": true + } + ] +} \ No newline at end of file diff --git a/methods/_patches/views/views.push.json b/methods/_patches/views/views.push.json new file mode 100644 index 00000000..5c02a83f --- /dev/null +++ b/methods/_patches/views/views.push.json @@ -0,0 +1,12 @@ +{ + "arg_groups": [ + { + "args": [ + "trigger_id", + "interactivity_pointer" + ], + "desc": "One of these arguments is required to push a view.", + "mutually_exclusive": true + } + ] +} \ No newline at end of file diff --git a/methods/_patches/views/views.update.json b/methods/_patches/views/views.update.json new file mode 100644 index 00000000..fbe60c1e --- /dev/null +++ b/methods/_patches/views/views.update.json @@ -0,0 +1,12 @@ +{ + "arg_groups": [ + { + "args": [ + "external_id", + "view_id" + ], + "desc": "Exactly one of these arguments is required to identify the view that is to be updated.", + "mutually_exclusive": true + } + ] +} \ No newline at end of file diff --git a/methods/undocumented/chat/chat.command.json b/methods/_undocumented/chat/chat.command.json similarity index 100% rename from methods/undocumented/chat/chat.command.json rename to methods/_undocumented/chat/chat.command.json diff --git a/methods/undocumented/files/files.edit.json b/methods/_undocumented/files/files.edit.json similarity index 100% rename from methods/undocumented/files/files.edit.json rename to methods/_undocumented/files/files.edit.json diff --git a/methods/undocumented/files/files.share.json b/methods/_undocumented/files/files.share.json similarity index 100% rename from methods/undocumented/files/files.share.json rename to methods/_undocumented/files/files.share.json diff --git a/methods/undocumented/users/users.admin.invite.json b/methods/_undocumented/users/users.admin.invite.json similarity index 100% rename from methods/undocumented/users/users.admin.invite.json rename to methods/_undocumented/users/users.admin.invite.json diff --git a/methods/undocumented/users/users.admin.setInactive.json b/methods/_undocumented/users/users.admin.setInactive.json similarity index 100% rename from methods/undocumented/users/users.admin.setInactive.json rename to methods/_undocumented/users/users.admin.setInactive.json diff --git a/methods/undocumented/users/users.prefs.get.json b/methods/_undocumented/users/users.prefs.get.json similarity index 100% rename from methods/undocumented/users/users.prefs.get.json rename to methods/_undocumented/users/users.prefs.get.json diff --git a/tasks/events.rake b/tasks/events.rake index b521eb67..b8da50c7 100644 --- a/tasks/events.rake +++ b/tasks/events.rake @@ -6,7 +6,8 @@ namespace :api do task :validate do schema = File.read('schemas/events.json') validator = SlackApi::SpecValidator.new(schema) - Dir.glob('events/**/*.json').each do |file| + Dir.glob('events/**/*.json').grep_v(%r{/_patches\b}).each do |file| + puts file abort "Invalid file format: #{file}" unless validator.valid?(file) end end diff --git a/tasks/lib/slack_api/methods_generator.rb b/tasks/lib/slack_api/methods_generator.rb index 9429aff5..453628d6 100644 --- a/tasks/lib/slack_api/methods_generator.rb +++ b/tasks/lib/slack_api/methods_generator.rb @@ -48,6 +48,12 @@ def process_method(data) errors: errors }.merge(fields) + patch_filename = "methods/_patches/#{data['group']}/#{data['name']}.json" + if File.exist?(patch_filename) + puts "(patch) #{patch_filename}" + result.merge!(JSON.load_file(patch_filename)) + end + filename = "methods/#{data['group']}/#{data['name']}.json" FileUtils.mkdir_p("methods/#{data['group']}") puts filename @@ -93,7 +99,7 @@ def parse_args(data) end end - [args.sort.to_h, fields] + [args.to_h, fields] end def massage_type(name, arg, data = {}) diff --git a/tasks/methods.rake b/tasks/methods.rake index 669ad712..40aee3ea 100644 --- a/tasks/methods.rake +++ b/tasks/methods.rake @@ -6,7 +6,8 @@ namespace :api do task :validate do schema = File.read('schemas/methods.json') validator = SlackApi::SpecValidator.new(schema) - Dir.glob('methods/**/*.json').each do |file| + Dir.glob('methods/**/*.json').grep_v(%r{/_patches\b}).each do |file| + puts file abort "Invalid file format: #{file}" unless validator.valid?(file) end end diff --git a/tasks/update.rake b/tasks/update.rake index b477a297..fdc45244 100644 --- a/tasks/update.rake +++ b/tasks/update.rake @@ -11,7 +11,10 @@ namespace :api do desc 'Delete all generated files except undocumented ones.' task :clean_files, :dirs do |_t, args| - files = Dir["./{#{Array(args[:dirs]).join(',')}}/*"].grep_v(%r{/undocumented\b}) + raise 'Missing :dirs' unless args[:dirs] + + # keep _undocumented and _patches + files = Dir["./{#{Array(args[:dirs]).join(',')}}/*"].grep_v(%r{/_\w*\b}) FileUtils.rm_rf files end end