client

package
v0.0.0-...-8001f1c Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes

type Attributes map[string]interface{}

Attributes used in a bunch of places as a metadata object

type Calendar

type Calendar struct {
	ID         int        `json:"id"`
	Name       string     `json:"name"`
	Data       string     `json:"data"`
	Attributes Attributes `json:"attributes"`
}

Calendar describes a calendar schema object

Data is the base64 encoded ical

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an API client for Traccar

func New

func New(token string, opts ...Option) (*Client, error)

New returns a new API Client for Traccar

func (*Client) CloseSession

func (c *Client) CloseSession() error

CloseSession closes the session

func (*Client) CreateCalendar

func (c *Client) CreateCalendar(calendar Calendar) (Calendar, error)

CreateCalendar creates a Calendar

func (*Client) CreateCommand

func (c *Client) CreateCommand(command Command) (Command, error)

CreateCommand creates a Saved Command

func (*Client) CreateComputedAttribute

func (c *Client) CreateComputedAttribute(attribute ComputedAttribute) (ComputedAttribute, error)

CreateComputedAttribute creates an Attribute

func (*Client) CreateDevice

func (c *Client) CreateDevice(device Device) (Device, error)

CreateDevice creates a Device

func (*Client) CreateDriver

func (c *Client) CreateDriver(driver Driver) (Driver, error)

CreateDriver creates a Driver

func (*Client) CreateGeofence

func (c *Client) CreateGeofence(geofence Geofence) (Geofence, error)

CreateGeofence creates a Geofence

func (*Client) CreateGroup

func (c *Client) CreateGroup(group Group) (Group, error)

CreateGroup creates a Group

Errors:

400 Bad Request - No permission

func (*Client) CreateMaintenance

func (c *Client) CreateMaintenance(maintenance Maintenance) (Maintenance, error)

CreateMaintenance creates a Maintenance

func (*Client) CreateNotification

func (c *Client) CreateNotification(notification Notification) (Notification, error)

CreateNotification creates a Notification

func (*Client) CreatePermission

func (c *Client) CreatePermission(request PermissionsRequest) error

CreatePermission links an Object to another Object

Eg:

CreatePermission(PermitUserID(5).DeviceID(30))

func (*Client) CreateSession

func (c *Client) CreateSession(email, password string) (user User, err error)

CreateSession creates a new session from user credentials

Errors:

401 Unauthorized - Unauthorized

func (*Client) CreateUser

func (c *Client) CreateUser(user User) (User, error)

CreateUser creates a User

func (*Client) DeleteCalendar

func (c *Client) DeleteCalendar(id int) error

DeleteCalendar deletes a Calendar

func (*Client) DeleteCommand

func (c *Client) DeleteCommand(id int) error

DeleteCommand deletes a saved command

func (*Client) DeleteComputedAttribute

func (c *Client) DeleteComputedAttribute(id int) error

DeleteComputedAttribute deletes an Attribute

func (*Client) DeleteDevice

func (c *Client) DeleteDevice(id int) error

DeleteDevice deletes a Device

func (*Client) DeleteDriver

func (c *Client) DeleteDriver(id int) error

DeleteDriver deletes a Driver

func (*Client) DeleteGeofence

func (c *Client) DeleteGeofence(id int) error

DeleteGeofence deletes a Geofence

func (*Client) DeleteGroup

func (c *Client) DeleteGroup(id int) error

DeleteGroup deletes a group

func (*Client) DeleteMaintenance

func (c *Client) DeleteMaintenance(id int) error

DeleteMaintenance deletes a Maintenance

func (*Client) DeleteNotification

func (c *Client) DeleteNotification(id int) error

DeleteNotification deletes a notification

func (*Client) DeletePermission

func (c *Client) DeletePermission(request PermissionsRequest) error

DeletePermission unlinks an Object from another Object

Eg:

DeletePermission(PermitUserID(5).DeviceID(30))

func (*Client) DeleteUser

func (c *Client) DeleteUser(id int) error

DeleteUser deletes a User

func (*Client) FetchSession

func (c *Client) FetchSession(token string) (user User, err error)

FetchSession fetches session information from a token

Errors:

404 Not Found - Not Found

func (*Client) GetEvent

func (c *Client) GetEvent(id int) (event Event, err error)

GetEvent is undocumented

func (*Client) GetReportEvents

func (c *Client) GetReportEvents(params ...QueryParameter) (events []Event, err error)

GetReportEvents Fetch a list of Events within the time period for the Devices or Groups At least one deviceId or one groupId must be passed

Params:

WithDeviceID - multiple parameters can be passed
WithGroupID -  multiple parameters can be passed

type not implemented

WithFrom
WithTo

func (*Client) GetReportRoute

func (c *Client) GetReportRoute(params ...QueryParameter) (route []Position, err error)

GetReportRoute Fetch a list of Positions within the time period for the Devices or Groups At least one deviceId or one groupId must be passed

Params:

WithDeviceID - multiple parameters can be passed
WithGroupID -  multiple parameters can be passed

type not implemented

WithFrom
WithTo

func (*Client) GetReportStops

func (c *Client) GetReportStops(params ...QueryParameter) (stops []ReportStops, err error)

GetReportStops Fetch a list of ReportStops within the time period for the Devices or Groups At least one deviceId or one groupId must be passed

Params:

WithDeviceID - multiple parameters can be passed
WithGroupID -  multiple parameters can be passed

type not implemented

WithFrom
WithTo

func (*Client) GetReportSummary

func (c *Client) GetReportSummary(params ...QueryParameter) (summary []ReportSummary, err error)

GetReportSummary Fetch a list of ReportSummary within the time period for the Devices or Groups At least one deviceId or one groupId must be passed

Params:

WithDeviceID - multiple parameters can be passed
WithGroupID -  multiple parameters can be passed

type not implemented

WithFrom
WithTo

func (*Client) GetReportTrips

func (c *Client) GetReportTrips(params ...QueryParameter) (trips []ReportTrips, err error)

GetReportTrips Fetch a list of ReportTrips within the time period for the Devices or Groups At least one deviceId or one groupId must be passed

Params:

WithDeviceID - multiple parameters can be passed
WithGroupID -  multiple parameters can be passed

type not implemented

WithFrom
WithTo

func (*Client) GetServer

func (c *Client) GetServer() (server Server, err error)

GetServer fetches Server information

func (*Client) GetStatistics

func (c *Client) GetStatistics(params ...QueryParameter) (statistics []Statistics, err error)

GetStatistics fetches server statistics

Params:

WithFrom
WithTo

func (*Client) ListCalendars

func (c *Client) ListCalendars(params ...QueryParameter) (calendars []Calendar, err error)

ListCalendars fetches a list of Calendars Without params, it returns a list of Calendars the user has access to

Params:

WithAll - Can only be used by admins or managers to fetch all entities
WithUserID - Standard users can use this only with their own userId

func (Client) ListCommandTypes

func (c Client) ListCommandTypes(params ...QueryParameter) (commandTypes []CommandType, err error)

ListCommandTypes returns a list of available Commands for the Device or all possible Commands if Device omitted

Params:

WithDeviceID
WithTextChannel

Errors:

400 Bad Request - Could happen when trying to fetch from a device the user does not have permission

func (*Client) ListCommands

func (c *Client) ListCommands(params ...QueryParameter) (commands []Command, err error)

ListCommands fetches a list of Saved Commands Without params, it returns a list of Commands the user has access to

Params:

WithAll - Can only be used by admins or managers to fetch all entities
WithUserID - Standard users can use this only with their own userId
WithDeviceID - Standard users can use this only with _deviceId_s, they have access to
WithGroupID - Standard users can use this only with _groupId_s, they have access to
Refresh

func (*Client) ListComputedAttributes

func (c *Client) ListComputedAttributes(params ...QueryParameter) (attributeList []ComputedAttribute, err error)

ListComputedAttributes fetches a list of Attributes Without params, it returns a list of Attributes the user has access to

Params:

WithAll - Can only be used by admins or managers to fetch all entities
WithUserID - Standard users can use this only with their own userId
WithDeviceID - Standard users can use this only with _deviceId_s, they have access to
WithGroupID - Standard users can use this only with _groupId_s, they have access to
Refresh

func (Client) ListDeviceCommands

func (c Client) ListDeviceCommands(deviceID int) (commands []Command, err error)

ListDeviceCommands fetches a list of Saved Commands supported by Device at the moment This api makes no sense

Errors:

400 Bad Request - Could happen when the user doesn't have permission for the device

func (*Client) ListDevices

func (c *Client) ListDevices(params ...QueryParameter) (deviceList []Device, err error)

ListDevices fetches a list of Devices Without any params, returns a list of the user's devices

Params:

WithAll - Can only be used by admins or managers to fetch all entities
WithUserID - Standard users can use this only with their own userId
WithID - To fetch one or more devices. Multiple params can be passed
WithUniqueID - To fetch one or more devices. Multiple params can be passed

Errors:

400 Bad Request - No permission

func (*Client) ListDrivers

func (c *Client) ListDrivers(params ...QueryParameter) (driverList []Driver, err error)

ListDrivers fetches a list of Drivers Without params, it returns a list of Drivers the user has access to

Params:

WithAll - Can only be used by admins or managers to fetch all entities
WithUserID - Standard users can use this only with their own userId
WithDeviceID - Standard users can use this only with _deviceId_s, they have access to
WithGroupID - Standard users can use this only with _groupId_s, they have access to
Refresh

func (*Client) ListGeofences

func (c *Client) ListGeofences(params ...QueryParameter) (geofences []Geofence, err error)

ListGeofences fetches a list of Geofences Without params, it returns a list of Geofences the user has access to

Params:

WithAll - Can only be used by admins or managers to fetch all entities
WithUserID - Standard users can use this only with their own userId
WithDeviceID - Standard users can use this only with _deviceId_s, they have access to
WithGroupID - Standard users can use this only with _groupId_s, they have access to
Refresh

func (*Client) ListGroups

func (c *Client) ListGroups(params ...QueryParameter) (groups []Group, err error)

ListGroups fetches a list of Groups Without any params, returns a list of the Groups the user belongs to

Params:

WithAll - Can only be used by admins or managers to fetch all entities
WithUserID - Standard users can use this only with their own userId

func (*Client) ListMaintenances

func (c *Client) ListMaintenances(params ...QueryParameter) (maintenances []Maintenance, err error)

ListMaintenances fetches a list of Maintenance Without params, it returns a list of Maintenance the user has access to

Params:

WithAll - Can only be used by admins or managers to fetch all entities
WithUserID - Standard users can use this only with their own userId
WithDeviceID - Standard users can use this only with _deviceId_s, they have access to
WithGroupID - Standard users can use this only with _groupId_s, they have access to
Refresh

func (Client) ListNotificationTypes

func (c Client) ListNotificationTypes() (notificationTypes []NotificationType, err error)

ListNotificationTypes fetches a list of available Notification types

func (*Client) ListNotifications

func (c *Client) ListNotifications(params ...QueryParameter) (notifications []Notification, err error)

ListNotifications fetches a list of Notifications Without params, it returns a list of Notifications the user has access to

Params:

WithAll - Can only be used by admins or managers to fetch all entities
WithUserID - Standard users can use this only with their own userId
WithDeviceID - Standard users can use this only with _deviceId_s, they have access to
WithGroupID - Standard users can use this only with _groupId_s, they have access to
Refresh

func (*Client) ListPositions

func (c *Client) ListPositions(params ...QueryParameter) (positions []Position, err error)

ListPositions fetches a list of Positions Without any params, it returns a list of last known positions for all the user's Devices. from and _to_ fields are not required with _id_

Params:

WithDeviceID - deviceId is optional, but requires the from and _to_ parameters when used
WithFrom
WithTo
WithID - To fetch one or more positions. Multiple params can be passed

func (*Client) ListUsers

func (c *Client) ListUsers(params ...QueryParameter) (users []User, err error)

ListUsers fetches a list of Users

Params:

WithUserId - Can only be used by admin or manager users

Errors:

400 Bad Request - No Permission

func (*Client) SendCommand

func (c *Client) SendCommand(command Command) (Command, error)

SendCommand dispatches commands to device Dispatch a new command or Saved Command if Command.ID set

Errors:

400 Bad Request - Could happen when the user doesn't have permission or an incorrect command type for the device

func (*Client) Stream

func (c *Client) Stream(stop chan struct{}) (chan Message, error)

Stream messages from TRACCAR via websocket

func (Client) TestNotification

func (c Client) TestNotification() error

TestNotification sends test notification to current user via Email and SMS

Errors: 400 Bad Request - Could happen if sending has failed

func (*Client) UpdateCalendar

func (c *Client) UpdateCalendar(id int, calendar Calendar) (Calendar, error)

UpdateCalendar updates a Calendar

func (*Client) UpdateCommand

func (c *Client) UpdateCommand(id int, command Command) (Command, error)

UpdateCommand updates a saved command

func (*Client) UpdateComputedAttribute

func (c *Client) UpdateComputedAttribute(id int, attribute ComputedAttribute) (ComputedAttribute, error)

UpdateComputedAttribute updates an Attribute

func (*Client) UpdateDevice

func (c *Client) UpdateDevice(id int, device Device) (Device, error)

UpdateDevice updates a Device

func (*Client) UpdateDeviceAccumulators

func (c *Client) UpdateDeviceAccumulators(id int, accumulators DeviceAccumulators) error

UpdateDeviceAccumulators updates total distance and hours of the Device

func (*Client) UpdateDriver

func (c *Client) UpdateDriver(id int, driver Driver) (Driver, error)

UpdateDriver updates a Driver

func (*Client) UpdateGeofence

func (c *Client) UpdateGeofence(id int, geofence Geofence) (Geofence, error)

UpdateGeofence updates a Geofence

func (*Client) UpdateGroup

func (c *Client) UpdateGroup(id int, group Group) (Group, error)

UpdateGroup updates a group

func (*Client) UpdateMaintenance

func (c *Client) UpdateMaintenance(id int, maintenance Maintenance) (Maintenance, error)

UpdateMaintenance updates a Maintenance

func (*Client) UpdateNotification

func (c *Client) UpdateNotification(id int, notification Notification) (Notification, error)

UpdateNotification updates a notification

func (*Client) UpdateServer

func (c *Client) UpdateServer(server Server) (Server, error)

UpdateServer updates Server information

func (*Client) UpdateUser

func (c *Client) UpdateUser(id int, user User) (User, error)

UpdateUser updates a user

type Command

type Command struct {
	ID          int        `json:"id"`
	DeviceID    int        `json:"deviceId"`
	Description string     `json:"description"`
	Type        string     `json:"type"`
	SendSMS     bool       `json:"textChannel"`
	Attributes  Attributes `json:"attributes"`
}

Command describes a Command schema object

type CommandType

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

CommandType describes a CommandType schema object

type ComputedAttribute

type ComputedAttribute struct {
	ID          int                   `json:"id"`
	Description string                `json:"description"`
	Attribute   string                `json:"attribute"`
	Expression  string                `json:"expression"`
	Type        ComputedAttributeType `json:"type"`
}

ComputedAttribute describes a ComputedAttribute schema Object

type ComputedAttributeType

type ComputedAttributeType string

ComputedAttributeType is a string type of ComputedAttribute Type

const (
	StringComputedAttribute  ComputedAttributeType = "String"
	NumberComputedAttribute  ComputedAttributeType = "Number"
	BooleanComputedAttribute ComputedAttributeType = "Boolean"
)

Computed attribute types

type Device

type Device struct {
	ID          int           `json:"id"`
	Attributes  Attributes    `json:"attributes"`
	GroupID     int           `json:"groupId"`
	Name        string        `json:"name"`
	UniqueID    string        `json:"uniqueId"`
	Status      string        `json:"status"`
	LastUpdate  string        `json:"lastUpdate"`
	PositionID  int           `json:"positionId"`
	GeofenceIds []interface{} `json:"geofenceIds"`
	Phone       string        `json:"phone"`
	Model       string        `json:"model"`
	Contact     string        `json:"contact"`
	Category    string        `json:"category"`
	Disabled    bool          `json:"disabled"`
}

Device describes a Device schema object

type DeviceAccumulators

type DeviceAccumulators struct {
	DeviceID      int   `json:"deviceId"`
	TotalDistance int64 `json:"totalDistance"`
	Hours         int64 `json:"hours"`
}

DeviceAccumulators describes a DeviceAccumulators object

type Driver

type Driver struct {
	ID         int        `json:"id"`
	Attributes Attributes `json:"attributes"`
	Name       string     `json:"name"`
	UniqueID   string     `json:"uniqueId"`
}

Driver describes a Driver schema object

type Event

type Event struct {
	ID            int        `json:"id"`
	Type          string     `json:"type"`
	ServerTime    time.Time  `json:"serverTime"`
	DeviceID      int        `json:"deviceId"`
	PositionID    int        `json:"positionId"`
	GeofenceID    int        `jsson:"geofenceId"`
	MaintenanceID int        `json:"maintenanceId"`
	Attributes    Attributes `json:"attributes"`
}

Event describes an Event schema object

type Geofence

type Geofence struct {
	ID          int        `json:"id"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Area        string     `json:"area"`
	CalendarID  int        `json:"calendarId"`
	Attributes  Attributes `json:"attributes"`
}

Geofence describes a Geofence schema object

type Group

type Group struct {
	ID         int        `json:"id"`
	Name       string     `json:"name"`
	GroupID    int        `json:"groupId"`
	Attributes Attributes `json:"attributes"`
}

Group describes a Group schema object

type Maintenance

type Maintenance struct {
	ID         int        `json:"id"`
	Name       string     `json:"name"`
	Type       string     `json:"type"`
	Start      int64      `json:"start"`
	Period     int64      `json:"period"`
	Attributes Attributes `json:"attributes"`
}

Maintenance describes a Maintenance schema object

type Message

type Message struct {
	Devices   []Device   `json:"devices"`
	Positions []Position `json:"positions"`
	Events    []Event    `json:"events"`
}

Message is what's received via streaming sockets

type Notification

type Notification struct {
	ID         int        `json:"id"`
	Type       string     `json:"type"`
	Always     bool       `json:"always"`
	Web        bool       `json:"web"`
	Mail       bool       `json:"mail"`
	SMS        bool       `json:"sms"`
	CalendarID int        `json:"calendarId"`
	Attributes Attributes `json:"attributes"`
}

Notification describes a Notification schema object

type NotificationType

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

NotificationType describes a NotificationType schema object

type Option

type Option func(c *Client)

Option is a function that operates on a Client object

func WithBaseURL

func WithBaseURL(uri string) Option

WithBaseURL permits you to pass a base API url to the client consturctor

func WithCookieJar

func WithCookieJar(jar http.CookieJar) Option

WithCookieJar permits you to pass a given cookie jar to the client constructor this is useful if you would prefer to save your cookies to disk Note that if you set this cookie jar and pass one WithHTTPClient than you will return an error if they're not the same jar

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient permits you to pass a non-standard or otherwise tinkered with http.Client object to the client consturctor

type PermissionsRequest

type PermissionsRequest [2]struct {
	// contains filtered or unexported fields
}

PermissionsRequest is placeholder for the json object that's sent as apparently the order of the object fields is iportant.

func (PermissionsRequest) MarshalJSON

func (p PermissionsRequest) MarshalJSON() (result []byte, err error)

MarshalJSON converts the placeholder into json notation for sending

type PermitDeviceID

type PermitDeviceID int

PermitDeviceID will pair a DeviceID with whatever method you call on it

func (PermitDeviceID) AttributeID

func (p PermitDeviceID) AttributeID(id int) PermissionsRequest

AttributeID pairs the given AttributeID with the DeviceID

func (PermitDeviceID) DriverID

func (p PermitDeviceID) DriverID(id int) PermissionsRequest

DriverID pairs the given DriverID with the DeviceID

func (PermitDeviceID) GeofenceID

func (p PermitDeviceID) GeofenceID(id int) PermissionsRequest

GeofenceID pairs the given GeofenceID with the DeviceID

type PermitGroupID

type PermitGroupID int

PermitGroupID will pair a GroupID with whatever method you call on it

func (PermitGroupID) AttributeID

func (p PermitGroupID) AttributeID(id int) PermissionsRequest

AttributeID pairs the given AttributeID with the GroupID

func (PermitGroupID) DriverID

func (p PermitGroupID) DriverID(id int) PermissionsRequest

DriverID pairs the given DriverID with the GroupID

func (PermitGroupID) GeofenceID

func (p PermitGroupID) GeofenceID(id int) PermissionsRequest

GeofenceID pairs the given GeofenceID with the GroupID

type PermitUserID

type PermitUserID int

PermitUserID will pair a UserID with whatever method you call on it

func (PermitUserID) AttributeID

func (p PermitUserID) AttributeID(id int) PermissionsRequest

AttributeID pairs the given AttributeID with the UserID

func (PermitUserID) CalendarID

func (p PermitUserID) CalendarID(id int) PermissionsRequest

CalendarID pairs the given CalendarID with the UserID

func (PermitUserID) DeviceID

func (p PermitUserID) DeviceID(id int) PermissionsRequest

DeviceID pairs the given DeviceID with the UserID

func (PermitUserID) DriverID

func (p PermitUserID) DriverID(id int) PermissionsRequest

DriverID pairs the given DriverID with the UserID

func (PermitUserID) GeofenceID

func (p PermitUserID) GeofenceID(id int) PermissionsRequest

GeofenceID pairs the given GeofenceID with the UserID

func (PermitUserID) GroupID

func (p PermitUserID) GroupID(id int) PermissionsRequest

GroupID pairs the given GroupID with the UserID

func (PermitUserID) ManagedUserID

func (p PermitUserID) ManagedUserID(id int) PermissionsRequest

ManagedUserID pairs the given ManagedUserID with the UserID

type Position

type Position struct {
	ID         int64      `json:"id"`
	Attributes Attributes `json:"attributes"`
	DeviceID   int64      `json:"deviceId"`
	Protocol   string     `json:"protocol"`
	ServerTime time.Time  `json:"serverTime"`
	DeviceTime time.Time  `json:"deviceTime"`
	FixTime    time.Time  `json:"fixTime"`
	Outdated   bool       `json:"outdated"`
	Valid      bool       `json:"valid"`
	Latitude   float64    `json:"latitude"`
	Longitude  float64    `json:"longitude"`
	Altitude   float64    `json:"altitude"`
	Speed      float64    `json:"speed"`
	Course     float64    `json:"course"`
	Address    string     `json:"address"`
	Accuracy   float64    `json:"accuracy"`
	Network    Attributes `json:"network"`
}

Position describes a Position schema object

type QueryParameter

type QueryParameter func(u *url.Values)

QueryParameter is a function that sets a URl value

func WithAll

func WithAll(val bool) QueryParameter

WithAll Can only be used by admins or managers to fetch all entities

func WithDeviceID

func WithDeviceID(val ...int) QueryParameter

WithDeviceID Standard users can use this only with _deviceId_s, they have access to

func WithFrom

func WithFrom(val time.Time) QueryParameter

WithFrom ...

func WithGroupID

func WithGroupID(val ...int) QueryParameter

WithGroupID Standard users can use this only with _groupId_s, they have access to

func WithID

func WithID(val ...int) QueryParameter

WithID to fetch one or more devices. Multiple params can be passed

func WithRefresh

func WithRefresh(val bool) QueryParameter

WithRefresh ...

func WithTextChannel

func WithTextChannel(val bool) QueryParameter

WithTextChannel ...

func WithTo

func WithTo(val time.Time) QueryParameter

WithTo ..

func WithUniqueID

func WithUniqueID(val ...string) QueryParameter

WithUniqueID to fetch one or more devices. Multiple params can be passed

func WithUserID

func WithUserID(val int) QueryParameter

WithUserID Standard users can use this only with their own userId

type ReportStops

type ReportStops struct {
	DeviceID    int       `json:"deviceId"`
	DeviceName  string    `json:"deviceName"`
	Duration    int       `json:"duration"`
	StartTime   time.Time `json:"startTime"`
	Address     string    `json:"address"`
	Lat         float64   `json:"lat"`
	Lon         float64   `json:"lon"`
	EndTime     time.Time `json:"end"`
	SpentFuel   float64   `json:"spentFuel"`
	EngineHours int       `json:"engineHours"`
}

ReportStops describes a ReportStops schema object

type ReportSummary

type ReportSummary struct {
	DeviceID     int     `json:"deviceId"`
	DeviceName   string  `json:"deviceName"`
	MaxSpeed     float64 `json:"maxSpeed"`
	AverageSpeed float64 `json:"averageSpeed"`
	Distance     float64 `json:"distance"`
	SpentFuel    float64 `json:"spentFuel"`
	EngineHours  int     `json:"engineHours"`
}

ReportSummary describes a ReportSummary schema object

type ReportTrips

type ReportTrips struct {
	DeviceID       int       `json:"deviceId"`
	DeviceName     string    `json:"deviceName"`
	MaxSpeed       float64   `json:"maxSpeed"`
	AverageSpeed   float64   `json:"averageSpeed"`
	Distance       float64   `json:"distance"`
	SpentFuel      float64   `json:"spentFuel"`
	Duration       int       `json:"duration"`
	StartTime      time.Time `json:"startTime"`
	StartAddress   string    `json:"startAddress"`
	StartLat       float64   `json:"startLat"`
	StartLon       float64   `json:"startLon"`
	EndTime        time.Time `json:"endTime"`
	EndAddress     string    `json:"endAddress"`
	EndLat         float64   `json:"endLat"`
	EndLon         float64   `json:"endLon"`
	DriverUniqueID int       `json:"driverUniqueId"`
	DriverName     string    `json:"driverName"`
}

ReportTrips describes a ReportTrips schema object

type Server

type Server struct {
	ID               int        `json:"id"`
	Registration     bool       `json:"registration"`
	Readonly         bool       `json:"readonly"`
	DeviceReadonly   bool       `json:"deviceReadonly"`
	LimitCommands    bool       `json:"limitCommands"`
	Map              string     `json:"map"`
	BingKey          string     `json:"bingKey"`
	MapURL           string     `json:"mapUrl"`
	PoiLayer         string     `json:"poiLayer"`
	Latitude         float64    `json:"latitude"`
	Longitude        float64    `json:"longitude"`
	Zoom             int        `json:"zoom"`
	TwelveHourFormat bool       `json:"twelveHourFormat"`
	Version          string     `json:"version"`
	ForceSettings    bool       `json:"forceSettings"`
	CoordinateFormat string     `json:"coordinateFormat"`
	Attributes       Attributes `json:"attributes"`
}

Server describes a Server schema object

type Statistics

type Statistics struct {
	CaptureTime      time.Time `json:"captureTime"`
	ActiveUsers      int       `json:"activeUsers"`
	ActiveDevices    int       `json:"activeDevices"`
	Requests         int       `json:"requests"`
	MessagesReceived int       `json:"messagesReceived"`
	MessagesStored   int       `json:"messagesStored"`
}

Statistics describes a Statistics schema object

type User

type User struct {
	ID               int        `json:"id"`
	Name             string     `json:"name"`
	Email            string     `json:"email"`
	Readonly         bool       `json:"readonly"`
	Administrator    bool       `json:"administrator"`
	Map              string     `json:"map"`
	Latitude         float64    `json:"latitude"`
	Longitude        float64    `json:"longitude"`
	Zoom             int        `json:"zoom"`
	Password         string     `json:"password"`
	TwelveHourFormat bool       `json:"twelveHourFormat"`
	CoordinateFormat string     `json:"coordinateFormat"`
	Disabled         bool       `json:"disabled"`
	ExpirationTime   time.Time  `json:"expirationTime"`
	DeviceLimit      int        `json:"deviceLimit"`
	UserLimit        int        `json:"userLimit"`
	DeviceReadonly   bool       `json:"deviceReadonly"`
	LimitCommands    bool       `json:"limitCommands"`
	PoiLayer         string     `json:"poiLayer"`
	Token            string     `json:"token"`
	Attributes       Attributes `json:"attributes"`
}

User describes a User schema object

Jump to

Keyboard shortcuts

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