-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprofiles.go
More file actions
51 lines (41 loc) · 1.11 KB
/
Copy pathprofiles.go
File metadata and controls
51 lines (41 loc) · 1.11 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package mdmdirector
import (
"encoding/json"
"fmt"
"net/http"
"github.com/gavinelder/mdmdirector-client-go/types"
)
// GetSharedProfiles are profiles that go on every device.
func (c *Client) GetSharedProfiles() (*[]types.SharedProfile, error) {
req, err := http.NewRequest("GET", fmt.Sprintf("%s/profile", c.HostURL), nil)
if err != nil {
return nil, err
}
body, err := c.doRequest(req)
if err != nil {
return nil, err
}
sharedProfiles := []types.SharedProfile{}
err = json.Unmarshal(body, &sharedProfiles)
if err != nil {
return nil, err
}
return &sharedProfiles, nil
}
// GetDeviceProfiles are profiles that are assigned to a device either by UDID or SerialNumber.
func (c *Client) GetDeviceProfiles(deviceID string) (*[]types.DeviceProfile, error) {
req, err := http.NewRequest("GET", fmt.Sprintf("%s/profile/%s", c.HostURL, deviceID), nil)
if err != nil {
return nil, err
}
body, err := c.doRequest(req)
if err != nil {
return nil, err
}
deviceProfiles := []types.DeviceProfile{}
err = json.Unmarshal(body, &deviceProfiles)
if err != nil {
return nil, err
}
return &deviceProfiles, nil
}