convoy

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWebhook

func NewWebhook(url, key, defaultProject string) *webhookService

Types

type CreateEndpointResponse

type CreateEndpointResponse struct {
	Status  bool   `json:"status"`
	Message string `json:"message"`
	Data    struct {
		Uid    string `json:"uid"`
		Status string `json:"status"`
	} `json:"data"`
}

type Endpoint

type Endpoint struct {
	Message string       `json:"message"`
	Status  bool         `json:"status"`
	Data    EndpointData `json:"data"`
}

type EndpointData

type EndpointData struct {
	// Authentication
	// Secrets
	SlackWebhookURL   string     `json:"slack_webhook_url"`
	Status            string     `json:"status"`
	SupportEmail      string     `json:"support_email"`
	UID               string     `json:"uid"`
	UpdatedAt         time.Time  `json:"updated_at"`
	URL               string     `json:"url"`
	CreatedAt         time.Time  `json:"created_at"`
	DeletedAt         *time.Time `json:"deleted_at"`
	Description       string     `json:"description"`
	Events            int64      `json:"events"`
	HttpTimeout       int64      `json:"http_timeout"`
	Name              string     `json:"name"`
	OwnerID           string     `json:"owner_id"`
	ProjectID         string     `json:"project_id"`
	RateLimit         int64      `json:"rate_limit"`
	RateLimitDuration int64      `json:"rate_limit_duration"`
}

type EndpointResponse

type EndpointResponse struct {
	Status  bool   `json:"status"`
	Message string `json:"message"`
}

type EndpointToggleStatus

type EndpointToggleStatus struct {
	Data struct {
		Status string `json:"status"`
	} `json:"data"`
}

type EventDelivery added in v0.1.4

type EventDelivery struct {
	Message string `json:"message"`
	Status  bool   `json:"status"`
	Data    struct {
		Content []EventDeliveryContent `json:"content"`
	} `json:"data"`
}

type EventDeliveryContent added in v0.1.4

type EventDeliveryContent struct {
	CreatedAt time.Time `json:"created_at"`
	// EventID       string    `json:"event_id"`
	Status        string `json:"status"`
	EventMetadata struct {
		EventType string `json:"event_type"`
	} `json:"event_metadata"`
	Metadata struct {
		NumTrials  int64 `json:"num_trials"`
		RetryLimit int64 `json:"retry_limit"`
	} `json:"metadata"`
}

type UpsertEndpointParams

type UpsertEndpointParams struct {
	Name               string `json:"name"`
	URL                string `json:"url"`
	AdvancedSignatures bool   `json:"advanced_signatures"`
	AppID              string `json:"appID"` // deprecated but required
	// Authentication
	Description       string `json:"description"`
	HttpTimeout       int64  `json:"http_timeout"`
	IsDisabled        bool   `json:"is_disabled"`
	OwnerID           string `json:"owner_id"`
	RateLimit         int64  `json:"rate_limit"`
	RateLimitDuration int64  `json:"rate_limit_duration"`
	Secret            string `json:"secret"`
	SlackWebhookURL   string `json:"slack_webhook_url"`
	SupportEmail      string `json:"support_email"`
}

type Webhook

type Webhook struct {
	Data    WebhookData
	Headers map[string][]string
}

type WebhookData

type WebhookData struct {
	Data           interface{} `json:"data"`
	EventType      string      `json:"event_type"`
	EndpointID     string      `json:"endpoint_id"`
	IdempotencyKey string      `json:"idempotency_key"`
}

type WebhookInterface

type WebhookInterface interface {
	GetEndpoint(projectID, endpointID string) (*Endpoint, error)
	CreateEndpoint(projectID string, params UpsertEndpointParams) (*CreateEndpointResponse, error)
	UpdateEndpoint(projectID, endpointID string, params UpsertEndpointParams) (*EndpointResponse, error)
	DeleteEndpoint(projectID, endpointID string) (*EndpointResponse, error)
	TogglePause(projectID, endpointID string) (string, error)
	CreateEvent(projectID string, webhookData *Webhook) error
	GetEndpointEventDeliveries(projectID, endpointID string, itemsPerPage int64) (*EventDelivery, error)
}

Jump to

Keyboard shortcuts

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