slack-ruby / slack-ruby-client

A Ruby and command-line client for the Slack Web, Real Time Messaging and Event APIs.
MIT License
1.21k stars 214 forks source link

Add JSON encoding to all applicable Web API arguments #448

Closed jmanian closed 1 year ago

jmanian commented 1 year ago

There was at least one chat.* method that was missing the auto-encoding of blocks and attachments into JSON (chat.scheduleMessage). Instead of continuing to apply these to each method individually as a patch, I thought it would be nice to solve this once and for all.

~New groups of methods or new options that require encoding will require changes to accommodate those, but no patching.~ This is now being pulled from data in slack-api-ref and will update automatically with the docs.

~I'm open to suggestions on the exact approach, and I'm opening this as a draft without tests, changelog, etc. to gather comments first.~

jmanian commented 1 year ago

@dblock Here's a different take, trying to base it entirely on data in slack-api-ref. It feels a little fragile to base it on data in the argument descriptions, but there isn't anything more structured at the moment (in slack-api-ref or on the doc pages). It does find all the ones we knew about, plus a handful of others.

jmanian commented 1 year ago

@dblock still needs tests and changelog, but here's what this looks like now with the slack-ruby/slack-api-ref#64

dblock commented 1 year ago

Looks good!