webhook

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 2 Imported by: 3

Documentation

Overview

Package webhook provides the support for reading and parsing the events sent from DNSimple via webhook.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	dnsimple.Account

	// Display is a string that can be used as a display label
	// and it is sent in a webhook payload
	// It generally represent the name of the account.
	Display string `json:"display,omitempty"`

	// Identifier is a human-readable string identifier
	// and it is sent in a webhook payload
	// It generally represent the StringID or email of the account.
	Identifier string `json:"identifier,omitempty"`
}

Account represents the account that this event is attached to.

type AccountEventData added in v0.30.0

type AccountEventData struct {
	Account *dnsimple.Account `json:"account"`
}

AccountEventData represents the data node for an Account event.

type AccountMembershipEventData added in v0.63.0

type AccountMembershipEventData struct {
	Account           *dnsimple.Account           `json:"account"`
	AccountInvitation *dnsimple.AccountInvitation `json:"account_invitation"`
	User              *dnsimple.User              `json:"user"`
}

AccountMembershipEventData represents the data node for an Account event.

type Actor

type Actor struct {
	ID     string `json:"id"`
	Entity string `json:"entity"`
	Pretty string `json:"pretty"`
}

Actor represents the entity that triggered the event. It can be either an user, a DNSimple support representative or the DNSimple system.

type CertificateEventData added in v0.30.0

type CertificateEventData struct {
	Certificate *dnsimple.Certificate `json:"certificate"`
}

CertificateEventData represents the data node for a Certificate event.

type ContactEventData added in v0.30.0

type ContactEventData struct {
	Contact *dnsimple.Contact `json:"contact"`
}

ContactEventData represents the data node for a Contact event.

type DNSSECEventData added in v0.30.0

type DNSSECEventData struct {
	DelegationSignerRecord *dnsimple.DelegationSignerRecord `json:"delegation_signer_record"`
}

DNSSECEventData represents the data node for a DNSSEC event.

type DomainEventData added in v0.30.0

type DomainEventData struct {
	Auto       bool                 `json:"auto"`
	Domain     *dnsimple.Domain     `json:"domain"`
	Registrant *dnsimple.Contact    `json:"registrant"`
	Delegation *dnsimple.Delegation `json:"name_servers"`
}

DomainEventData represents the data node for a Domain event.

type DomainRegistrantChangeEventData added in v1.4.1

type DomainRegistrantChangeEventData struct {
	Domain     *dnsimple.Domain  `json:"domain"`
	Registrant *dnsimple.Contact `json:"registrant"`
}

DomainRegistrantChangegEventData represents the data node for a DomainRegistrantChange event.

type DomainTransferLockEventData added in v1.4.1

type DomainTransferLockEventData struct {
	Domain *dnsimple.Domain `json:"domain"`
}

DomainTransferLockEventData represents the data node for a DomainTransferLockEnable or DomainTransferLockDisable event.

type EmailForwardEventData added in v0.30.0

type EmailForwardEventData struct {
	EmailForward *dnsimple.EmailForward `json:"email_forward"`
}

EmailForwardEventData represents the data node for a EmailForward event.

type Event

type Event struct {
	APIVersion string   `json:"api_version"`
	RequestID  string   `json:"request_identifier"`
	Name       string   `json:"name"`
	Actor      *Actor   `json:"actor"`
	Account    *Account `json:"account"`
	// contains filtered or unexported fields
}

Event represents a webhook event.

func ParseEvent added in v0.30.0

func ParseEvent(payload []byte) (*Event, error)

ParseEvent takes an event payload and attempts to deserialize the payload into an Event.

The event data will be set with a data type that matches the event action in the payload. If no direct match is found, then a GenericEventData is assigned.

The event data type is an EventContainerData interface. Therefore, you must perform typecasting to access any type-specific field.

func (*Event) GetData added in v0.30.0

func (e *Event) GetData() EventDataContainer

GetData returns the data container for the specific event type.

func (*Event) GetPayload added in v0.20.0

func (e *Event) GetPayload() []byte

GetPayload returns the data payload.

type EventDataContainer added in v0.30.0

type EventDataContainer interface {
	// contains filtered or unexported methods
}

EventDataContainer defines the container for the event payload data.

type GenericEventData added in v0.30.0

type GenericEventData map[string]interface{}

GenericEventData represents the data node for a generic event, where the data is a simple map of strings.

type WebhookEventData added in v0.30.0

type WebhookEventData struct {
	Webhook *dnsimple.Webhook `json:"webhook"`
}

WebhookEventData represents the data node for a Webhook event.

type WhoisPrivacyEventData added in v0.30.0

type WhoisPrivacyEventData struct {
	Domain       *dnsimple.Domain       `json:"domain"`
	WhoisPrivacy *dnsimple.WhoisPrivacy `json:"whois_privacy"`
}

WhoisPrivacyEventData represents the data node for a WhoisPrivacy event.

type ZoneEventData added in v0.30.0

type ZoneEventData struct {
	Zone *dnsimple.Zone `json:"zone"`
}

ZoneEventData represents the data node for a Zone event.

type ZoneRecordEventData added in v0.30.0

type ZoneRecordEventData struct {
	ZoneRecord *dnsimple.ZoneRecord `json:"zone_record"`
}

ZoneRecordEventData represents the data node for a ZoneRecord event.

Jump to

Keyboard shortcuts

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