schema

package
v0.0.0-...-0dfd57a Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package schema provides simple JSON-LD type annotations for structs.

Index

Constants

View Source
const (
	EventStatusSingular   = "singular"
	EventStatusInProgress = "in_progress"
	EventStatusStarted    = "started"
	EventStatusEnded      = "ended"
)

Variables

This section is empty.

Functions

func Fill

func Fill(thing interface{}) interface{}

Types

type Action

type Action struct {
	*Thing
	Reply         string      `json:"reply,omitempty"`
	ReplyNegative string      `json:"reply_neg,omitempty"`
	Name          string      `json:"name,omitempty"`
	Payload       interface{} `json:"p,omitempty"`
	Style         string      `json:"style,omitempty"`
}

type Attachment

type Attachment struct {
	*Thing

	Fallback string `json:"fallback,omitempty"`
	Color    string `json:"color,omitempty"`
	Pretext  string `json:"pretext,omitempty"`

	AuthorName string `json:"author_name,omitempty"`
	AuthorLink string `json:"author_link,omitempty"`
	AuthorIcon string `json:"author_icon,omitempty"`

	Title     string            `json:"title,omitempty"`
	TitleLink string            `json:"title_link,omitempty"`
	Fields    []AttachmentField `json:"fields,omitempty"`
	Text      string            `json:"text,omitempty"`

	ImageUrl   string `json:"image_url,omitempty"`
	ThumbUrl   string `json:"thumb_url,omitempty"`
	Footer     string `json:"footer,omitempty"`
	FooterIcon string `json:"footer_icon,omitempty"`

	Time    time.Time     `json:"time,omitempty"`
	Actions []interface{} `json:"actions,omitempty"`
}

type AttachmentField

type AttachmentField struct {
	Title string `json:"title,omitempty"`
	Value string `json:"value,omitempty"`
	Short bool   `json:"short,omitempty"`
}

type CancelAction

type CancelAction Action

type ConfirmAction

type ConfirmAction Action

type Content

type Content struct {
	*Thing
	Url       string `json:"url,omitempty"`
	PutAction string `json:"put_action,omitempty"`
	Type      string `json:"type,omitempty"`
	Name      string `json:"name,omitempty"`

	Data []byte `json:"-"`
}

func (Content) HasData

func (c Content) HasData() bool

type DeleteAction

type DeleteAction Action

type Event

type Event struct {
	Timestamp   time.Time              `json:"timestamp,omitempty"`
	Subject     string                 `json:"subject,omitempty"`
	SubjectType string                 `json:"subject_type,omitempty"`
	Verb        string                 `json:"verb,omitempty"`
	Object      string                 `json:"object,omitempty"`
	ObjectType  string                 `json:"object_type,omitempty"`
	Status      string                 `json:"status,omitempty"`
	Source      string                 `json:"source,omitempty"`
	Text        string                 `json:"-"`
	Meta        map[string]interface{} `json:"meta,omitempty" sql:"-"`
}

type Geofence

type Geofence struct {
	LatMin  float64 `json:"lat_min,omitempty"`
	LatMax  float64 `json:"lat_max,omitempty"`
	LngMin  float64 `json:"lng_min,omitempty"`
	LngMax  float64 `json:"lng_max,omitempty"`
	Name    string  `json:"name,omitempty"`
	Address string  `json:"address,omitempty"`
}

type GeofenceChange

type GeofenceChange struct {
	Location Location `json:"loc,omitempty"`
	Fence    Geofence `json:"fence,omitempty"`
	Status   string   `json:"status,omitempty"`
}

func (GeofenceChange) Text

func (m GeofenceChange) Text() string

type Location

type Location struct {
	Timestamp time.Time `json:"timestamp,omitempty"`
	Latitude  float64   `json:"latitude,omitempty"`
	Longitude float64   `json:"longitude,omitempty"`
	Accuracy  float64   `json:"accuracy,omitempty"`
	Source    string    `json:"source,omitempty"`
	Address   string    `json:"address,omitempty"`
}

func (Location) Text

func (l Location) Text() string

type MultipleChoiceAction

type MultipleChoiceAction struct {
	Action
	Choices map[string]interface{} `json:"choices,omitempty"`
}

type MusicInfo

type MusicInfo struct {
	IsPlaying bool      `json:"is_playing"`
	Device    string    `json:"device,omitempty"`
	Time      time.Time `json:"time,omitempty"`

	Artist   string `json:"artist,omitempty"`
	Album    string `json:"album,omitempty"`
	Track    string `json:"track,omitempty"`
	Duration int    `json:"duration,omitempty"`
}

type TextEntryAction

type TextEntryAction Action

type Thing

type Thing struct {
	SchemaContext string `json:"@context,omitempty"`
	SchemaType    string `json:"@type,omitempty"`
	SchemaId      string `json:"@id,omitempty"`
	SchemaLabel   string `json:"rdfs:label,omitempty"`
}

Jump to

Keyboard shortcuts

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