events

package
v0.0.0-...-0600186 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const EVENT_ACCEPT_HEADER = "application/vnd.com.nsn.cumulocity.eventApi+json"

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateEvent

type CreateEvent struct {
	Type             string                 `json:"type"`
	Time             time.Time              `json:"time"`
	Text             string                 `json:"text"`
	Source           Source                 `json:"source"`
	AdditionalFields map[string]interface{} `jsonc:"flat"`
}

application/vnd.com.nsn.cumulocity.event+json

type Event

type Event struct {
	Id               string                 `json:"id"`
	Type             string                 `json:"type"`
	Time             time.Time              `json:"time"`
	CreationTime     time.Time              `json:"creationTime"`
	Text             string                 `json:"text"`
	Source           Source                 `json:"source"`
	Self             string                 `json:"self"`
	AdditionalFields map[string]interface{} `jsonc:"flat"`
}

---- Event application/vnd.com.nsn.cumulocity.event+json

type EventCollection

type EventCollection struct {
	Next       string                    `json:"next"`
	Self       string                    `json:"self"`
	Prev       string                    `json:"prev"`
	Events     []Event                   `json:"events" jsonc:"collection"`
	Statistics *generic.PagingStatistics `json:"statistics"`
}

application/vnd.com.nsn.cumulocity.eventCollection+json ---- EventCollection

func (*EventCollection) CurrentPage

func (c *EventCollection) CurrentPage() int

type EventQuery

type EventQuery struct {
	DateFrom     *time.Time
	DateTo       *time.Time
	FragmentType string
	Type         string
	Source       string
	PageSize     int
}

func (EventQuery) QueryParams

func (q EventQuery) QueryParams() (string, *generic.Error)

type Events

type Events interface {
	// Create a new event and returns the created entity with
	// id and creation time
	CreateEvent(event *CreateEvent) (*Event, *generic.Error)

	// Updated an exiting event and returns the updated event entity.
	UpdateEvent(eventId string, event *UpdateEvent) (*Event, *generic.Error)

	// Deletes an exiting event. If error is nil, the event was deleted
	// successfully.
	DeleteEvent(eventId string) *generic.Error

	// Gets an exiting event by its id. If the id does not exists, nil is returned.
	Get(eventId string) (*Event, *generic.Error)

	// Gets a event collection by a source (aka managed object id).
	GetForDevice(source string, pageSize int) (*EventCollection, *generic.Error)

	// Returns an event collection, found by the given event query parameters.
	// all query parameters are AND concat.
	Find(query EventQuery) (*EventCollection, *generic.Error)

	// Gets the next page from an existing event collection.
	// If there is no next page, nil is returned.
	NextPage(c *EventCollection) (*EventCollection, *generic.Error)

	// Gets the previous page from an existing event collection.
	// If there is no previous page, nil is returned.
	PreviousPage(c *EventCollection) (*EventCollection, *generic.Error)
}

func NewEventsApi

func NewEventsApi(client generic.Client) Events

Creates a new events api object client - Must be a gomulocity client. returns - The `Events`-api object

type Source

type Source struct {
	Id   string `json:"id"`
	Self string `json:"self,omitempty"`
}

type UpdateEvent

type UpdateEvent struct {
	Text             string                 `json:"text"`
	AdditionalFields map[string]interface{} `jsonc:"flat"`
}

Jump to

Keyboard shortcuts

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