Skip to content

Commit f0f841d

Browse files
authored
Merge pull request #898 from neilmartin83/nm-mobile-device-prestages-11-20
feat: add support for new Mobile Device Prestages endpoint and fields in Jamf Pro 11.20
2 parents 71d0dcd + ca3f544 commit f0f841d

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

sdk/jamfpro/jamfproapi_mobile_device_prestages.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// jamfproapi_mobile_device_prestages.go
22
// Jamf Pro Api - Mobile Device Prestages
3-
// api reference: https://developer.jamf.com/jamf-pro/reference/get_v2-mobile-device-prestages
3+
// api reference: https://developer.jamf.com/jamf-pro/reference/get_v3-mobile-device-prestages
44
// Jamf Pro API requires the structs to support a JSON data structure.
55

66
package jamfpro
@@ -12,7 +12,10 @@ import (
1212
"github.com/mitchellh/mapstructure"
1313
)
1414

15-
const uriMobileDevicePrestages = "/api/v2/mobile-device-prestages"
15+
const (
16+
uriMobileDevicePrestagesV2 = "/api/v2/mobile-device-prestages"
17+
uriMobileDevicePrestagesV3 = "/api/v3/mobile-device-prestages"
18+
)
1619

1720
// List
1821

@@ -94,6 +97,7 @@ type ResourceMobileDevicePrestage struct {
9497
MinimumOsSpecificVersionIpad string `json:"minimumOsSpecificVersionIpad,omitempty"`
9598
RTSEnabled *bool `json:"rtsEnabled,omitempty"`
9699
RTSConfigProfileId string `json:"rtsConfigProfileId,omitempty"`
100+
PreserveManagedApps *bool `json:"preserveManagedApps,omitempty"`
97101
}
98102

99103
// Subsets & Containers
@@ -140,6 +144,10 @@ type MobileDevicePrestageSubsetSkipSetupItems struct {
140144
Welcome *bool `json:"Welcome"`
141145
SafetyAndHandling *bool `json:"SafetyAndHandling"`
142146
TapToSetup *bool `json:"TapToSetup"`
147+
SpokenLanguage *bool `json:"SpokenLanguage,omitempty"`
148+
Keyboard *bool `json:"Keyboard,omitempty"`
149+
Multitasking *bool `json:"Multitasking,omitempty"`
150+
OSShowcase *bool `json:"OSShowcase,omitempty"`
143151
}
144152

145153
type MobileDevicePrestageSubsetLocationInformation struct {
@@ -192,7 +200,7 @@ type MobileDevicePrestageSubsetNamesName struct {
192200

193201
// GetMobileDevicePrestages retrieves a list of all mobile prestages
194202
func (c *Client) GetMobileDevicePrestages(params url.Values) (*ResponseMobileDevicePrestagesList, error) {
195-
endpoint := uriMobileDevicePrestages
203+
endpoint := uriMobileDevicePrestagesV3
196204
resp, err := c.DoPaginatedGet(endpoint, params)
197205
if err != nil {
198206
return nil, fmt.Errorf(errMsgFailedPaginatedGet, "mobile device prestages", err)
@@ -215,7 +223,7 @@ func (c *Client) GetMobileDevicePrestages(params url.Values) (*ResponseMobileDev
215223

216224
// GetMobileDevicePrestageByID retrieves a single mobile prestage from the supplied ID
217225
func (c *Client) GetMobileDevicePrestageByID(id string) (*ResourceMobileDevicePrestage, error) {
218-
endpoint := fmt.Sprintf("%s/%s", uriMobileDevicePrestages, id)
226+
endpoint := fmt.Sprintf("%s/%s", uriMobileDevicePrestagesV3, id)
219227
var out ResourceMobileDevicePrestage
220228

221229
resp, err := c.HTTP.DoRequest("GET", endpoint, nil, &out)
@@ -248,7 +256,7 @@ func (c *Client) GetMobileDevicePrestageByName(name string) (*ResourceMobileDevi
248256

249257
// CreateMobileDevicePrestage creates a new mobile prestage and returns the id
250258
func (c *Client) CreateMobileDevicePrestage(newPrestage ResourceMobileDevicePrestage) (*ResponseMobileDevicePrestageCreate, error) {
251-
endpoint := uriMobileDevicePrestages
259+
endpoint := uriMobileDevicePrestagesV3
252260
var out ResponseMobileDevicePrestageCreate
253261
resp, err := c.HTTP.DoRequest("POST", endpoint, newPrestage, &out)
254262
if err != nil {
@@ -264,7 +272,7 @@ func (c *Client) CreateMobileDevicePrestage(newPrestage ResourceMobileDevicePres
264272

265273
// UpdateMobileDevicePrestageByID updates a mobile device prestage by its ID.
266274
func (c *Client) UpdateMobileDevicePrestageByID(id string, prestageUpdate *ResourceMobileDevicePrestage) (*ResourceMobileDevicePrestage, error) {
267-
endpoint := fmt.Sprintf("%s/%s", uriMobileDevicePrestages, id)
275+
endpoint := fmt.Sprintf("%s/%s", uriMobileDevicePrestagesV3, id)
268276

269277
var updatedPrestage ResourceMobileDevicePrestage
270278
resp, err := c.HTTP.DoRequest("PUT", endpoint, prestageUpdate, &updatedPrestage)
@@ -298,7 +306,7 @@ func (c *Client) UpdateMobileDevicePrestageByName(name string, prestageUpdate *R
298306

299307
// DeleteMobileDevicePrestageByID a mobile prestage at the given id
300308
func (c *Client) DeleteMobileDevicePrestageByID(id string) error {
301-
endpoint := fmt.Sprintf("%s/%s", uriMobileDevicePrestages, id)
309+
endpoint := fmt.Sprintf("%s/%s", uriMobileDevicePrestagesV3, id)
302310
resp, err := c.HTTP.DoRequest("DELETE", endpoint, nil, nil)
303311
if err != nil {
304312
return fmt.Errorf(errMsgFailedDeleteByID, "mobile device prestage", id, err)
@@ -330,7 +338,7 @@ func (c *Client) DeleteMobileDevicePrestageByName(name string) error {
330338

331339
// GetDeviceScopeForMobileDevicePrestage retrieves the device scope for a specific mobile device prestage by its ID.
332340
func (c *Client) GetDeviceScopeForMobileDevicePrestageByID(id string) (*ResponseMobileDeviceScope, error) {
333-
endpoint := fmt.Sprintf("%s/%s/scope", uriMobileDevicePrestages, id)
341+
endpoint := fmt.Sprintf("%s/%s/scope", uriMobileDevicePrestagesV2, id)
334342

335343
var deviceScope ResponseMobileDeviceScope
336344
resp, err := c.HTTP.DoRequest("GET", endpoint, nil, &deviceScope)

0 commit comments

Comments
 (0)