From 067960b95091c3b47b9d12df9e0c6af8ff0b694c Mon Sep 17 00:00:00 2001 From: Kyler Stole Date: Sat, 1 Oct 2022 14:47:23 -0700 Subject: [PATCH] Check for Deprecated on method page --- .gitignore | 1 + CHANGELOG.md | 1 + methods/rtm/rtm.start.json | 82 --------------------------- tasks/lib/slack_api/methods_spider.rb | 2 + 4 files changed, 4 insertions(+), 82 deletions(-) delete mode 100644 methods/rtm/rtm.start.json diff --git a/.gitignore b/.gitignore index 61af9af5..4f6b2414 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ build/ .bundle vendor/ +.idea diff --git a/CHANGELOG.md b/CHANGELOG.md index f16af6b3..a0214cb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog Some notable infrastructure contributions below. See [commits](commits/master) for Slack API updates. * Your contribution here. +* Consider `Deprecated:` label in API method summary - [@kstole](https://github.com/kstole) * Updated crawlers to use new API documentation DOM - [@chrisbloom7](https://github.com/chrisbloom7). * Added undocumented methods - [@manuelmeurer](https://github.com/manuelmeurer). * Modified method scraper to look for tags within - [@alexagranov](https://github.com/alexagranov). diff --git a/methods/rtm/rtm.start.json b/methods/rtm/rtm.start.json deleted file mode 100644 index 4075e538..00000000 --- a/methods/rtm/rtm.start.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "group": "rtm", - "name": "rtm.start", - "deprecated": false, - "desc": "Deprecated: Starts a Real Time Messaging session. Use rtm.connect instead.", - "args": { - "batch_presence_aware": { - "required": false, - "desc": "Batch presence deliveries via subscription. Enabling changes the shape of presence_change events. See batch presence.", - "type": "boolean" - }, - "include_locale": { - "required": false, - "desc": "Set this to true to receive the locale for users and channels. Defaults to false.", - "type": "boolean" - }, - "mpim_aware": { - "required": false, - "desc": "Returns MPIMs to the client in the API response.", - "type": "boolean" - }, - "no_latest": { - "required": false, - "desc": "Exclude latest timestamps for channels, groups, mpims, and ims. Automatically sets no_unreads to 1.", - "type": "boolean" - }, - "no_unreads": { - "required": false, - "desc": "Skip unread counts for each channel (improves performance).", - "type": "boolean" - }, - "presence_sub": { - "required": false, - "desc": "Only deliver presence events when requested by subscription. See presence subscriptions.", - "type": "boolean" - }, - "simple_latest": { - "required": false, - "desc": "Return timestamp only for latest message object of each channel (improves performance).", - "type": "boolean" - } - }, - "response": { - "examples": [ - "{\n \"ok\": true\n}", - "{\n \"ok\": false,\n \"error\": \"invalid_auth\"\n}" - ] - }, - "errors": { - "migration_in_progress": "Workspace is being migrated between servers. See the team_migration_started event documentation for details.", - "rtm_connect_required": "rtm.start is deprecated. Please use rtm.connect instead of rtm.start. Read https://api.slack.com/changelog/2021-10-rtm-start-to-stop for more info.", - "method_deprecated": "The method has been deprecated.", - "not_authed": "No authentication token provided.", - "invalid_auth": "Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.", - "access_denied": "Access to a resource specified in the request is denied.", - "account_inactive": "Authentication token is for a deleted user or workspace when using a bot token.", - "token_revoked": "Authentication token is for a deleted user or workspace or the app has been removed when using a user token.", - "token_expired": "Authentication token has expired.", - "no_permission": "The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.", - "org_login_required": "The workspace is undergoing an enterprise migration and will not be available until migration is complete.", - "ekm_access_denied": "Administrators have suspended the ability to post a message.", - "missing_scope": "The token used is not granted the specific scope permissions required to complete this request.", - "not_allowed_token_type": "The token type used in this request is not allowed.", - "deprecated_endpoint": "The endpoint has been deprecated.", - "two_factor_setup_required": "Two factor setup is required.", - "enterprise_is_restricted": "The method cannot be called from an Enterprise.", - "invalid_arguments": "The method was either called with invalid arguments or some detail about the arguments passed are invalid, which is more likely when using complex arguments like blocks or attachments.", - "invalid_arg_name": "The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.", - "invalid_array_arg": "The method was passed an array as an argument. Please only input valid strings.", - "invalid_charset": "The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.", - "invalid_form_data": "The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.", - "invalid_post_type": "The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.", - "missing_post_type": "The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.", - "team_added_to_org": "The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.", - "ratelimited": "The request has been ratelimited. Refer to the Retry-After header for when to retry the request.", - "accesslimited": "Access to this method is limited on the current network.", - "request_timeout": "The method was called via a POST request, but the POST data was either missing or truncated.", - "service_unavailable": "The service is temporarily unavailable.", - "fatal_error": "The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.", - "internal_error": "The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised." - } -} \ No newline at end of file diff --git a/tasks/lib/slack_api/methods_spider.rb b/tasks/lib/slack_api/methods_spider.rb index b656e9c2..78a3a3ef 100644 --- a/tasks/lib/slack_api/methods_spider.rb +++ b/tasks/lib/slack_api/methods_spider.rb @@ -37,6 +37,8 @@ def process_list(page, _default_data = {}) def process_method(page, default_data = {}) method_page = ensure!(page, '.apiMethodPage', default_data[:method_name]) desc = method_page.search('.apiReference__mainDescription').text.gsub("’", "'") + return if desc.downcase.start_with? 'deprecated:' + args, fields = parse_args(method_page, default_data) errors = parse_errors(method_page, default_data) response = parse_response(method_page, default_data)