webhooks: add "user created" webhook

Webhooks send a POST to an admin-supplied URL when something happens,
with relevant information sent in JSON. One has been added for creating
users in Settings > Webhooks > User Created.

Lazily, the portion of GetUsers which generates a respUser has been
factored out, and is called to send the JSON payload.

A stripped-down common.Req method has been added, which is used by the
barebones WebhookSender struct.
This commit is contained in:
Harvey Tindall
2024-08-20 21:33:43 +01:00
parent 8307d3da90
commit e5f79c60ae
12 changed files with 226 additions and 63 deletions

View File

@@ -130,11 +130,6 @@ type Updater struct {
binary string
}
// SetTransport sets the http.Transport to use for requests. Can be used to set a proxy.
func (ud *Updater) SetTransport(t *http.Transport) {
ud.httpClient.Transport = t
}
func newUpdater(buildroneURL, namespace, repo, version, commit, buildType string) *Updater {
// fmt.Printf(`Updater intializing with "%s", "%s", "%s", "%s", "%s", "%s"\n`, buildroneURL, namespace, repo, version, commit, buildType)
bType := off