domain

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EMailMessage

type EMailMessage struct {
	Subject string   `json:"subject,omitempty"`
	Text    string   `json:"text,omitempty"`
	To      []string `json:"to,omitempty"`
}

EMailMessage holds data required to send emails

type Feed

type Feed struct {
	// a string composed by concatenating the UID, a "|" and a flavour
	ID string `json:"id" firestore:"-"`

	// A higher sequence number means that it came later
	SequenceNumber int `json:"sequenceNumber" firestore:"sequenceNumber"`

	// user identifier - who does this feed belong to?
	// this is also the unique identifier for a feed
	UID string `json:"uid" firestore:"uid"`

	// whether this is a consumer or pro feed
	Flavour feedlib.Flavour `json:"flavour" firestore:"flavour"`

	// what are the global actions available to this user?
	Actions []feedlib.Action `json:"actions" firestore:"actions"`

	// what does this user's feed contain?
	Items []feedlib.Item `json:"items" firestore:"items"`

	// what prompts or nudges should this user see?
	Nudges []feedlib.Nudge `json:"nudges" firestore:"nudges"`

	// indicates whether the user is Anonymous or not
	IsAnonymous *bool `json:"isAnonymous" firestore:"isAnonymous"`
}

Feed manages and serializes the nudges, actions and feed items that a specific user should see.

A feed is stored and serialized on a per-user basis. If a feed item is sent to a group of users, it should be "expanded" before the user's feed gets stored.

func (Feed) GetID

func (fe Feed) GetID() string

GetID return the feed ID

func (Feed) IsEntity

func (fe Feed) IsEntity()

IsEntity marks a feed as an Apollo federation GraphQL entity

func (*Feed) ValidateAndMarshal

func (fe *Feed) ValidateAndMarshal() ([]byte, error)

ValidateAndMarshal validates against the JSON schema then marshals to JSON

func (*Feed) ValidateAndUnmarshal

func (fe *Feed) ValidateAndUnmarshal(b []byte) error

ValidateAndUnmarshal checks that the input data is valid as per the relevant JSON schema and unmarshals it if it is

type GhostCMSAuthor

type GhostCMSAuthor struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Slug         string `json:"slug"`
	ProfileImage string `json:"profile_image"`
	Website      string `json:"website"`
	Location     string `json:"location"`
	Facebook     string `json:"facebook"`
	Twitter      string `json:"twitter"`
	URL          string `json:"url"`
}

GhostCMSAuthor is used to serialize authors of Ghost CMS posts

type GhostCMSPost

type GhostCMSPost struct {
	ID            string           `json:"id"`
	UUID          string           `json:"uuid"`
	Slug          string           `json:"slug"`
	Title         string           `json:"title"`
	HTML          string           `json:"html"`
	Excerpt       string           `json:"excerpt"`
	URL           string           `json:"url"`
	FeatureImage  string           `json:"feature_image"`
	Featured      bool             `json:"featured"`
	Visibility    string           `json:"visibility"`
	ReadingTime   int              `json:"reading_time"`
	CreatedAt     time.Time        `json:"created_at"`
	UpdatedAt     time.Time        `json:"updated_at"`
	PublishedAt   time.Time        `json:"published_at"`
	CommentID     string           `json:"comment_id"`
	Tags          []GhostCMSTag    `json:"tags"`
	Authors       []GhostCMSAuthor `json:"authors"`
	PrimaryAuthor GhostCMSAuthor   `json:"primary_author"`
	PrimaryTag    GhostCMSTag      `json:"primary_tag"`
}

GhostCMSPost is the body of the post sourced from Ghost CMS

func (GhostCMSPost) IsEntity

func (g GhostCMSPost) IsEntity()

IsEntity marks a Ghost CMS post as an entity

type GhostCMSServerResponse

type GhostCMSServerResponse struct {
	Posts []*GhostCMSPost `json:"posts"`
}

GhostCMSServerResponse assembles the posts fetched from a Ghost server, for serialization

type GhostCMSTag

type GhostCMSTag struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	Slug        string  `json:"slug"`
	Description *string `json:"description"`
	Visibility  string  `json:"visibility"`
	URL         string  `json:"url"`
}

GhostCMSTag represents the structure of a Ghost CMS tag

func (GhostCMSTag) IsEntity

func (g GhostCMSTag) IsEntity()

IsEntity marks a Ghost CMS tag as an entity

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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