initial commit of initial base framework

This commit is contained in:
joeybloggs
2015-10-25 15:18:54 -04:00
parent 9eea02345c
commit 8c02b7a6d7
3 changed files with 131 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
package webhooks
// Provider defines the type of webhook
type Provider int
// webhooks available providers
const (
GitHub Provider = iota
)
// Webhook interface defines a webhook to recieve events
type Webhook interface {
Provider() Provider
}
// Config interface defines the config to setup a webhook instance
type Config interface {
UnderlyingProvider() Provider
}
// New creates and returns a WebHook instance denoted by the Provider type
func New(config Config) Webhook {
switch config.UnderlyingProvider() {
case GitHub:
c := config.(*GitHubConfig)
return &GitHubWebhook{
provider: c.Provider,
}
default:
panic("Invalid config type")
}
}