webhooks_service

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllowedMentions

type AllowedMentions struct {
	Parse *[]string `json:"parse,omitempty"`
	Users *[]string `json:"users,omitempty"`
	Roles *[]string `json:"roles,omitempty"`
}

type DefaultPayload

type DefaultPayload struct {
	Level WebhookLevel        `json:"level"`
	Event schema.WebhookEvent `json:"event"`
	Data  WebhookData         `json:"data"`
}

type DiscordAuthor

type DiscordAuthor struct {
	Name    *string `json:"name,omitempty"`
	Url     *string `json:"url,omitempty"`
	IconUrl *string `json:"icon_url,omitempty"`
}

type DiscordEmbed

type DiscordEmbed struct {
	Title            *string           `json:"title,omitempty"`
	Url              *string           `json:"url,omitempty"`
	Description      *string           `json:"description,omitempty"`
	Color            *string           `json:"color,omitempty"`
	DiscordAuthor    *DiscordAuthor    `json:"author,omitempty"`
	DiscordFields    *[]DiscordField   `json:"fields,omitempty"`
	DiscordThumbnail *DiscordThumbnail `json:"thumbnail,omitempty"`
	DiscordImage     *DiscordImage     `json:"image,omitempty"`
	DiscordFooter    *DiscordFooter    `json:"footer,omitempty"`
}

type DiscordField

type DiscordField struct {
	Name   *string `json:"name,omitempty"`
	Value  *string `json:"value,omitempty"`
	Inline *bool   `json:"inline,omitempty"`
}

type DiscordFooter

type DiscordFooter struct {
	Text    *string `json:"text,omitempty"`
	IconUrl *string `json:"icon_url,omitempty"`
}

type DiscordImage

type DiscordImage struct {
	Url *string `json:"url,omitempty"`
}

type DiscordMessage

type DiscordMessage struct {
	Username        *string          `json:"username,omitempty"`
	AvatarUrl       *string          `json:"avatar_url,omitempty"`
	Content         *string          `json:"content,omitempty"`
	DiscordEmbeds   *[]DiscordEmbed  `json:"embeds,omitempty"`
	AllowedMentions *AllowedMentions `json:"allowed_mentions,omitempty"`
}

type DiscordThumbnail

type DiscordThumbnail struct {
	Url *string `json:"url,omitempty"`
}

type SlackAction

type SlackAction struct {
	Type  string `json:"type"`
	Text  string `json:"text"`
	Url   string `json:"url"`
	Style string `json:"style"`
}

type SlackAttachment

type SlackAttachment struct {
	Fallback     *string        `json:"fallback"`
	Color        *string        `json:"color"`
	PreText      *string        `json:"pretext"`
	AuthorName   *string        `json:"author_name"`
	AuthorLink   *string        `json:"author_link"`
	AuthorIcon   *string        `json:"author_icon"`
	Title        *string        `json:"title"`
	TitleLink    *string        `json:"title_link"`
	Text         *string        `json:"text"`
	ImageUrl     *string        `json:"image_url"`
	SlackFields  []*SlackField  `json:"fields"`
	Footer       *string        `json:"footer"`
	FooterIcon   *string        `json:"footer_icon"`
	Timestamp    *int64         `json:"ts"`
	MarkdownIn   *[]string      `json:"mrkdwn_in"`
	SlackActions []*SlackAction `json:"actions"`
	CallbackID   *string        `json:"callback_id"`
	ThumbnailUrl *string        `json:"thumb_url"`
}

type SlackField

type SlackField struct {
	Title string `json:"title"`
	Value string `json:"value"`
	Short bool   `json:"short"`
}

type SlackPayload

type SlackPayload struct {
	Parse            string            `json:"parse,omitempty"`
	Username         string            `json:"username,omitempty"`
	IconUrl          string            `json:"icon_url,omitempty"`
	IconEmoji        string            `json:"icon_emoji,omitempty"`
	Channel          string            `json:"channel,omitempty"`
	Text             string            `json:"text,omitempty"`
	LinkNames        string            `json:"link_names,omitempty"`
	SlackAttachments []SlackAttachment `json:"attachments,omitempty"`
	UnfurlLinks      bool              `json:"unfurl_links,omitempty"`
	UnfurlMedia      bool              `json:"unfurl_media,omitempty"`
	Markdown         bool              `json:"mrkdwn,omitempty"`
}

type TelegramPayload

type TelegramPayload struct {
	ChatID                string `json:"chat_id"`
	Text                  string `json:"text"`
	ParseMode             string `json:"parse_mode,omitempty"`
	DisableWebPagePreview bool   `json:"disable_web_page_preview,omitempty"`
	DisableNotification   bool   `json:"disable_notification,omitempty"`
	ReplyToMessageID      int    `json:"reply_to_message_id,omitempty"`
}

type WebhookData

type WebhookData struct {
	Title       string             `json:"title"`
	Url         string             `json:"url"`
	Description string             `json:"description"`
	Fields      []WebhookDataField `json:"fields"`
}

type WebhookDataField

type WebhookDataField struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type WebhookLevel

type WebhookLevel string
const (
	WebhookLevelError               WebhookLevel = "error"
	WebhookLevelWarning             WebhookLevel = "warning"
	WebhookLevelInfo                WebhookLevel = "info"
	WebhookLevelDeploymentQueued    WebhookLevel = "queued"
	WebhookLevelDeploymentBuilding  WebhookLevel = "building"
	WebhookLevelDeploymentSucceeded WebhookLevel = "succeeded"
	WebhookLevelDeploymentFailed    WebhookLevel = "failed"
)

func (*WebhookLevel) DecimalColor

func (self *WebhookLevel) DecimalColor() *string

func (WebhookLevel) Emoji

func (level WebhookLevel) Emoji() string

Emoji indicator for the ones not supporting style (telegram)

func (WebhookLevel) HexColor

func (level WebhookLevel) HexColor() *string

Helper method for WebhookLevel to return Slack color

type WebhooksService

type WebhooksService struct {
	// contains filtered or unexported fields
}

Integrate webhooks management with internal permissions and kubernetes RBAC

func (*WebhooksService) CreateWebhook

func (self *WebhooksService) CreateWebhook(ctx context.Context, requesterUserID uuid.UUID, input *models.WebhookCreateInput) (*models.WebhookResponse, error)

func (*WebhooksService) DeleteWebhook

func (self *WebhooksService) DeleteWebhook(ctx context.Context, requesterUserID uuid.UUID, webhookType schema.WebhookType, id, teamID uuid.UUID, projectID *uuid.UUID) error

func (*WebhooksService) DetectTargetFromURL

func (self *WebhooksService) DetectTargetFromURL(urlStr string) (schema.WebhookTarget, error)

func (*WebhooksService) GetWebhookByID

func (self *WebhooksService) GetWebhookByID(ctx context.Context, requesterUserID uuid.UUID, input *models.WebhookGetInput) (*models.WebhookResponse, error)

func (*WebhooksService) ListWebhooks

func (self *WebhooksService) ListWebhooks(ctx context.Context, requesterUserID uuid.UUID, input *models.WebhookListInput) ([]*models.WebhookResponse, error)

func (*WebhooksService) TriggerWebhooks

func (self *WebhooksService) TriggerWebhooks(ctx context.Context, level WebhookLevel, event schema.WebhookEvent, message WebhookData) error

func (*WebhooksService) UpdateWebhook

func (self *WebhooksService) UpdateWebhook(ctx context.Context, requesterUserID uuid.UUID, input *models.WebhookUpdateInput) (*models.WebhookResponse, error)

Jump to

Keyboard shortcuts

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