webhooks

package
v0.0.0-...-10388f3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventActionCreated             = "created"
	EventActionEdited              = "edited"
	EventActionTierChanged         = "tier_changed"
	EventActionPendingCancellation = "pending_cancellation"
	EventActionCancelled           = "cancelled"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Changes

type Changes struct {
	// Tier appears only in "tier_changed" events
	Tier *TierChange `json:"tier,omitempty"`

	// PrivacyLevel appears only in "edited" events
	PrivacyLevel *PrivacyLevelChange `json:"privacy_level,omitempty"`
}

Changes field appears only in "edited" and "tier_changed" events. Describes what changes were made to the tier.

type Handler

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

func NewHandler

func NewHandler(queue queue.Queue) *Handler

func (*Handler) Handle

func (handler *Handler) Handle(context *web.Context) web.Status

type Person

type Person struct {
	Login             string `json:"login"`
	ID                int    `json:"id"`
	NodeID            string `json:"node_id"`
	AvatarURL         string `json:"avatar_url"`
	GravatarID        string `json:"gravatar_id"`
	URL               string `json:"url"`
	HTMLURL           string `json:"html_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	OrganizationsURL  string `json:"organizations_url"`
	ReposURL          string `json:"repos_url"`
	EventsURL         string `json:"events_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	Type              string `json:"type"`
	SiteAdmin         bool   `json:"site_admin"`
}

type PrivacyLevelChange

type PrivacyLevelChange struct {
	From string `json:"from"`
}

PrivacyLevelChange appears only when a user changes privacy level of the subscription. It might happen at the same with tier_changed event, but it will produce two events.

type Sponsorship

type Sponsorship struct {
	// DeliveryID is not an original field. It's an additional field added by the handler.
	DeliveryID string `json:"delivery_id"`

	Action string `json:"action"`

	Sponsorship SponsorshipDetails `json:"sponsorship"`

	// EffectiveDate appears only in "pending_cancellation" events
	// The value of this field is not yet completely understood.
	// CreatedAt = 2020-10-23T06:57:19+00:00
	// EffectiveDate = 2020-10-27T00:00:00+00:00
	EffectiveDate *time.Time `json:"effective_date,omitempty"`

	Sender Person `json:"sender"`

	Changes *Changes `json:"changes,omitempty"`
}

The following struct is missing in github.com/google/go-github https://developer.github.com/v3/activity/event_types/#sponsorshipevent https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads#sponsorship

func (*Sponsorship) IsPrivacyLevelChanged

func (sponsorship *Sponsorship) IsPrivacyLevelChanged() bool

func (*Sponsorship) IsTierChanged

func (sponsorship *Sponsorship) IsTierChanged() bool

type SponsorshipDetails

type SponsorshipDetails struct {
	NodeID       string    `json:"node_id"`
	CreatedAt    time.Time `json:"created_at"`
	Sponsorable  Person    `json:"sponsorable"`
	Maintainer   Person    `json:"maintainer"`
	Sponsor      Person    `json:"sponsor"`
	PrivacyLevel string    `json:"privacy_level"`
	Tier         Tier      `json:"tier"`
}

type Tier

type Tier struct {
	NodeID                string    `json:"node_id"`
	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"`
}

type TierChange

type TierChange struct {
	From Tier `json:"from"`
}

TierChange appears only in "tier_changed" events

Jump to

Keyboard shortcuts

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