-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
godep: os beta enrollment support (#63)
- Loading branch information
1 parent
a3db510
commit f0b5dce
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package godep | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
) | ||
|
||
// SeedBuildToken corresponds to the Apple DEP API "SeedBuildToken" structure. | ||
// See https://developer.apple.com/documentation/devicemanagement/seedbuildtoken | ||
type SeedBuildToken struct { | ||
Token string `json:"token"` | ||
Title string `json:"title"` | ||
OS string `json:"os"` | ||
} | ||
|
||
// GetSeedBuildTokenResponse corresponds to the Apple DEP API "GetSeedBuildTokenResponse" structure. | ||
// See https://developer.apple.com/documentation/devicemanagement/getseedbuildtokenresponse | ||
type GetSeedBuildTokenResponse struct { | ||
BetaEnrollmentTokens []SeedBuildToken `json:"betaEnrollmentTokens,omitempty"` | ||
SeedBuildTokens []SeedBuildToken `json:"seedBuildTokens,omitempty"` | ||
} | ||
|
||
// OSBetaEnrollmentTokens uses the Apple "Get Beta Enrollment Tokens" API endpoint to fetch the | ||
// OS beta enrollment tokens. These are for later use during ADE | ||
// enrollment of devices to force enrollment into beta software enrollment. | ||
// See https://developer.apple.com/documentation/devicemanagement/get_beta_enrollment_tokens | ||
func (c *Client) OSBetaEnrollmentTokens(ctx context.Context, name string) (*GetSeedBuildTokenResponse, error) { | ||
resp := new(GetSeedBuildTokenResponse) | ||
return resp, c.do(ctx, name, http.MethodGet, "/os-beta-enrollment/tokens", nil, resp) | ||
} | ||
|
||
// IsAppleSeedForITTurnedOff returns true if err indicates your organization doesn't allow beta access. | ||
func IsAppleSeedForITTurnedOff(err error) bool { | ||
return httpErrorContains(err, http.StatusForbidden, "APPLE_SEED_FOR_IT_TURNED_OFF") | ||
} |