device

package
v0.0.0-...-b77c216 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddRequest

type AddRequest struct {
	SerialNumber string         `json:"serialNumber"`
	Name         string         `json:"name"`
	Folder       rest.Reference `json:"folder"`
	Agent        rest.Reference `json:"agent"`
}

AddRequest is used to add a device

type Client

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

Client is an API client to device service

func NewClient

func NewClient(client *rest.HTTPClient) (*Client, error)

NewClient creates a new Client and returns a tuple of a pointer to it along with an error indicating if anything went wrong. The baseURL parameter should be the target API and sessionID a valid session for the target user.

func (*Client) Add

func (ds *Client) Add(serialNumber, name, agentID, folderID string) (Device, error)

Add device to the specified parent

func (*Client) GetAll

func (ds *Client) GetAll() ([]Device, error)

GetAll returns all the devices available to the current session

func (*Client) GetAllInFolder

func (ds *Client) GetAllInFolder(id string) ([]Device, error)

GetAllInFolder returns all the devices available to the current session

func (*Client) Remove

func (ds *Client) Remove(deviceID string) error

Remove device

func (*Client) Update

func (ds *Client) Update(deviceID, name, folder string) (Device, error)

Update device with a new name and parent

type Device

type Device struct {
	ID                 string
	SerialNumber       string
	Name               string
	Folder             string
	NetworkStatus      string
	CommunicationAgent string
}

Device represent the device model

func NewExampleDevice

func NewExampleDevice() Device

NewExampleDevice returns a dummy device, i.e. fake ID, serial number, etc.

func (Device) String

func (d Device) String() string

func (Device) ToResponse

func (d Device) ToResponse() Response

ToResponse converts a folder to a corresponding Response model

type Response

type Response struct {
	ID                 string          `json:"id"`
	SerialNumber       string          `json:"serialNumber"`
	Name               string          `json:"name"`
	Folder             *rest.Reference `json:"folder"`
	NetworkStatus      string          `json:"networkStatus"`
	CommunicationAgent *rest.Reference `json:"communicationAgent"`
}

Response represent a response model from device service

type UpdateRequest

type UpdateRequest struct {
	Name   string         `json:"name"`
	Folder rest.Reference `json:"folder"`
}

UpdateRequest is used when updating a device

Jump to

Keyboard shortcuts

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