slackapi / deno-slack-api

Slack API Client for Deno Run on Slack projects
https://api.slack.com/automation
MIT License
35 stars 17 forks source link

[FEATURE] apiCall support other HTTP methods #85

Closed whywaita closed 12 months ago

whywaita commented 12 months ago

Description

Now, apiCall() only supports POST method.

https://github.com/slackapi/deno-slack-api/blob/368e4064f836b222178cfc7722d377d46baea118/src/base-client.ts#L42

But Slack API has other HTTP methods. So apiCall needs to support other HTTP methods.

Suggestion

  1. Add apiCallWithHTTPMethods()
  async apiCallWithHTTPMethods(
    http_methods: string,
    method: string,
    data: SlackAPIMethodArgs = {},
  ): Promise<BaseResponse> {
  }
  1. Add apiPostCall(), apiGetCall(), apiDeleteCall() and more

Requirements (place an x in each of the [ ])

seratch commented 12 months ago

Hi @whywaita, thanks for taking the time to send this suggestion!

Indeed, our Web API documents mention a recommended HTTP method to use for an API call. However, in reality, all the Slack API endpoints can be accessed with the HTTP POST method, and that's why this SDK consistently uses it for all the APIs (also, this is the same for other existing SDKs such as Node.js, Python, and Java ones). Not following the recommended HTTP methods in documents can reduce this team's maintenance efforts, thus we don't have plans to change this in the short term.

Thanks again for your time and interest, and we apologize for the confusion with the API documents! Let me close this issue now.

whywaita commented 12 months ago

hum I see, I will wait for all APIs to become using POST.

filmaj commented 12 months ago

There's more information on this on our HTTP API Overview documentation. We opt to use the "POST bodies" approach as it reduces the amount of code we require to maintain and there is support for it for all API methods (as far as I know).