model

package
v0.0.0-...-80dfe5b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Payload string              `json:"payload"`
	Headers map[string][]string `json:"headers"`
	Time    time.Time           `json:"time"`
}

Message represents a webhook message

func NewMessage

func NewMessage(payload string, headers map[string][]string) *Message

NewMessage creates a new messages with current timestamp

type Webhook

type Webhook struct {
	Username string `json:"username,omitempty"`

	TokenName string `json:"tokenName,omitempty"`

	ID string `json:"id"`
	// contains filtered or unexported fields
}

Webhook is used after input has been unmarshaled and will be provided to the user as well

func NewWebhook

func NewWebhook(username string, password string, tokenName string, tokenValue string) *Webhook

NewWebhook creates webhook based on input

func NewWebhookFromInput

func NewWebhookFromInput(webhookInput *WebhookInput) *Webhook

NewWebhookFromInput creates Webhook instance based on input

func (*Webhook) Validate

func (w *Webhook) Validate() error

Validate validates whether token and/or username are correctly provided

func (*Webhook) ValidateAuthorization

func (w *Webhook) ValidateAuthorization(r *http.Request) bool

ValidateAuthorization validates authorization based on provided request

type WebhookInput

type WebhookInput struct {
	Username   string `json:"username,omitempty"`
	Password   string `json:"password,omitempty"`
	TokenName  string `json:"tokenName,omitempty"`
	TokenValue string `json:"tokenValue,omitempty"`
}

WebhookInput used for unmarshaling user input

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL