webhooks

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidWebhook = errors.New("invalid webhook, metadata is empty")

ErrInvalidWebhook is returned when the webhook is invalid and cannot be processed by the processor due to missing metadata key

Functions

func New

func New() *processor

New creates a new webhooks processor instance

Types

type GithubSponsorTier

type GithubSponsorTier struct {
	CreatedAt             time.Time `json:"created_at"`
	Description           string    `json:"description"`
	MonthlyPriceInCents   int       `json:"monthly_price_in_cents"`
	MonthlyPriceInDollars int       `json:"monthly_price_in_dollars"`
	Name                  string    `json:"name"`
	IsOneTime             bool      `json:"is_one_time"`
	IsCustomAmount        bool      `json:"is_custom_amount"`
}

type GithubSponsorship

type GithubSponsorship struct {
	CreatedAt   time.Time `json:"created_at"`
	Sponsorable struct {
		Login     string `json:"login"`
		ID        int    `json:"id"`
		AvatarURL string `json:"avatar_url"`
		Type      string `json:"type"`
	} `json:"sponsorable"`
	Sponsor struct {
		Login     string `json:"login"`
		ID        int    `json:"id"`
		AvatarURL string `json:"avatar_url"`
		Type      string `json:"type"`
	} `json:"sponsor"`
	PrivacyLevel string            `json:"privacy_level"`
	Tier         GithubSponsorTier `json:"tier"`
}

type GithubSponsorshipWebhook

type GithubSponsorshipWebhook struct {
	// The action that was performed. This can be one of created, cancelled,
	// edited, tier_changed, pending_cancellation, or pending_tier_change.
	// Note: The created action is only triggered after payment is processed.
	Action      string            `json:"action"`
	Sponsorship GithubSponsorship `json:"sponsorship"`
	// The user that triggered the event.
	Sender struct {
		Login string `json:"login"`
		ID    int    `json:"id"`
	} `json:"sender"`
	// The pending_cancellation and pending_tier_change event types will
	// include the date the cancellation or tier change will take effect.
	EffectiveDate time.Time `json:"effective_date"`
	// The tier_changed and pending_tier_change will include the original
	// tier before the change or pending change. For more information,
	// see the pending tier change payload.
	Changes struct {
		Tier struct {
			From GithubSponsorTier `json:"from"`
		} `json:"tier"`
		// The edited event types include the details about the change when
		// someone edits a sponsorship to change the privacy.
		PrivacyLevel string `json:"privacy_level"`
	} `json:"changes"`
}

Jump to

Keyboard shortcuts

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