service

package
v0.0.0-...-ae1d368 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	ID          int64  `json:"id"`
	TeamID      int64  `json:"teamId"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Collection is the API representation of a collection

func NewCollectionFromModel

func NewCollectionFromModel(collectionModel *model.Collection) *Collection

NewCollectionFromModel creates a HTTP representation of a model collection

func (*Collection) MarshalJSON

func (collection *Collection) MarshalJSON() ([]byte, error)

MarshalJSON marshals a JSON string from the API representation

func (*Collection) ToModel

func (collection *Collection) ToModel() *model.Collection

ToModel creates a storage model from the API representation

type LifeCycleEvent

type LifeCycleEvent struct {
	Type event.EventType       `json:"type"`
	Data LifecycleEventDetails `json:"data"`
}

LifeCycleEvent wraps an event with a type identifier to help distinguish the event from other events

type LifecycleEvent

type LifecycleEvent struct {
	Type event.EventType       `json:"type"`
	Data LifecycleEventDetails `json:"data"`
}

LifecycleEvent wraps an event with a type to help distinguish the event

func NewLifecycleEventFromModel

func NewLifecycleEventFromModel(lifecycleEventModel *event.LifeCycleEvent) *LifecycleEvent

NewLifecycleEventFromModel returns a new service LifecycleEvent from a model

type LifecycleEventDetails

type LifecycleEventDetails struct {
	Type       event.LifeCycleEventType `json:"type"`
	EntityType event.EntityType         `json:"entityType"`
	EntityID   int64                    `json:"entityId"`
}

LifecycleEventDetails is a struct to be used for events triggered by a lifecycle change

type OutputEntry

type OutputEntry struct {
	Type   sub.OutputType `json:"type"`
	Config output.Config  `json:"config"`
}

OutputEntry contains information about the subscriptions output

type Position

type Position struct {
	ID        int64    `json:"id"`
	TrackerID int64    `json:"trackerId"`
	Timestamp *int64   `json:"timestamp"`
	Lat       *float64 `json:"lat"`
	Long      *float64 `json:"lng"`
	Alt       *float64 `json:"alt"`
	Heading   *float64 `json:"heading"`
	Speed     *float64 `json:"speed"`
	Payload   []byte   `json:"payload"`
	Precision *float64 `json:"precision"`
}

Position is the API representation of a position

func NewPosition

func NewPosition() Position

NewPosition returns a Position with default params

func NewPositionFromModel

func NewPositionFromModel(positionModel *model.Position) *Position

NewPositionFromModel creates a HTTP representation of a model collection

func (*Position) MarshalJSON

func (position *Position) MarshalJSON() ([]byte, error)

MarshalJSON marshals a JSON string from the API representation

func (*Position) ToModel

func (position *Position) ToModel() *model.Position

ToModel creates a storage model from the API representation

type PositionEvent

type PositionEvent struct {
	Type event.EventType      `json:"type"`
	Data PositionEventDetails `json:"data"`
}

PositionEvent wraps an event with a type to help distinguish the event

func NewPositionEventFromModel

func NewPositionEventFromModel(positionEventModel *event.PositionEvent) *PositionEvent

NewPositionEventFromModel returns a new service PositionEvent from a model

func (*PositionEvent) EventType

func (positionEvent *PositionEvent) EventType() event.EventType

EventType returns the Position event type

type PositionEventDetails

type PositionEventDetails struct {
	CollectionID int64     `json:"collectionId"`
	TrackerID    int64     `json:"trackerId"`
	Position     *Position `json:"position"`
}

PositionEventDetails is a struct to be used for events triggered by a new position

type Shape

type Shape struct {
	ID                int64                    `json:"id"`
	ShapeCollectionID int64                    `json:"shapeCollectionId"`
	Name              string                   `json:"name"`
	Properties        geometry.ShapeProperties `json:"properties"`
}

Shape is the API representation of a shape

func NewShapeFromModel

func NewShapeFromModel(shapeModel *model.Shape) *Shape

NewShapeFromModel creates a HTTP representation of a model shape

func (*Shape) MarshalJSON

func (shape *Shape) MarshalJSON() ([]byte, error)

MarshalJSON marshals a JSON string from the API representation

func (*Shape) ToModel

func (shape *Shape) ToModel() *model.Shape

ToModel creates a storage model from the API representation

type ShapeCollection

type ShapeCollection struct {
	ID          int64  `json:"id"`
	TeamID      int64  `json:"teamId"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

ShapeCollection is the API representation of a shape collection

func NewShapeCollectionFromModel

func NewShapeCollectionFromModel(shapeCollectionModel *model.ShapeCollection) *ShapeCollection

NewShapeCollectionFromModel creates a HTTP representation of a model shape collection

func (*ShapeCollection) MarshalJSON

func (shapeCollection *ShapeCollection) MarshalJSON() ([]byte, error)

MarshalJSON marshals a JSON string from the API representation

func (*ShapeCollection) ToModel

func (shapeCollection *ShapeCollection) ToModel() *model.ShapeCollection

ToModel creates a storage model from the API representation

type Subscription

type Subscription struct {
	ID                int64           `json:"id"`
	TeamID            *int64          `json:"teamId"`
	Name              string          `json:"name"`
	Description       string          `json:"description"`
	Active            bool            `json:"active"`
	Output            OutputEntry     `json:"output"`
	TriggerCriteria   TriggerCriteria `json:"triggerCriteria"`
	ShapeCollectionID *int64          `json:"shapeCollectionId"`
	Trackable         TrackableEntry  `json:"trackable"`
}

Subscription is a representation of subscription for a collection or tracker towards a output

func NewSubscription

func NewSubscription() Subscription

NewSubscription returns a new instance of Subscription

func NewSubscriptionFromModel

func NewSubscriptionFromModel(subscriptionModel *model.Subscription) *Subscription

NewSubscriptionFromModel creates a HTTP representation of a model subscription

func (*Subscription) MarshalJSON

func (subscription *Subscription) MarshalJSON() ([]byte, error)

MarshalJSON marshals a JSON string from the API representation

func (*Subscription) ToModel

func (subscription *Subscription) ToModel() *model.Subscription

ToModel creates a storage model from the API representation

type SubscriptionEvent

type SubscriptionEvent struct {
	Type event.EventType          `json:"type"`
	Data SubscriptionEventDetails `json:"data"`
}

SubscriptionEvent wraps an event with a type to help distinguish the event

func NewSubscriptionEventFromModel

func NewSubscriptionEventFromModel(subscriptionEvent *event.SubscriptionEvent) *SubscriptionEvent

NewSubscriptionEventFromModel returns a new service SubscriptionEvent from a model

func (*SubscriptionEvent) EventType

func (subscriptionEvent *SubscriptionEvent) EventType() event.EventType

EventType returns the Position event type

type SubscriptionEventDetails

type SubscriptionEventDetails struct {
	SubscriptionID int64          `json:"subscriptionId"`
	Position       *Position      `json:"position"`
	Details        TriggerDetails `json:"details"`
}

SubscriptionEventDetails is a struct to be used for events triggered by a new position

type Team

type Team struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Team is the API representation of a team

func NewTeamFromModel

func NewTeamFromModel(teamModel *model.Team) *Team

NewTeamFromModel creates a HTTP representation of a model team

func (*Team) MarshalJSON

func (team *Team) MarshalJSON() ([]byte, error)

MarshalJSON marshals a JSON string from the API representation

func (*Team) ToModel

func (team *Team) ToModel() *model.Team

ToModel creates a storage model from the API representation

type Token

type Token struct {
	Token     string    `json:"token"`
	Created   time.Time `json:"created"`
	Resource  string    `json:"resource"`
	PermWrite bool      `json:"permWrite"`
	UserID    int64     `json:"-"`
}

Token is the API representation of a token

func NewTokenFromModel

func NewTokenFromModel(tokenModel *model.Token) *Token

NewTokenFromModel creates a HTTP representation of a model token

func (*Token) GenerateToken

func (t *Token) GenerateToken() error

GenerateToken overwrites the current token value with a random generated hex string

func (*Token) MarshalJSON

func (token *Token) MarshalJSON() ([]byte, error)

MarshalJSON marshals a JSON string from the API representation

func (*Token) ToModel

func (token *Token) ToModel() *model.Token

ToModel creates a storage model from the API representation

type TrackableEntry

type TrackableEntry struct {
	Type sub.TrackableType `json:"type"`
	ID   *int64            `json:"id"`
}

TrackableEntry contains information about the subscriptions trackable

type Tracker

type Tracker struct {
	ID           int64  `json:"id"`
	CollectionID int64  `json:"collectionId"`
	Name         string `json:"name"`
	Description  string `json:"description"`
}

Tracker is the API representation of a tracker

func NewTrackerFromModel

func NewTrackerFromModel(trackerModel *model.Tracker) *Tracker

NewTrackerFromModel creates a HTTP representation of a model tracker

func (*Tracker) MarshalJSON

func (tracker *Tracker) MarshalJSON() ([]byte, error)

MarshalJSON marshals a JSON string from the API representation

func (*Tracker) ToModel

func (tracker *Tracker) ToModel() *model.Tracker

ToModel creates a storage model from the API representation

type TriggerCriteria

type TriggerCriteria struct {
	TriggerTypes sub.MovementList   `json:"triggerTypes"`
	Confidence   sub.ConfidenceList `json:"confidence"`
}

TriggerCriteria contains information about the

type TriggerDetails

type TriggerDetails struct {
	Movements         []string `json:"movements"`
	ShapecollectionID int64    `json:"shapeCollectionId"`
	ShapeID           int64    `json:"shapeId"`
}

TriggerDetails contains information about why the subscription triggered along with IDs to shapecollection and shape

type User

type User struct {
	ID            int64     `json:"id"`
	Name          string    `json:"name"`
	Email         string    `json:"email"`
	EmailVerified bool      `json:"emailVerified"`
	Phone         string    `json:"phone"`
	PhoneVerified bool      `json:"phoneVerified"`
	Created       time.Time `json:"created"`
}

User is the API representation of a user

func NewUserFromModel

func NewUserFromModel(userModel *model.User) *User

NewUserFromModel creates a HTTP representation of a model user

func (*User) MarshalJSON

func (user *User) MarshalJSON() ([]byte, error)

MarshalJSON marshals a JSON string from the API representation

type WebsocketKeepAlive

type WebsocketKeepAlive struct {
	Type string `json:"type"`
}

WebsocketKeepAlive is a simple keepAlive heartbeat to be used to keep a long lived websocket connection going

func NewWebsocketKeepAlive

func NewWebsocketKeepAlive() *WebsocketKeepAlive

NewWebsocketKeepAlive returns a default heartbeat websocket keepAlive struct

Jump to

Keyboard shortcuts

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