Documentation
¶
Index ¶
- type AddRequest
- type Client
- func (ds *Client) Add(serialNumber, name, agentID, folderID string) (Device, error)
- func (ds *Client) GetAll() ([]Device, error)
- func (ds *Client) GetAllInFolder(id string) ([]Device, error)
- func (ds *Client) Remove(deviceID string) error
- func (ds *Client) Update(deviceID, name, folder string) (Device, error)
- type Device
- type Response
- type UpdateRequest
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) GetAllInFolder ¶
GetAllInFolder returns all the devices available to the current session
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) ToResponse ¶
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 ¶
UpdateRequest is used when updating a device