tasks

package
v1.48.4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Emit = delay.Func("webhook-emit", func(ctx context.Context, org string, event string, data interface{}) {
	log.JSON(fmt.Sprintf("Emit webhook '%s' for '%s'", event, org), data, ctx)

	db := datastore.New(ctx)
	db.SetNamespace(org)

	hooks := make([]*webhook.Webhook, 0)
	_, err := webhook.Query(db).GetAll(&hooks)
	if err != nil {
		log.Warn("Failed to retrieve webhooks for organization '%s': %v", org, err, ctx)
	}

	if len(hooks) == 0 {
		log.Debug("No webhooks defined for organization '%s'", org, ctx)
		return
	}

	client := createClient(ctx)

	for _, hook := range hooks {

		if hook.All {
			client.Post(hook.Url, Payload{
				Data:        data,
				AccessToken: hook.AccessToken,
			})
			continue
		}

		if enabled, ok := hook.Events[event]; ok && enabled {
			client.Post(hook.Url, Payload{
				Data:        data,
				AccessToken: hook.AccessToken,
			})
		}
	}
})

Fire webhooks

Functions

This section is empty.

Types

type Client

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

func (*Client) Post

func (c *Client) Post(url string, data interface{}) error

type Payload

type Payload struct {
	Data        interface{} `json:"data"`
	AccessToken string      `json:"accessToken"`
}

Jump to

Keyboard shortcuts

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