slack-go / slack

Slack API in Go, originally by @nlopes; Maintainers needed, contact @parsley42
https://pkg.go.dev/github.com/slack-go/slack
BSD 2-Clause "Simplified" License
4.66k stars 1.14k forks source link

feat: Add the ability to set `URL` on `NewButtonBlockElement` via `.WithURL()` #1250

Closed joshbranham closed 7 months ago

joshbranham commented 9 months ago

This introduces the ability to set the URL for a ButtonBlockElement on an existing instance by calling .WithURL("https://myurl").

Fixes https://github.com/slack-go/slack/issues/1085

joshbranham commented 9 months ago

I just ran into this in a project I was working on, instead of adding the URL as an argument in my fork I added a WithURL method similar to what had been done for adding a style or confirm.

Example

slack.NewButtonBlockElement(...).WithURL(url)

Good point, I like that better. Happy to rework this to go that route if maintainers would prefer

parsley42 commented 7 months ago

Yeah, I'm really loathe to change a function signature. If this needs to be merged, please use e.g. withURL(...), and look for a way to update the documentation so maintainers will find/see it.

joshbranham commented 7 months ago

Implemented as suggested, good call!