feedlib

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 12 Imported by: 69

README

Build Status Maintained MIT license Linting and Tests Coverage Status

Feed Library

feedlib is an open source project — it's one among many other shared libraries that make up the wider ecosystem of software made and open sourced by Savannah Informatics Limited.

A shared library for Be.Well Golang services that is responsible for rendering user-feed and engagement.

Installing it

feedlib is compatible with modern Go releases in module mode, with Go installed:

go get -u github.com/savannahghi/feedlib

will resolve and add the package to the current development module, along with its dependencies.

Alternatively the same can be achieved if you use import in a package:

import "github.com/savannahghi/feedlib"

and run go get without parameters.

The package name is feedlib

Developing

The default branch library is main

We try to follow semantic versioning ( https://semver.org/ ). For that reason, every major, minor and point release should be tagged.

git tag -m "v0.0.1" "v0.0.1"
git push --tags

Continuous integration tests must pass on Travis CI. Our coverage threshold is 90% i.e you must keep coverage above 90%.

Environment variables

In order to run tests, you need to have an env.sh file similar to this one:

# Application settings
export SCHEMA_HOST=<optional>

This file must not be committed to version control.

It is important to export the environment variables. If they are not exported, they will not be visible to child processes e.g go test ./....

These environment variables should also be set up on Travis CI environment variable section.

Contributing

Contributions are of course always welcome. The calling pattern is pretty well established, so adding new methods is relatively straightforward. See CONTRIBUTING.md for details.

Versioning

In general, feedlib follows semver as closely as we can for tagging releases of the package. For self-contained libraries, the application of semantic versioning is relatively straightforward and generally understood. We've adopted the following versioning policy:

  • We increment the major version with any incompatible change to non-preview functionality, including changes to the exported Go API surface or behavior of the API.
  • We increment the minor version with any backwards-compatible changes to functionality, as well as any changes to preview functionality in the GitHub API. GitHub makes no guarantee about the stability of preview functionality, so neither do we consider it a stable part of the go-github API.
  • We increment the patch version with any backwards-compatible bug fixes.

License

This library is distributed under the MIT license found in the LICENSE file.

Documentation

Index

Constants

View Source
const (
	LogoURL                    = "https://assets.healthcloud.co.ke/bewell_logo.png"
	BlankImageURL              = "https://assets.healthcloud.co.ke/1px.png"
	SampleVideoURL             = "https://www.youtube.com/watch?v=bPiofmZGb8o"
	FallbackSchemaHost         = "https://schema.healthcloud.co.ke"
	SchemaHostEnvVarName       = "SCHEMA_HOST"
	LinkSchemaFile             = "link.schema.json"
	MessageSchemaFile          = "message.schema.json"
	ActionSchemaFile           = "action.schema.json"
	NudgeSchemaFile            = "nudge.schema.json"
	ItemSchemaFile             = "item.schema.json"
	FeedSchemaFile             = "feed.schema.json"
	ContextSchemaFile          = "context.schema.json"
	PayloadSchemaFile          = "payload.schema.json"
	EventSchemaFile            = "event.schema.json"
	StatusSchemaFile           = "status.schema.json"
	VisibilitySchemaFile       = "visibility.schema.json"
	NotificationBodySchemaFile = "notificationbody.schema.json"
)

defaults

Variables

AllActionType has the known set of action types

AllChannel is the set of all supported notification channels

View Source
var AllFlavour = []Flavour{
	FlavourPro,
	FlavourConsumer,
}

AllFlavour is a set of all valid flavours

AllHandling is the set of all valid handling strategies

AllKeys is the set of all valid feed keys

AllLinkType is the set of all known link types

AllStatus is the set of known statuses

AllTextType is the set of all known text types

AllVisibility is the set of all known visibility values

IsValid is a set of known boolean filters

Functions

func ValidateAndMarshal

func ValidateAndMarshal(sch string, el Element) ([]byte, error)

ValidateAndMarshal marshals a feed element to JSON, checks it against the indicated schema file and returns it if it is valid.

func ValidateAndUnmarshal

func ValidateAndUnmarshal(sch string, b []byte, el Element) error

ValidateAndUnmarshal validates JSON against a named feed schema file then unmarshals it into the supplied feed element, which should be a pointer.

Types

type Action

type Action struct {
	// A unique identifier for each action
	ID string `json:"id" firestore:"id"`

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

	// A friendly name for the action; rich text with Unicode, can have emoji
	Name string `json:"name" firestore:"name"`

	// A link to a PNG image that would serve as an avatar
	Icon Link `json:"icon" firestore:"icon"`

	// Action types are: primary, secondary, overflow and floating
	// Primary actions get dominant visual treatment;
	// secondary actions less so;
	// overflow actions are hidden;
	// floating actions are material FABs
	ActionType ActionType `json:"actionType" firestore:"actionType"`

	// How the action should be handled e.g inline or full page.
	// This is a hint for frontend logic.
	Handling Handling `json:"handling" firestore:"handling"`

	// indicated whether this action should or can be triggered by na anoymous user
	AllowAnonymous bool `json:"allowAnonymous" firestore:"allowAnonymous"`
}

Action represents the global and non-global actions that a user can see/do

func (Action) IsEntity

func (ac Action) IsEntity()

IsEntity marks this as an Apollo federation GraphQL entity

func (*Action) ValidateAndMarshal

func (ac *Action) ValidateAndMarshal() ([]byte, error)

ValidateAndMarshal validates against JSON schema then marshals to JSON

func (*Action) ValidateAndUnmarshal

func (ac *Action) 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 ActionType

type ActionType string

ActionType defines the types for global actions

const (
	ActionTypePrimary   ActionType = "PRIMARY"
	ActionTypeSecondary ActionType = "SECONDARY"
	ActionTypeOverflow  ActionType = "OVERFLOW"
	ActionTypeFloating  ActionType = "FLOATING"
)

the known action types are constants

func (ActionType) IsValid

func (e ActionType) IsValid() bool

IsValid returns true only for valid action types

func (ActionType) MarshalGQL

func (e ActionType) MarshalGQL(w io.Writer)

MarshalGQL writes an action type to the supplied writer

func (ActionType) String

func (e ActionType) String() string

func (*ActionType) UnmarshalGQL

func (e *ActionType) UnmarshalGQL(v interface{}) error

UnmarshalGQL reads an action type from GQL

type BooleanFilter

type BooleanFilter string

BooleanFilter defines true/false/both for filtering against bools

const (
	BooleanFilterTrue  BooleanFilter = "TRUE"
	BooleanFilterFalse BooleanFilter = "FALSE"
	BooleanFilterBoth  BooleanFilter = "BOTH"
)

known boolean filter value

func (BooleanFilter) IsValid

func (e BooleanFilter) IsValid() bool

IsValid returns True if the boolean filter value is valid

func (BooleanFilter) MarshalGQL

func (e BooleanFilter) MarshalGQL(w io.Writer)

MarshalGQL writes the bool value to the supplied writer

func (BooleanFilter) String

func (e BooleanFilter) String() string

func (*BooleanFilter) UnmarshalGQL

func (e *BooleanFilter) UnmarshalGQL(v interface{}) error

UnmarshalGQL reads the bool value in from input

type Channel

type Channel string

Channel represents a notification challen

const (
	ChannelFcm      Channel = "FCM"
	ChannelEmail    Channel = "EMAIL"
	ChannelSms      Channel = "SMS"
	ChannelWhatsapp Channel = "WHATSAPP"
)

known notification channels

func (Channel) IsValid

func (e Channel) IsValid() bool

IsValid returns True only for a valid channel

func (Channel) MarshalGQL

func (e Channel) MarshalGQL(w io.Writer)

MarshalGQL writes the channel to the supplied writer

func (Channel) String

func (e Channel) String() string

func (*Channel) UnmarshalGQL

func (e *Channel) UnmarshalGQL(v interface{}) error

UnmarshalGQL converts the supplied input into a channel value

type Context

type Context struct {
	// the system or human user that created this event
	UserID string `json:"userID" firestore:"userID"`

	// the flavour of the feed/app that originated this event
	Flavour Flavour `json:"flavour" firestore:"flavour"`

	// the client (organization) that this user belongs to
	OrganizationID string `json:"organizationID" firestore:"organizationID"`

	// the location (e.g branch) from which the event was sent
	LocationID string `json:"locationID" firestore:"locationID"`

	// when this event was sent
	Timestamp time.Time `json:"timestamp" firestore:"timestamp"`
}

Context identifies when/where/why/who/what/how an event occurred.

func (*Context) ValidateAndMarshal

func (ct *Context) ValidateAndMarshal() ([]byte, error)

ValidateAndMarshal validates against JSON schema then marshals to JSON

func (*Context) ValidateAndUnmarshal

func (ct *Context) 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 Element

type Element interface {
	ValidateAndUnmarshal(b []byte) error
	ValidateAndMarshal() ([]byte, error)
}

Element is a building block of a feed e.g a nudge, action, feed item etc An element should know how to validate itself against it's JSON schema

type Event

type Event struct {
	// A unique identifier for each action
	ID string `json:"id" firestore:"id"`

	// An event name - two upper case words separated by an underscore
	Name string `json:"name" firestore:"name"`

	// Technical metadata - when/where/why/who/what/how etc
	Context Context `json:"context,omitempty" firestore:"context,omitempty"`

	// The actual 'business data' carried by the event
	Payload Payload `json:"payload,omitempty" firestore:"payload,omitempty"`
}

Event An event indicating that this action was triggered

func (Event) IsEntity

func (ev Event) IsEntity()

IsEntity marks this as an Apollo federation GraphQL entity

func (*Event) ValidateAndMarshal

func (ev *Event) ValidateAndMarshal() ([]byte, error)

ValidateAndMarshal validates against JSON schema then marshals to JSON

func (*Event) ValidateAndUnmarshal

func (ev *Event) 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 Flavour

type Flavour string

Flavour is the flavour of a feed i.e consumer or pro

const (
	FlavourPro      Flavour = "PRO"
	FlavourConsumer Flavour = "CONSUMER"
)

known flavours

func (Flavour) IsValid

func (e Flavour) IsValid() bool

IsValid returns True if a feed is valid

func (Flavour) MarshalGQL

func (e Flavour) MarshalGQL(w io.Writer)

MarshalGQL writes the flavour to the supplied writer

func (Flavour) String

func (e Flavour) String() string

func (*Flavour) UnmarshalGQL

func (e *Flavour) UnmarshalGQL(v interface{}) error

UnmarshalGQL translates and validates the input flavour

type Handling

type Handling string

Handling determines whether an action is handled INLINE or

const (
	HandlingInline   Handling = "INLINE"
	HandlingFullPage Handling = "FULL_PAGE"
)

known action handling strategies

func (Handling) IsValid

func (e Handling) IsValid() bool

IsValid returns true only for valid handling strategies

func (Handling) MarshalGQL

func (e Handling) MarshalGQL(w io.Writer)

MarshalGQL writes the Handling value to the supplied writer

func (Handling) String

func (e Handling) String() string

func (*Handling) UnmarshalGQL

func (e *Handling) UnmarshalGQL(v interface{}) error

UnmarshalGQL reads and validates a handling value from the supplied input

type Item

type Item struct {
	// A unique identifier for each feed item
	ID string `json:"id" firestore:"id"`

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

	// When this feed item should be expired/removed, automatically. RFC3339.
	Expiry time.Time `json:"expiry" firestore:"expiry"`

	// If a feed item is persistent, it also goes to the inbox
	// AND triggers a push notification.
	// Pinning a feed item makes it persistent.
	Persistent bool `json:"persistent" firestore:"persistent"`

	// Whether the task under a feed item is completed, pending etc
	Status Status `json:"status" firestore:"status"`

	// Whether the feed item is to be shown or hidden
	Visibility Visibility `json:"visibility" firestore:"visibility"`

	// A link to a PNG image that would serve as an avatar
	Icon Link `json:"icon" firestore:"icon"`

	// The person - real or robot - that generated this feed item. Rich text.
	Author string `json:"author" firestore:"author"`

	// An OPTIONAL second title line. Rich text.
	Tagline string `json:"tagline" firestore:"tagline"`

	// A label e.g for the queue that this item belongs to
	Label string `json:"label" firestore:"label"`

	// When this feed item was created. RFC3339.
	// This is used to calculate the feed item's age for display.
	Timestamp time.Time `json:"timestamp" firestore:"timestamp"`

	// An OPTIONAL summary line. Rich text.
	Summary string `json:"summary" firestore:"summary"`

	// Rich text that can include any unicode e.g emoji
	Text string `json:"text" firestore:"text"`

	// TextType determines how the frontend will render the text
	TextType TextType `json:"textType" firestore:"textType"`

	// an illustrative image for the item
	Links []Link `json:"links" firestore:"links"`

	// Actions are the primary, secondary and overflow actions associated
	// with a feed item
	Actions []Action `json:"actions,omitempty" firestore:"actions,omitempty"`

	// Conversations are messages and replies around a feed item
	Conversations []Message `json:"conversations,omitempty" firestore:"conversations,omitempty"`

	// Identifiers of all the users that got this message
	Users []string `json:"users,omitempty" firestore:"users,omitempty"`

	// Identifiers of all the groups that got this message
	Groups []string `json:"groups,omitempty" firestore:"groups,omitempty"`

	// How the user should be notified of this new item, if at all
	NotificationChannels []Channel `json:"notificationChannels,omitempty" firestore:"notificationChannels,omitempty"`

	// FeatureImage represents the image associated to a post
	FeatureImage string `json:"feature_image"`
}

Item is a single item in a feed or in an inbox

func (Item) IsEntity

func (it Item) IsEntity()

IsEntity marks this as an Apollo federation GraphQL entity

func (*Item) ValidateAndMarshal

func (it *Item) ValidateAndMarshal() ([]byte, error)

ValidateAndMarshal validates against JSON schema then marshals to JSON

func (*Item) ValidateAndUnmarshal

func (it *Item) 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 Keys

type Keys string

Keys are the top level keys in a feed

const (
	KeysActions Keys = "actions"
	KeysNudges  Keys = "nudges"
	KeysItems   Keys = "items"
)

known feed keys

func (Keys) IsValid

func (e Keys) IsValid() bool

IsValid returns true if a feed key is valid

func (Keys) MarshalGQL

func (e Keys) MarshalGQL(w io.Writer)

MarshalGQL writes the feed key to the supplied writer

func (Keys) String

func (e Keys) String() string

func (*Keys) UnmarshalGQL

func (e *Keys) UnmarshalGQL(v interface{}) error

UnmarshalGQL translates a feed key from a string

type Link struct {
	// A unique identifier for each feed item
	ID string `json:"id" firestore:"id"`

	// A URL at which the video can be accessed.
	// For a private video, the URL should include authentication information.
	URL string `json:"url" firestore:"url"`

	// LinkType of link
	LinkType LinkType `json:"linkType" firestore:"linkType"`

	// name or title of the linked item
	Title string `json:"title" firestore:"title"`

	// details about the linked item
	Description string `json:"description" firestore:"description"`

	// A URL to a PNG image that represents a thumbnail for the item
	Thumbnail string `json:"thumbnail" firestore:"thumbnail"`
}

Link holds references to media that is part of the feed. The URL should embed authentication details. The treatment will depend on the specified asset type.

func GetMP4Link(url string, title string, description string, thumbnailURL string) Link

GetMP4Link returns an initialized MP4 link.

It is used in testing and default data generation.

func GetPDFDocumentLink(url string, title string, description string, thumbnailURL string) Link

GetPDFDocumentLink returns an initialized PDF document link.

It is used in testing and default data generation.

func GetPNGImageLink(url string, title string, description string, thumbnailURL string) Link

GetPNGImageLink returns an initialized PNG image link.

It is used in testing and default data generation.

func GetSVGImageLink(url string, title string, description string, thumbnailURL string) Link

GetSVGImageLink returns an initialized PNG image link.

It is used in testing and default data generation.

func GetYoutubeVideoLink(url string, title string, description string, thumbnailURL string) Link

GetYoutubeVideoLink returns an initialized YouTube video link.

It is used in testing and default data generation.

func (*Link) ValidateAndMarshal

func (l *Link) ValidateAndMarshal() ([]byte, error)

ValidateAndMarshal validates against JSON schema then marshals to JSON

func (*Link) ValidateAndUnmarshal

func (l *Link) 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 LinkType

type LinkType string

LinkType determines how a linked asset is handled on the feed

const (
	LinkTypeYoutubeVideo LinkType = "YOUTUBE_VIDEO"
	LinkTypePngImage     LinkType = "PNG_IMAGE"
	LinkTypePdfDocument  LinkType = "PDF_DOCUMENT"
	LinkTypeSvgImage     LinkType = "SVG_IMAGE"
	LinkTypeMp4          LinkType = "MP4"
	LinkTypeDefault      LinkType = "DEFAULT"
)

known link types

func (LinkType) IsValid

func (e LinkType) IsValid() bool

IsValid is true only when a link type is avalid

func (LinkType) MarshalGQL

func (e LinkType) MarshalGQL(w io.Writer)

MarshalGQL writes a link type to the supplied writer

func (LinkType) String

func (e LinkType) String() string

func (*LinkType) UnmarshalGQL

func (e *LinkType) UnmarshalGQL(v interface{}) error

UnmarshalGQL reads a link type from the supplied input

type Message

type Message struct {
	// A unique identifier for each message on the thread
	ID string `json:"id" firestore:"id"`

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

	// Rich text that can include any unicode e.g emoji
	Text string `json:"text" firestore:"text"`

	// The unique ID of any message that this one is replying to - a thread
	ReplyTo string `json:"replyTo" firestore:"replyTo"`

	// The UID of the user that posted the message
	PostedByUID string `json:"postedByUID" firestore:"postedByUID"`

	// The UID of the user that posted the message
	PostedByName string `json:"postedByName" firestore:"postedByName"`

	// when this message was sent
	Timestamp time.Time `json:"timestamp" firestore:"timestamp"`
}

Message is a message in a thread of conversations attached to a feed item

func (*Message) ValidateAndMarshal

func (msg *Message) ValidateAndMarshal() ([]byte, error)

ValidateAndMarshal validates against JSON schema then marshals to JSON

func (*Message) ValidateAndUnmarshal

func (msg *Message) 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 NotificationBody

type NotificationBody struct {
	// Human readable rich text sent when an item/nudge is published to a user's Feed
	PublishMessage string `json:"publishMessage" firestore:"publishMessage"`

	// Human readable rich text sent when item/nudge is deleted to a user's Feed
	DeleteMessage string `json:"deleteMessage" firestore:"deleteMessage"`

	// Human readable rich text sent when a user does a RESOLVE action
	ResolveMessage string `json:"resolveMessage" firestore:"resolveMessage"`

	// Human readable rich text sent when a user does an UNRESOLVE action
	UnresolveMessage string `json:"unresolveMessage" firestore:"unresolveMessage"`

	// Human readable rich text sent when a user does a SHOW action
	ShowMessage string `json:"showMessage" firestore:"showMessage"`

	// Human readable rich text sent when a user does a HIDE action
	HideMessage string `json:"hideMessage" firestore:"hideMessage"`
}

NotificationBody represents human readable messages sent in notifications

func (*NotificationBody) IsEntity

func (nb *NotificationBody) IsEntity()

IsEntity marks this as an Apollo federation GraphQL entity

func (*NotificationBody) ValidateAndMarshal

func (nb *NotificationBody) ValidateAndMarshal() ([]byte, error)

ValidateAndMarshal validates against JSON schema then marshals to JSON

func (*NotificationBody) ValidateAndUnmarshal

func (nb *NotificationBody) 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 Nudge

type Nudge struct {
	// A unique identifier for each nudge
	ID string `json:"id" firestore:"id"`

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

	// Visibility determines if a nudge should be visible or not
	Visibility Visibility `json:"visibility" firestore:"visibility"`

	// whether the nudge is done (acted on) or pending
	Status Status `json:"status" firestore:"status"`

	// When this nudge should be expired/removed, automatically. RFC3339.
	Expiry time.Time `json:"expiry" firestore:"expiry"`

	// the title (lead line) of the nudge
	Title string `json:"title" firestore:"title"`

	// the text/copy of the nudge
	Text string `json:"text" firestore:"text"`

	// an illustrative image for the nudge
	Links []Link `json:"links" firestore:"links"`

	// actions to include on the nudge
	Actions []Action `json:"actions" firestore:"actions"`

	// Identifiers of all the users that got this message
	Users []string `json:"users,omitempty" firestore:"users,omitempty"`

	// Identifiers of all the groups that got this message
	Groups []string `json:"groups,omitempty" firestore:"groups,omitempty"`

	// How the user should be notified of this new item, if at all
	NotificationChannels []Channel `json:"notificationChannels,omitempty" firestore:"notificationChannels,omitempty"`

	// Text/Message the user will see in their notifications body when an action is performed on a nudge
	NotificationBody NotificationBody `json:"notificationBody,omitempty" firestore:"notificationBody,omitempty"`
}

Nudge represents a "prompt" for a user e.g to set a PIN

func (Nudge) IsEntity

func (nu Nudge) IsEntity()

IsEntity marks this as an Apollo federation GraphQL entity

func (*Nudge) ValidateAndMarshal

func (nu *Nudge) ValidateAndMarshal() ([]byte, error)

ValidateAndMarshal verifies against JSON schema then marshals to JSON

func (*Nudge) ValidateAndUnmarshal

func (nu *Nudge) 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 Payload

type Payload struct {
	Data map[string]interface{} `json:"data" firestore:"data"`
}

Payload carries the actual 'business data' carried by the event. It varies from event to event.

func (*Payload) ValidateAndMarshal

func (pl *Payload) ValidateAndMarshal() ([]byte, error)

ValidateAndMarshal validates against JSON schema then marshals to JSON

func (*Payload) ValidateAndUnmarshal

func (pl *Payload) 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 Status

type Status string

Status is the set of known statuses for feed items and nudges

const (
	StatusPending    Status = "PENDING"
	StatusInProgress Status = "IN_PROGRESS"
	StatusDone       Status = "DONE"
)

known item and nudge statuses

func (Status) IsValid

func (e Status) IsValid() bool

IsValid returns true if a status is valid

func (Status) MarshalGQL

func (e Status) MarshalGQL(w io.Writer)

MarshalGQL writes the status to the supplied writer

func (Status) String

func (e Status) String() string

func (*Status) UnmarshalGQL

func (e *Status) UnmarshalGQL(v interface{}) error

UnmarshalGQL translates the input value given into a status

type TextType

type TextType string

TextType determines how clients render the text

const (
	TextTypeHTML     TextType = "HTML"
	TextTypeMarkdown TextType = "MARKDOWN"
	TextTypePlain    TextType = "PLAIN"
)

known text types

func (TextType) IsValid

func (e TextType) IsValid() bool

IsValid returns true only for valid text types

func (TextType) MarshalGQL

func (e TextType) MarshalGQL(w io.Writer)

MarshalGQL writes the text type to the supplied writer

func (TextType) String

func (e TextType) String() string

func (*TextType) UnmarshalGQL

func (e *TextType) UnmarshalGQL(v interface{}) error

UnmarshalGQL translates the supplied interface into a text type

type Visibility

type Visibility string

Visibility defines the visibility statuses of feed items

const (
	VisibilityShow Visibility = "SHOW"
	VisibilityHide Visibility = "HIDE"
)

known visibility values

func (Visibility) IsValid

func (e Visibility) IsValid() bool

IsValid returns true if a visibility value is valid

func (Visibility) MarshalGQL

func (e Visibility) MarshalGQL(w io.Writer)

MarshalGQL writes a visibility value into the supplied writer

func (Visibility) String

func (e Visibility) String() string

func (*Visibility) UnmarshalGQL

func (e *Visibility) UnmarshalGQL(v interface{}) error

UnmarshalGQL reads and validates a visibility value

Jump to

Keyboard shortcuts

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