resource

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeNone = Type(iota)
	TypeDelivery
	TypeDeliveryKind
	TypeMessage
	TypeMessageKind
	TypeNamespace
	TypeTemplate
	TypeTemplateKind
)

Enumeration of all resource types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delivery

type Delivery struct {
	ID uuid.UUID `json:"id" db:"id"`

	// A reference to the requested message.
	MessageID uuid.UUID `json:"messageId" db:"message_id"`

	// A reference to how the message was delivered.
	DeliveryKindID uuid.UUID `json:"deliveryKindId" db:"delivery_kind_id"`

	// The IETF language tag into which the message content was generated.
	LanguageTag string `json:"languageTag" db:"language_tag"`

	// The current status of the delivery, either `pending`, `delivering`, `delivered`,
	// `undelivered`, or `blocked`.
	Status string `json:"status" db:"status"`

	// Any information about the delivery's current status.
	StatusMessage string `json:"statusMessage" db:"status_message"`

	// The time when the delivery was actually done. A value does not indicate that the delivery was
	// successful - the status field must instead be used for this purpose.
	DeliverTime *time.Time `json:"deliverTime" db:"deliver_time"`

	// The input provided to the requester when the delivery was made, and its resulting output.
	// These may contain sensitive information.
	Input  map[string]interface{} `json:"input" db:"input"`
	Output map[string]interface{} `json:"output" db:"output"`

	// The delivery's identifier from the point of view of the third-party service that
	// performed the actual delivery. This is used when that service performs a callback with more
	// information about the delivery.
	ExternalID string `json:"externalId" db:"external_id"`

	CreateTime time.Time `json:"createTime" db:"create_time,omitempty"`
	UpdateTime time.Time `json:"updateTime" db:"update_time,omitempty"`
}

Delivery defines the attributes related to a delivery.

type DeliveryKind

type DeliveryKind struct {
	ID uuid.UUID `json:"id" db:"id"`

	// A human-readable identifier. Only one delivery kind should be active for a given code.
	Code string `json:"code" db:"code"`

	// A reference to the delivery kind's namespace.
	NamespaceID uuid.UUID `json:"namespaceId" db:"namespace_id"`

	// The deliverer host where it can be reached.
	Host string `json:"host" db:"host"`

	// Whether delivering messages using this delivery kind is blocked.
	Disabled bool `json:"disabled" db:"disabled"`

	CreateTime time.Time `json:"createTime" db:"create_time,omitempty"`
	UpdateTime time.Time `json:"updateTime" db:"update_time,omitempty"`
}

DeliveryKind defines the attributes related to a delivery kind.

type Message

type Message struct {
	ID uuid.UUID `json:"id" db:"id"`

	// A reference to the message's kind.
	MessageKindID uuid.UUID `json:"messageKindId" db:"message_kind_id"`

	// The initial input provided by the user.
	Input map[string]interface{} `json:"input" db:"input"`

	// The current status of the message, either `active`, `scheduled`, `succeeded`, or `failed`.
	Status string `json:"status" db:"status"`

	// The time at which the message is scheduled to be delivered.
	ScheduleTime *time.Time `json:"scheduleTime" db:"schedule_time"`

	CreateTime time.Time `json:"createTime" db:"create_time,omitempty"`
	UpdateTime time.Time `json:"updateTime" db:"update_time,omitempty"`
}

Message defines the attributes related to a message.

type MessageKind

type MessageKind struct {
	ID uuid.UUID `json:"id" db:"id"`

	// A human-readable identifier. Only one message kind should be active for a given code.
	Code string `json:"code" db:"code"`

	// A reference to the message kind's namespace.
	NamespaceID uuid.UUID `json:"namespaceId" db:"namespace_id"`

	// Whether delivering messages using this message kind is blocked.
	Disabled bool `json:"disabled" db:"disabled"`

	CreateTime time.Time `json:"createTime" db:"create_time,omitempty"`
	UpdateTime time.Time `json:"updateTime" db:"update_time,omitempty"`
}

MessageKind defines the attributes related to a message kind.

type Namespace

type Namespace struct {
	ID uuid.UUID `json:"id" db:"id"`

	// A human-readable identifier. Only one namespace should be active for a given code.
	Code string `json:"code" db:"code"`

	ParentID *uuid.UUID `json:"parentId" db:"parent_id"`

	CreateTime time.Time `json:"createTime" db:"create_time,omitempty"`
	UpdateTime time.Time `json:"updateTime" db:"update_time,omitempty"`
}

Namespace defines the attributes related to a namespace.

type Resource

type Resource interface{}

Resource defines the interface for a resource.

type Template

type Template struct {
	ID uuid.UUID `json:"id" db:"id"`

	// A reference to the message kind.
	MessageKindID uuid.UUID `json:"messageKindId" db:"message_kind_id"`

	// A reference to the template kind.
	TemplateKindID uuid.UUID `json:"templateKindId" db:"template_kind_id"`

	// The IETF language tag into which a content should be generated.
	LanguageTag string `json:"languageTag" db:"language_tag"`

	// The template body that will be provided to the template engine.
	Body string `json:"body" db:"body"`

	CreateTime time.Time `json:"createTime" db:"create_time,omitempty"`
	UpdateTime time.Time `json:"updateTime" db:"update_time,omitempty"`
}

Template defines the attributes related to a template that can generate a message.

type TemplateKind

type TemplateKind struct {
	ID uuid.UUID `json:"id" db:"id"`

	// A reference to the delivery kind.
	DeliveryKindID uuid.UUID `json:"deliveryKindId" db:"delivery_kind_id"`

	// The attribute name into which the result will be stored.
	TargetAttr string `json:"targetAttr" db:"target_attr"`

	CreateTime time.Time `json:"createTime" db:"create_time,omitempty"`
	UpdateTime time.Time `json:"updateTime" db:"update_time,omitempty"`
}

TemplateKind defines the attributes related to a template kind.

type Type

type Type int

Type defines the enumerator for resource types.

func (Type) Name

func (t Type) Name() string

Name returns the resource name for the specified resource.

func (Type) New

func (t Type) New() Resource

New returns an empty instance of the resource type.

Jump to

Keyboard shortcuts

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