webhook

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseMapToAttributes

func ParseMapToAttributes(cid string, attrMap map[string]any, fileAttributes map[string]any) ([]aa.PostKV, error)

ParseMapToAttributes parses a map and a file stat map to a slice of attributes for POSTing to the AA server It also reads the encryption keys from the filesystem, if fields are put under "private" key. Note that all keys under "private" are promoted to top level in encrypted form

func Run

func Run(args []string) error

Run the webhook server

Types

type BrowsertrixCrawlFinishedResponse

type BrowsertrixCrawlFinishedResponse struct {
	OrgID     string `json:"orgId"`
	ItemID    string `json:"itemId"`
	Resources []struct {
		Name        string `json:"name"`
		Path        string `json:"path"`
		Hash        string `json:"hash"`
		Crc32       int    `json:"crc32"`
		Size        int64  `json:"size"`
		CrawlID     string `json:"crawlId"`
		NumReplicas int    `json:"numReplicas"`
		ExpireAt    string `json:"expireAt"`
	} `json:"resources"`
	State string `json:"state"`
	Event string `json:"event"`
}

type CrawlInfoResponse

type CrawlInfoResponse struct {
	ID          string `json:"id"`
	Type        string `json:"type"`
	Userid      string `json:"userid"`
	UserName    string `json:"userName"`
	Oid         string `json:"oid"`
	Profileid   string `json:"profileid"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Started     string `json:"started"`
	Finished    string `json:"finished"`
	State       string `json:"state"`
	Stats       struct {
		Found int `json:"found"`
		Done  int `json:"done"`
		Size  int `json:"size"`
	} `json:"stats"`
	FileSize      int      `json:"fileSize"`
	FileCount     int      `json:"fileCount"`
	Tags          []string `json:"tags"`
	Errors        []string `json:"errors"`
	CollectionIds []string `json:"collectionIds"`
}

type LoginResponse

type LoginResponse struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
}

type PostGenericWebhookOpt

type PostGenericWebhookOpt struct {
	Source    string // Source is the origin of the asset, which is used to determine the webhook endpoint
	ProjectId string // ProjectId is the project specific ID where the asset belongs
	Format    string // Format is "json" or "cbor"
}

PostWebhookOpt is the options for posting a file to the webhook server

type PostGenericWebhookResponse

type PostGenericWebhookResponse struct {
	Cid   string `json:"cid,omitempty"`
	Error error  `json:"error,omitempty"`
}

func PostFileToWebHook

func PostFileToWebHook(file io.Reader, metadata map[string]any, opts PostGenericWebhookOpt) (*PostGenericWebhookResponse, error)

PostFileToWebHook posts a file and its metadata to the webhook server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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