Skip to content

Commit

Permalink
add DeviceDetails to godep
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepeterson committed Oct 23, 2022
1 parent 30a24c5 commit b463e61
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions godep/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,22 @@ func IsCursorInvalid(err error) bool {
func IsCursorExpired(err error) bool {
return httpErrorContains(err, http.StatusBadRequest, "EXPIRED_CURSOR")
}

// DeviceListResponse corresponds to the Apple API "DeviceListResponse" structure.
// See https://developer.apple.com/documentation/devicemanagement/devicelistresponse
type DeviceListResponse struct {
Devices map[string]Device `json:"devices"`
}

// DeviceDetails uses the Apple "Get Device Details" API endpoint to get the
// details on a set of devices.
// See https://developer.apple.com/documentation/devicemanagement/get_device_details
func (c *Client) DeviceDetails(ctx context.Context, name string, devices ...string) (*DeviceListResponse, error) {
req := struct {
Devices []string `json:"devices"`
}{
Devices: devices,
}
resp := new(DeviceListResponse)
return resp, c.do(ctx, name, http.MethodPost, "/devices", req, resp)
}

0 comments on commit b463e61

Please sign in to comment.