Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking: Update latest api docs #255

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

inooid
Copy link
Contributor

@inooid inooid commented Aug 9, 2022

⚠️ This PR contains breaking changes based on deprecated methods by Slack (which presumably are already not working) and changes to which arguments are considered required and optional. The breaking changes are listed in the PR description.

Descriptions

  • Adds the slack_api_docs module that allows for generating API docs JSON files straight from the Slack API website (https://hexdocs.pm/slack_api_docs/readme.html)
  • Deleted the deprecated methods
  • Updated the existing documents

For review:

I've converted all existing JSON files into the current format for an easier time reviewing. Think of it as:

Enum.map(files, fn file ->
  contents = file
  |> File.read!()
  |> Jason.decode!()
  |> Jason.encode!(pretty: true)

  File.write!(file, contents)
end)

It's probably easiest to review this commit: 952114d (as it contains the pre-formatting to make it easier to review).

Breaking changes

  • api.test.json (foo argument is removed)
  • channels.archive.json (Deprecated and removed)
  • channels.create.json (Deprecated and removed)
  • channels.history.json (Deprecated and removed)
  • channels.info.json (Deprecated and removed)
  • channels.invite.json (Deprecated and removed)
  • channels.join.json (Deprecated and removed)
  • channels.kick.json (Deprecated and removed)
  • channels.leave.json (Deprecated and removed)
  • channels.list.json (Deprecated and removed)
  • channels.mark.json (Deprecated and removed)
  • channels.rename.json (Deprecated and removed)
  • channels.replies.json (Deprecated and removed)
  • channels.setPurpose.json (Deprecated and removed)
  • channels.setTopic.json (Deprecated and removed)
  • channels.unarchive.json (Deprecated and removed)
  • conversations.create.json (user_ids argument is deprecated and removed, team_id is added, errors changed a lot because of the user_ids being removed)
  • conversations.members.json (exclude_archived argument is removed)
  • files.comments.add.json (Deprecated and removed)
  • files.comments.edit.json (Deprecated and removed)
  • groups.archive.json (Deprecated and removed)
  • groups.close.json (Deprecated and removed)
  • groups.create.json (Deprecated and removed)
  • groups.createChild.json (Deprecated and removed)
  • groups.history.json (Deprecated and removed)
  • groups.info.json (Deprecated and removed)
  • groups.invite.json (Deprecated and removed)
  • groups.kick.json (Deprecated and removed)
  • groups.leave.json (Deprecated and removed)
  • groups.list.json (Deprecated and removed)
  • groups.mark.json (Deprecated and removed)
  • groups.open.json (Deprecated and removed)
  • groups.rename.json (Deprecated and removed)
  • groups.replies.json (Deprecated and removed)
  • groups.setPurpose.json (Deprecated and removed)
  • groups.setTopic.json (Deprecated and removed)
  • groups.unarchive.json (Deprecated and removed)
  • im.close.json (Deprecated and removed)
  • im.history.json (Deprecated and removed)
  • im.list.json (Deprecated and removed)
  • im.mark.json (Deprecated and removed)
  • im.open.json (Deprecated and removed)
  • im.replies.json (Deprecated and removed)
  • mpim.close.json (Deprecated and removed)
  • mpim.history.json (Deprecated and removed)
  • mpim.list.json (Deprecated and removed)
  • mpim.mark.json (Deprecated and removed)
  • mpim.open.json (Deprecated and removed)
  • oauth.access.json (client_id, client_secret, code, redirect_uri arguments are made optional and single_channel argument is added)
  • oauth.v2.access.json (client_id, client_secret, code, redirect_uri arguments are made optional and grant_type, refresh_token arguments are added)
  • pins.add.json (file, file_comment arguments are removed)
  • pins.remove.json (file, file_comment arguments are removed)
  • presence.set.json (Deprecated and removed)
  • reactions.add.json (file, file_comment arguments are removed)
  • stars.list.json (user argument is removed, cursor, limit, page,, team_id arguments are added)
  • users.list.json (presence required arg is removed, cursor, include_locale, limit, team_id arguments are added)

Non breaking changes

  • bots.info.json (team_id argument is added)
  • chat.delete.json (as_user argument is added)
  • chat.postEphemeral.json (icon_emoji, icon_url, thread_ts, username arguments are added)
  • chat.postMessage.json (metadata, mrkdwn, reply_broadcast arguments are added)
  • chat.unfurl.json (source, unfurl_id, user_auth_blocks arguments are added)
  • chat.update.json (file_ids, metadata, reply_broadcast arguments are added)
  • conversations.history.json (include_all_metadata argument is added)
  • conversations.open.json (prevent_creation argument is added)
  • dnd.info.json (team_id argument is added)
  • dnd.teamInfo.json (team_id argument is added)
  • files.info.json (count, cursor, limit, page arguments are added)
  • files.list.json (count, files, page, show_files_hidden_by_limit, team_id arguments are added)
  • files.upload.json (thread_ts argument added)
  • reactions.list.json (count, cursor, limit, page,, team_id arguments are added)
  • search.all.json (count, page, team_id arguments are added)
  • search.files.json (count, page, team_id arguments are added)
  • search.messages.json (count, cursor, page, team_id arguments are added)
  • team.accessLogs.json (before, count, page,, team_id arguments are added)
  • team.info.json (domain, team arguments are added)
  • team.integrationLogs.json (count, page, team_id arguments are added)
  • usergroups.create.json (team_id argument is added)
  • usergroups.disable.json (team_id argument is added)
  • usergroups.enable.json (team_id argument is added)
  • usergroups.list.json (team_id argument is added)
  • usergroups.update.json (team_id argument is added)
  • usergroups.users.list.json (team_id argument is added)
  • usergroups.users.update.json (team_id argument is added)
  • users.conversations.json (team_id argument is added)
  • users.info.json (include_locale argument is added)

@@ -1,17 +0,0 @@
{
Copy link
Contributor Author

@inooid inooid Aug 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Deprecated. Do we want to keep these files and mark them as deprecated instead? Can we do that using meta programming?

@@ -34,6 +34,41 @@ defmodule Slack.Web.DocumentationTest do
assert {:info, 1} in module_functions
end

test "generates function params based on required arguments from json" do
Copy link
Contributor Author

@inooid inooid Aug 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ This test is here to cover the fact that we're still properly able to generate the methods with multiple required arguments.

assert {:replies, required_args_count + 1} in module_functions
end

test "filters out required `:token` argument" do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ This test covers the fact that we're now filtering out the token argument that's present in almost every JSON file (since almost all endpoints are behind the access_token authentication).

Comment on lines +86 to +87
assert {:access, 0} in module_functions
assert {:access, 1} in module_functions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ The oauth.v2.access.json has been updated (according to the API docs) that non of these params are required anymore.

@inooid
Copy link
Contributor Author

inooid commented Aug 9, 2022

I suspect in order to move this PR forward, we'll probably want to release the previous changes first. Let those soak in and then see if we can update all of these. In order to move this forward after the current release cut, we'll have to have an opinion on: #255 (comment).

@inooid inooid marked this pull request as ready for review August 9, 2022 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant