appstore

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	V1      subscriptionStatusUrlVersion = "V1"
	V2      subscriptionStatusUrlVersion = "V2"
	LowerV1 subscriptionStatusUrlVersion = "v1"
	LowerV2 subscriptionStatusUrlVersion = "v2"
)
View Source
const (
	IOS    bundleIdPlatform = "IOS"
	MAC_OS bundleIdPlatform = "MAC_OS"
)
View Source
const (
	ICLOUD                           capabilityType = "ICLOUD"
	IN_APP_PURCHASE                  capabilityType = "IN_APP_PURCHASE"
	GAME_CENTER                      capabilityType = "GAME_CENTER"
	PUSH_NOTIFICATIONS               capabilityType = "PUSH_NOTIFICATIONS"
	WALLET                           capabilityType = "WALLET"
	INTER_APP_AUDIO                  capabilityType = "INTER_APP_AUDIO"
	MAPS                             capabilityType = "MAPS"
	ASSOCIATED_DOMAINS               capabilityType = "ASSOCIATED_DOMAINS"
	PERSONAL_VPN                     capabilityType = "PERSONAL_VPN"
	APP_GROUPS                       capabilityType = "APP_GROUPS"
	HEALTHKIT                        capabilityType = "HEALTHKIT"
	HOMEKIT                          capabilityType = "HOMEKIT"
	WIRELESS_ACCESSORY_CONFIGURATION capabilityType = "WIRELESS_ACCESSORY_CONFIGURATION"
	APPLE_PAY                        capabilityType = "APPLE_PAY"
	DATA_PROTECTION                  capabilityType = "DATA_PROTECTION"
	SIRIKIT                          capabilityType = "SIRIKIT"
	NETWORK_EXTENSIONS               capabilityType = "NETWORK_EXTENSIONS"
	MULTIPATH                        capabilityType = "MULTIPATH"
	HOT_SPOT                         capabilityType = "HOT_SPOT"
	NFC_TAG_READING                  capabilityType = "NFC_TAG_READING"
	CLASSKIT                         capabilityType = "CLASSKIT"
	AUTOFILL_CREDENTIAL_PROVIDER     capabilityType = "AUTOFILL_CREDENTIAL_PROVIDER"
	ACCESS_WIFI_INFORMATION          capabilityType = "ACCESS_WIFI_INFORMATION"
	NETWORK_CUSTOM_PROTOCOL          capabilityType = "NETWORK_CUSTOM_PROTOCOL"
	COREMEDIA_HLS_LOW_LATENCY        capabilityType = "COREMEDIA_HLS_LOW_LATENCY"
	SYSTEM_EXTENSION_INSTALL         capabilityType = "SYSTEM_EXTENSION_INSTALL"
	USER_MANAGEMENT                  capabilityType = "USER_MANAGEMENT"
	APPLE_ID_AUTH                    capabilityType = "APPLE_ID_AUTH"
)
View Source
const (
	ENTRY    allowedInstanceType = "ENTRY"
	SINGLE   allowedInstanceType = "SINGLE"
	MULTIPLE allowedInstanceType = "MULTIPLE"
)
View Source
const (
	ICLOUD_VERSION                   capabilityKey = "ICLOUD_VERSION"
	DATA_PROTECTION_PERMISSION_LEVEL capabilityKey = "DATA_PROTECTION_PERMISSION_LEVEL"
	APPLE_ID_AUTH_APP_CONSENT        capabilityKey = "APPLE_ID_AUTH_APP_CONSENT"
)
View Source
const (
	XCODE_5                         capabilityOptionKey = "XCODE_5"
	XCODE_6                         capabilityOptionKey = "XCODE_6"
	COMPLETE_PROTECTION             capabilityOptionKey = "COMPLETE_PROTECTION"
	PROTECTED_UNLESS_OPEN           capabilityOptionKey = "PROTECTED_UNLESS_OPEN"
	PROTECTED_UNTIL_FIRST_USER_AUTH capabilityOptionKey = "PROTECTED_UNTIL_FIRST_USER_AUTH"
	PRIMARY_APP_CONSENT             capabilityOptionKey = "PRIMARY_APP_CONSENT"
)
View Source
const (
	CT_IOS_DEVELOPMENT            certificateType = "IOS_DEVELOPMENT"
	CT_IOS_DISTRIBUTION           certificateType = "IOS_DISTRIBUTION"
	CT_MAC_APP_DISTRIBUTION       certificateType = "MAC_APP_DISTRIBUTION"
	CT_MAC_INSTALLER_DISTRIBUTION certificateType = "MAC_INSTALLER_DISTRIBUTION"
	CT_MAC_APP_DEVELOPMENT        certificateType = "MAC_APP_DEVELOPMENT"
	CT_DEVELOPER_ID_KEXT          certificateType = "DEVELOPER_ID_KEXT"
	CT_DEVELOPER_ID_APPLICATION   certificateType = "DEVELOPER_ID_APPLICATION"
	CT_DEVELOPMENT                certificateType = "DEVELOPMENT"
	CT_DISTRIBUTION               certificateType = "DISTRIBUTION"
	CT_PASS_TYPE_ID               certificateType = "PASS_TYPE_ID"
	CT_PASS_TYPE_ID_WITH_NFC      certificateType = "PASS_TYPE_ID_WITH_NFC"
)

Variables

View Source
var CertTypes = []string{
	"IOS_DEVELOPMENT",
	"IOS_DISTRIBUTION",
	"MAC_APP_DISTRIBUTION",
	"MAC_INSTALLER_DISTRIBUTION",
	"MAC_APP_DEVELOPMENT",
	"DEVELOPER_ID_KEXT",
	"DEVELOPER_ID_APPLICATION",
	"DEVELOPMENT",
	"DISTRIBUTION",
	"PASS_TYPE_ID",
	"PASS_TYPE_ID_WITH_NFC",
}
View Source
var ProfileTypes = []string{
	"IOS_APP_DEVELOPMENT",
	"IOS_APP_STORE",
	"IOS_APP_ADHOC",
	"IOS_APP_INHOUSE",
	"MAC_APP_DEVELOPMENT",
	"MAC_APP_STORE",
	"MAC_APP_DIRECT",
	"TVOS_APP_DEVELOPMENT",
	"TVOS_APP_STORE",
	"TVOS_APP_ADHOC",
	"TVOS_APP_INHOUSE",
	"MAC_CATALYST_APP_DEVELOPMENT",
	"MAC_CATALYST_APP_STORE",
	"MAC_CATALYST_APP_DIRECT",
}

Functions

This section is empty.

Types

type App

type App struct {
	ID            string        `json:"id"`
	Type          string        `json:"type"` // apps
	Attributes    AppAttributes `json:"attributes"`
	Relationships any           `json:"relationships"`
	Links         Links         `json:"links"`
}

type AppAttributes

type AppAttributes struct {
	BundleID                               string                       `json:"bundleId"`
	Name                                   string                       `json:"name"`
	Locale                                 string                       `json:"primaryLocale"`
	SKU                                    string                       `json:"sku"`
	AvailableInNewTerritories              bool                         `json:"availableInNewTerritories,omitempty"`
	ContentRightsDeclaration               string                       `json:"contentRightsDeclaration"` //  DOES_NOT_USE_THIRD_PARTY_CONTENT, USES_THIRD_PARTY_CONTENT
	IsOrEverWasMadeForKids                 bool                         `json:"isOrEverWasMadeForKids"`
	SubscriptionStatusURL                  string                       `json:"subscriptionStatusUrl"`
	SubscriptionStatusURLForSandbox        string                       `json:"subscriptionStatusUrlForSandbox"`
	SubscriptionStatusURLVersion           subscriptionStatusUrlVersion `json:"subscriptionStatusUrlVersion"`
	SubscriptionStatusURLVersionForSandbox subscriptionStatusUrlVersion `json:"subscriptionStatusUrlVersionForSandbox"`
}

type AppResponse

type AppResponse struct {
	Data  App           `json:"data"`
	Links DocumentLinks `json:"links"`
}

type AppStore

type AppStore struct {
	P8  string
	Iss string
	Kid string

	Proxy    string
	Insecure bool
	// contains filtered or unexported fields
}

func NewAppStore

func NewAppStore(p8, iss, kid, jwt string) *AppStore

NewAppStore creates a new App Store Connect API object

func (*AppStore) CreateCertificate

func (as *AppStore) CreateCertificate(ctype string, csrData string) (*Certificate, error)

CreateCertificate creates a new certificate using a certificate signing request.

func (*AppStore) CreateProfile

func (as *AppStore) CreateProfile(name string, ptype string, bundleID string, cerIDs, devicesIDs []string) (*ProfileResponse, error)

CreateProfile creates a new profile

func (*AppStore) DeleteBundleID

func (as *AppStore) DeleteBundleID(id string) (*BundleIdResponse, error)

DeleteBundleID deletes a bundle ID that is used for app development.

func (*AppStore) DeleteProfile

func (as *AppStore) DeleteProfile(id string) error

DeleteProfile deletes a provisioning profile that is used for app development or distribution.

func (*AppStore) EnableCapability

func (as *AppStore) EnableCapability(id, ctype string) (*BundleIdCapability, error)

EnableCapability enables a capability for a bundle ID.. // TODO: finish this

func (*AppStore) GenerateToken

func (as *AppStore) GenerateToken(life time.Duration) (string, error)

GenerateToken generates a new JWT token

func (*AppStore) GetApps

func (as *AppStore) GetApps() ([]App, error)

GetApps returns a list of Apps resources.

func (*AppStore) GetBundleID

func (as *AppStore) GetBundleID(id string) (*BundleID, error)

GetBundleID returns information about a specific bundle ID.

func (*AppStore) GetBundleIDApp

func (as *AppStore) GetBundleIDApp(id string) (*AppResponse, error)

GetBundleIDApp returns the app information for a specific bundle ID.

func (*AppStore) GetBundleIDCapabilities

func (as *AppStore) GetBundleIDCapabilities(id string) (*BundleIdCapabilitiesResponse, error)

GetBundleIDCapabilities returns a list of all capabilities for a specific bundle ID.

func (*AppStore) GetBundleIDProfiles

func (as *AppStore) GetBundleIDProfiles(id string) (*ProfileResponse, error)

GetBundleIDProfiles returns a list of all provisioning profiles for a specific bundle ID.

func (*AppStore) GetBundleIDs

func (as *AppStore) GetBundleIDs() ([]BundleID, error)

GetBundleIDs returns a list bundle IDs that are registered to your team.

func (*AppStore) GetCertificates

func (as *AppStore) GetCertificates() ([]Certificate, error)

GetCertificates returns a list certificates and download their data.

func (*AppStore) GetDevices

func (as *AppStore) GetDevices() ([]Device, error)

GetDevices returns a list devices registered to your team.

func (*AppStore) GetProfile

func (as *AppStore) GetProfile(id string) (*Profile, error)

GetProfile returns a provisioning profile and download their data.

func (*AppStore) GetProfileBundleID

func (as *AppStore) GetProfileBundleID(id string) (*BundleID, error)

GetProfileBundleID returns the bundle ID information for a specific provisioning profile.

func (*AppStore) GetProfileCerts

func (as *AppStore) GetProfileCerts(id string) ([]Certificate, error)

GetProfileCerts returns a list of all certificates and their data for a specific provisioning profile.

func (*AppStore) GetProfileDevices

func (as *AppStore) GetProfileDevices(id string) ([]Device, error)

GetProfileDevices returns a list of all devices for a specific provisioning profile

func (*AppStore) GetProfiles

func (as *AppStore) GetProfiles() ([]Profile, error)

GetProfiles returns a list provisioning profiles and download their data.

func (*AppStore) GetToken

func (as *AppStore) GetToken() string

GetToken returns the current JWT token

func (*AppStore) ModifyDevice

func (as *AppStore) ModifyDevice(id, name, status string) (*Device, error)

ModifyDevice updates the name or status of a specific device.

func (*AppStore) RegisterBundleID

func (as *AppStore) RegisterBundleID(name, id string) (*BundleIdResponse, error)

RegisterBundleID registers a new bundle ID for app development.

func (*AppStore) RegisterDevice

func (as *AppStore) RegisterDevice(name, platform, udid string) (*Device, error)

RegisterDevice registers a new device for app development.

func (*AppStore) RevokeCertificate

func (as *AppStore) RevokeCertificate(id string) error

RevokeCertificate revokes a lost, stolen, compromised, or expiring signing certificate.

type AppsResponse

type AppsResponse struct {
	Data  []App              `json:"data"`
	Links PagedDocumentLinks `json:"links"`
	Meta  Meta               `json:"meta"`
}

type BundleID

type BundleID struct {
	ID         string `json:"id"`
	Type       string `json:"type"` // bundleIds
	Attributes struct {
		ID       string           `json:"identifier"`
		Name     string           `json:"name"`
		Platform bundleIdPlatform `json:"platform"`
		SeedID   string           `json:"seedId"`
	} `json:"attributes"`
	Relationships struct {
		Capabilities BundleIdCapabilitiesResponse `json:"bundleIdCapabilities"`
		Profiles     struct {
			Data []struct {
				ID   string `json:"id"`
				Type string `json:"type"` // profiles
			} `json:"data"`
			Meta  Meta  `json:"meta"`
			Links Links `json:"links"`
		} `json:"profiles"`
		App struct {
			Data struct {
				ID   string `json:"id"`
				Type string `json:"type"` // apps
			} `json:"data"`
			Links Links `json:"links"`
		} `json:"app"`
	} `json:"relationships"`
	Links Links `json:"links"`
}

type BundleIDCapabilityCreateRequest

type BundleIDCapabilityCreateRequest struct {
	Data struct {
		Type       string `json:"type"` // bundleIdCapabilities
		Attributes struct {
			CapabilityType capabilityType      `json:"capabilityType"`
			Settings       []CapabilitySetting `json:"settings"`
		} `json:"attributes"`
		Relationships struct {
			BundleID struct {
				Data struct {
					ID   string `json:"id"`
					Type string `json:"type"` // bundleIds
				} `json:"data"`
			} `json:"bundleId"`
		} `json:"relationships"`
	} `json:"data"`
}

type BundleIdCapabilitiesResponse

type BundleIdCapabilitiesResponse struct {
	Data  []BundleIdCapability `json:"data"`
	Links Links                `json:"links"`
	Meta  Meta                 `json:"meta"`
}

type BundleIdCapability

type BundleIdCapability struct {
	ID         string `json:"id"`
	Type       string `json:"type"` // bundleIdCapabilities
	Attributes struct {
		CapabilityType capabilityType      `json:"capabilityType"`
		Settings       []CapabilitySetting `json:"settings"`
	} `json:"attributes"`
	Links ResourceLinks `json:"links"`
}

type BundleIdCapabilityResponse

type BundleIdCapabilityResponse struct {
	Data  BundleIdCapability `json:"data"`
	Links DocumentLinks      `json:"links"`
}

type BundleIdCreateRequest

type BundleIdCreateRequest struct {
	Data struct {
		Type       string `json:"type"` // bundleIds
		Attributes struct {
			ID       string           `json:"identifier"`
			Name     string           `json:"name"`
			Platform bundleIdPlatform `json:"platform"`
			SeedID   string           `json:"seedId"`
		} `json:"attributes"`
	} `json:"data"`
}

type BundleIdResponse

type BundleIdResponse struct {
	Data     BundleID `json:"data"`
	Links    Links    `json:"links"`
	Included any      `json:"included,omitempty"`
}

type BundleIdsResponse

type BundleIdsResponse struct {
	Data     []BundleID `json:"data"`
	Links    Links      `json:"links"`
	Meta     Meta       `json:"meta"`
	Included any        `json:"included,omitempty"`
}

type CapabilityOption

type CapabilityOption struct {
	Description      string              `json:"description"`
	Enabled          bool                `json:"enabled"`
	Default          bool                `json:"enabledByDefault"`
	Key              capabilityOptionKey `json:"key"`
	Name             string              `json:"name"`
	SupportsWildcard bool                `json:"supportsWildcard"`
}

type CapabilitySetting

type CapabilitySetting struct {
	AllowedInstances allowedInstanceType `json:"allowedInstances"`
	Description      string              `json:"description"`
	Enabled          bool                `json:"enabledByDefault"`
	Key              capabilityKey       `json:"key"`
	Name             string              `json:"name"`
	Options          []CapabilityOption  `json:"options"`
	Visible          bool                `json:"visible"`
	MinInstances     int                 `json:"minInstances"`
}

type Certificate

type Certificate struct {
	Type       string `json:"type"`
	ID         string `json:"id"`
	Attributes struct {
		SerialNumber       string `json:"serialNumber"`
		CertificateContent []byte `json:"certificateContent"`
		DisplayName        string `json:"displayName"`
		Name               string `json:"name"`
		CsrContent         any    `json:"csrContent"`
		Platform           string `json:"platform"`
		ExpirationDate     Date   `json:"expirationDate"`
		CertificateType    string `json:"certificateType"`
	} `json:"attributes"`
	Links Links `json:"links"`
}

func (Certificate) IsExpired

func (c Certificate) IsExpired() bool

type CertificateCreateRequest

type CertificateCreateRequest struct {
	Data struct {
		Type       string `json:"type"` // certificates
		Attributes struct {
			CertificateType string `json:"certificateType"`
			CSRContent      string `json:"csrContent"`
		} `json:"attributes"`
	} `json:"data"`
}

type CertificateResponse

type CertificateResponse struct {
	Data  Certificate `json:"data"`
	Links Links       `json:"links"`
}

type CertificatesResponse

type CertificatesResponse struct {
	Data  []Certificate      `json:"data"`
	Links PagedDocumentLinks `json:"links"`
	Meta  Meta               `json:"meta"`
}

type Data

type Data struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

type Date

type Date time.Time

func (Date) Format

func (d Date) Format(s string) string

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

type Device

type Device struct {
	Type       string `json:"type"`
	ID         string `json:"id"`
	Attributes struct {
		AddedDate   Date   `json:"addedDate"`
		Name        string `json:"name"`
		DeviceClass string `json:"deviceClass"`
		Model       string `json:"model"`
		Udid        string `json:"udid"`
		Platform    string `json:"platform"`
		Status      string `json:"status"`
	} `json:"attributes"`
	Links Links `json:"links"`
}

type DeviceCreateRequest

type DeviceCreateRequest struct {
	Data struct {
		Type       string `json:"type"` // devices
		Attributes struct {
			Name        string           `json:"name"`
			DeviceClass string           `json:"deviceClass"`
			Model       string           `json:"model"`
			Udid        string           `json:"udid"`
			Platform    bundleIdPlatform `json:"platform"`
		} `json:"attributes"`
	} `json:"data"`
}

type DeviceResponse

type DeviceResponse struct {
	Data  Device `json:"data"`
	Links Links  `json:"links"`
}

type DeviceUpdateRequest

type DeviceUpdateRequest struct {
	Data struct {
		ID         string `json:"id"`
		Type       string `json:"type"` // devices
		Attributes struct {
			Name   string `json:"name"`
			Status string `json:"status"` // ENABLED, DISABLED
		} `json:"attributes"`
	} `json:"data"`
}

type DevicesResponse

type DevicesResponse struct {
	Data  []Device `json:"data"`
	Links Links    `json:"links"`
	Meta  Meta     `json:"meta"`
}
type DocumentLinks struct {
	Self string `json:"self"`
}

type ErrorResponse

type ErrorResponse struct {
	Errors []Errors `json:"errors"`
}

type Errors

type Errors struct {
	ID     string `json:"id"`
	Status string `json:"status"`
	Code   string `json:"code"`
	Title  string `json:"title"`
	Detail string `json:"detail"`
	Source any    `json:"source"`
}
type Links struct {
	Self    string `json:"self"`
	Related string `json:"related,omitempty"`
}

type Meta

type Meta struct {
	Paging struct {
		Total int `json:"total"` // The total number of resources matching your request.
		Limit int `json:"limit"` // The maximum number of resources to return per page, from 0 to 200.
	} `json:"paging"`
}
type PagedDocumentLinks struct {
	First string `json:"first"`
	Next  string `json:"next"`
	Self  string `json:"self"`
}

type Profile

type Profile struct {
	ID         string      `json:"id"`
	Type       ProfileType `json:"type"` // profiles
	Attributes struct {
		ProfileState   string `json:"profileState"`
		CreatedDate    Date   `json:"createdDate"`
		ProfileType    string `json:"profileType"`
		Name           string `json:"name"`
		ProfileContent []byte `json:"profileContent"`
		UUID           string `json:"uuid"`
		Platform       string `json:"platform"`
		ExpirationDate Date   `json:"expirationDate"`
	} `json:"attributes"`
	Relationships struct {
		BundleID struct {
			Data struct {
				Type string `json:"type"`
				ID   string `json:"id"`
			} `json:"data"`
			Links struct {
				Self    string `json:"self"`
				Related string `json:"related"`
			} `json:"links"`
		} `json:"bundleId"`
		Certificates struct {
			Meta struct {
				Paging struct {
					Total int   `json:"total"`
					Limit int64 `json:"limit"`
				} `json:"paging"`
			} `json:"meta"`
			Data []struct {
				Type string `json:"type"`
				ID   string `json:"id"`
			} `json:"data"`
			Links struct {
				Self    string `json:"self"`
				Related string `json:"related"`
			} `json:"links"`
		} `json:"certificates"`
		Devices struct {
			Meta struct {
				Paging struct {
					Total int   `json:"total"`
					Limit int64 `json:"limit"`
				} `json:"paging"`
			} `json:"meta"`
			Data []struct {
				Type string `json:"type"`
				ID   string `json:"id"`
			} `json:"data"`
			Links struct {
				Self    string `json:"self"`
				Related string `json:"related"`
			} `json:"links"`
		} `json:"devices"`
	} `json:"relationships"`
	Links Links `json:"links"`
}

func (Profile) IsExpired

func (p Profile) IsExpired() bool

func (Profile) IsInvalid

func (p Profile) IsInvalid() bool

type ProfileCreateRequest

type ProfileCreateRequest struct {
	Data struct {
		Type       string `json:"type"` // profiles
		Attributes struct {
			Name        string `json:"name"`
			ProfileType string `json:"profileType"`
		} `json:"attributes"`
		Relationships struct {
			BundleID struct {
				Data Data `json:"data"`
			} `json:"bundleId"`
			Certificates struct {
				Data []Data `json:"data"`
			} `json:"certificates"`
			Devices struct {
				Data []Data `json:"data"`
			} `json:"devices"`
		} `json:"relationships"`
	} `json:"data"`
}

type ProfileResponse

type ProfileResponse struct {
	Data  Profile       `json:"data"`
	Links DocumentLinks `json:"links"`
}

type ProfileType

type ProfileType string
const (
	IOS_APP_DEVELOPMENT          ProfileType = "IOS_APP_DEVELOPMENT"
	IOS_APP_STORE                ProfileType = "IOS_APP_STORE"
	IOS_APP_ADHOC                ProfileType = "IOS_APP_ADHOC"
	IOS_APP_INHOUSE              ProfileType = "IOS_APP_INHOUSE"
	MAC_APP_DEVELOPMENT          ProfileType = "MAC_APP_DEVELOPMENT"
	MAC_APP_STORE                ProfileType = "MAC_APP_STORE"
	MAC_APP_DIRECT               ProfileType = "MAC_APP_DIRECT"
	TVOS_APP_DEVELOPMENT         ProfileType = "TVOS_APP_DEVELOPMENT"
	TVOS_APP_STORE               ProfileType = "TVOS_APP_STORE"
	TVOS_APP_ADHOC               ProfileType = "TVOS_APP_ADHOC"
	TVOS_APP_INHOUSE             ProfileType = "TVOS_APP_INHOUSE"
	MAC_CATALYST_APP_DEVELOPMENT ProfileType = "MAC_CATALYST_APP_DEVELOPMENT"
	MAC_CATALYST_APP_STORE       ProfileType = "MAC_CATALYST_APP_STORE"
	MAC_CATALYST_APP_DIRECT      ProfileType = "MAC_CATALYST_APP_DIRECT"
)

type ProfilesResponse

type ProfilesResponse struct {
	Data  []Profile `json:"data"`
	Links Links     `json:"links"`
}
type ResourceLinks struct {
	Self string `json:"self"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL