-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevices.go
31 lines (25 loc) · 1.15 KB
/
devices.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package igcclient
import (
"net/http"
"net/url"
"strconv"
"github.com/moonwalker/igcclient/models"
"github.com/moonwalker/logger"
)
type DevicesService service
// Get a single device by device ID
func (s *DevicesService) DevicesByID(deviceId int64, headers map[string]string, log logger.Logger) (response models.OperationResponseOfDeviceTypeObject, err error) {
id := strconv.FormatInt(deviceId, 10)
err = s.client.apiReq(http.MethodPost, "/devices/"+url.QueryEscape(id), nil, nil, &response, &headers, log)
return
}
// Get all the device types
func (s *DevicesService) Devices(headers map[string]string, log logger.Logger) (response models.OperationResponseOfListOfDeviceTypeObject, err error) {
err = s.client.apiReq(http.MethodPost, "/devices", nil, nil, &response, &headers, log)
return
}
// Get the platform from the details passed in the DevicesDetectionModel
func (s *DevicesService) GetPlatform(body models.DevicesDetectionModel, headers map[string]string, log logger.Logger) (response models.OperationResponseOfDevicePlatformModel, err error) {
err = s.client.apiReq(http.MethodPost, "/devices/getplatform", nil, &body, &response, &headers, log)
return
}