MCPcopy Index your code
hub / github.com/go-playground/webhooks

github.com/go-playground/webhooks @v6.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v6.4.0 ↗ · + Follow
329 symbols 493 edges 24 files 237 documented · 72% 22 cross-repo links updated 1y agov6.4.0 · 2024-08-06★ 1,02719 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Library webhooks

Project status Test Coverage Status Go Report Card GoDoc License

Library webhooks allows for easy receiving and parsing of GitHub, Bitbucket, GitLab, Docker Hub, Gogs and Azure DevOps Webhook Events

Features:

  • Parses the entire payload, not just a few fields.
  • Fields + Schema directly lines up with webhook posted json

Notes:

  • Currently only accepting json payloads.

Installation

Use go get.

go get -u github.com/go-playground/webhooks/v6

Then import the package into your own code.

import "github.com/go-playground/webhooks/v6"

Usage and Documentation

Please see http://godoc.org/github.com/go-playground/webhooks/v6 for detailed usage docs.

Examples:
package main

import (
    "fmt"

    "net/http"

    "github.com/go-playground/webhooks/v6/github"
)

const (
    path = "/webhooks"
)

func main() {
    hook, _ := github.New(github.Options.Secret("MyGitHubSuperSecretSecret...?"))

    http.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
        payload, err := hook.Parse(r, github.ReleaseEvent, github.PullRequestEvent)
        if err != nil {
            if err == github.ErrEventNotFound {
                // ok event wasn't one of the ones asked to be parsed
            }
        }
        switch payload.(type) {

        case github.ReleasePayload:
            release := payload.(github.ReleasePayload)
            // Do whatever you want from here...
            fmt.Printf("%+v", release)

        case github.PullRequestPayload:
            pullRequest := payload.(github.PullRequestPayload)
            // Do whatever you want from here...
            fmt.Printf("%+v", pullRequest)
        }
    })
    http.ListenAndServe(":3000", nil)
}

Contributing

Pull requests for other services are welcome!

If the changes being proposed or requested are breaking changes, please create an issue for discussion.

License

Distributed under MIT License, please see license file in code for more details.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Struct 239
Function 45
Method 21
TypeAlias 17
FuncType 7

Languages

Go100%

Modules by API surface

gitlab/payload.go66 symbols
github/payload.go53 symbols
gitea/payload.go37 symbols
bitbucket-server/payload.go31 symbols
azuredevops/payload.go25 symbols
bitbucket/payload.go24 symbols
gitlab/gitlab.go8 symbols
github/github.go8 symbols
azuredevops/azuredevops.go8 symbols
gogs/gogs.go7 symbols
gitea/gitea.go7 symbols
bitbucket/bitbucket.go7 symbols

For agents

$ claude mcp add webhooks \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page