diff --git a/godep/beta.go b/godep/beta.go new file mode 100644 index 0000000..430d86c --- /dev/null +++ b/godep/beta.go @@ -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") +}