Skip to content

Commit

Permalink
refactor: Removing extra comment
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Mar 12, 2023
1 parent 62e4439 commit 3c08835
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions pkg/provider/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,17 @@ import (
absto "github.com/ViBiOh/absto/pkg/model"
)

// WebhookKind defines constant for webhook kind
type WebhookKind int

const (
// Raw webhook
Raw WebhookKind = iota
// Discord webhook
Discord
// Slack webhook
Slack
// Telegram webhook
Telegram
)

// WebhookKindValues string values
var WebhookKindValues = []string{"raw", "discord", "slack", "telegram"}

// ParseWebhookKind parse raw string into a WebhookKind
func ParseWebhookKind(value string) (WebhookKind, error) {
for i, short := range WebhookKindValues {
if strings.EqualFold(short, value) {
Expand All @@ -41,15 +34,13 @@ func (r WebhookKind) String() string {
return WebhookKindValues[r]
}

// MarshalJSON marshals the enum as a quoted json string
func (r WebhookKind) MarshalJSON() ([]byte, error) {
buffer := bytes.NewBufferString(`"`)
buffer.WriteString(r.String())
buffer.WriteString(`"`)
return buffer.Bytes(), nil
}

// UnmarshalJSON unmarshal JSON
func (r *WebhookKind) UnmarshalJSON(b []byte) error {
var strValue string
err := json.Unmarshal(b, &strValue)
Expand Down

0 comments on commit 3c08835

Please sign in to comment.