iris

package
v0.0.0-...-cf3e634 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDuplicateAppNameError

func IsDuplicateAppNameError(err error) bool

IsDuplicateAppNameError reports whether an IRIS API error indicates the app name is already taken (often globally across accounts).

func PersistSession

func PersistSession(session *AuthSession)

PersistSession caches cookies for future runs. This effectively acts like a "remember me" token; treat the cache file as sensitive.

func SubmitTwoFactorCode

func SubmitTwoFactorCode(session *AuthSession, code string) error

SubmitTwoFactorCode completes Apple 2FA for an existing SRP session.

This is used when Login() returns a non-nil session with a *TwoFactorRequiredError.

Types

type APIError

type APIError struct {
	Status         int
	Body           []byte
	AppleRequestID string
	CorrelationKey string
}

APIError captures non-2xx responses from IRIS endpoints. It intentionally includes the raw body, since IRIS error bodies are often the only available "schema" for debugging.

func (*APIError) Error

func (e *APIError) Error() string

type AppCreateAPIAttributes

type AppCreateAPIAttributes struct {
	SKU           string `json:"sku"`
	PrimaryLocale string `json:"primaryLocale"`
	BundleID      string `json:"bundleId"`
	CompanyName   string `json:"companyName,omitempty"`
}

AppCreateAPIAttributes represents the allowed app-level attributes for IRIS create. Note: IRIS rejects `name` on create; name must be set via appInfoLocalizations.

type AppCreateAttributes

type AppCreateAttributes struct {
	// Name is used for the included localization (display name). IRIS rejects
	// `data.attributes.name` on app create.
	Name          string `json:"-"`
	SKU           string `json:"sku"`
	PrimaryLocale string `json:"primaryLocale"`
	BundleID      string `json:"bundleId"`
	CompanyName   string `json:"companyName,omitempty"`

	// Platform is used for the included App Store Version.
	Platform string `json:"-"`
}

AppCreateAttributes represents attributes for creating an app

type AppCreateRelationships

type AppCreateRelationships struct {
	AppStoreVersions struct {
		Data []RelationshipData `json:"data"`
	} `json:"appStoreVersions"`
	AppInfos struct {
		Data []RelationshipData `json:"data"`
	} `json:"appInfos"`
}

AppCreateRelationships represents relationships for app creation

type AppCreateRequest

type AppCreateRequest struct {
	Data struct {
		Type          string                 `json:"type"`
		Attributes    AppCreateAPIAttributes `json:"attributes"`
		Relationships AppCreateRelationships `json:"relationships"`
	} `json:"data"`
	Included []interface{} `json:"included"`
}

AppCreateRequest represents the full app creation request

type AppInfoData

type AppInfoData struct {
	Type          string               `json:"type"`
	ID            string               `json:"id"`
	Relationships AppInfoRelationships `json:"relationships"`
}

AppInfoData represents app info for creation

type AppInfoLocalizationAttributes

type AppInfoLocalizationAttributes struct {
	Locale string `json:"locale"`
	Name   string `json:"name"`
}

AppInfoLocalizationAttributes represents app info localization attributes

type AppInfoLocalizationData

type AppInfoLocalizationData struct {
	Type       string                        `json:"type"`
	ID         string                        `json:"id"`
	Attributes AppInfoLocalizationAttributes `json:"attributes"`
}

AppInfoLocalizationData represents app info localization

type AppInfoRelationships

type AppInfoRelationships struct {
	AppInfoLocalizations struct {
		Data []RelationshipData `json:"data"`
	} `json:"appInfoLocalizations"`
}

AppInfoRelationships represents app info relationships

type AppResponse

type AppResponse struct {
	Data struct {
		ID         string                 `json:"id"`
		Type       string                 `json:"type"`
		Attributes map[string]interface{} `json:"attributes"`
	} `json:"data"`
}

AppResponse represents the response from app creation

type AppStoreVersionAttributes

type AppStoreVersionAttributes struct {
	VersionString string `json:"versionString"`
	Platform      string `json:"platform"`
}

AppStoreVersionAttributes represents app store version attributes

type AppStoreVersionData

type AppStoreVersionData struct {
	Type          string                        `json:"type"`
	ID            string                        `json:"id"`
	Attributes    AppStoreVersionAttributes     `json:"attributes"`
	Relationships *AppStoreVersionRelationships `json:"relationships,omitempty"`
}

AppStoreVersionData represents app store version for creation

type AppStoreVersionLocalizationAttributes

type AppStoreVersionLocalizationAttributes struct {
	Locale string `json:"locale"`
}

AppStoreVersionLocalizationAttributes represents app store version localization attributes

type AppStoreVersionLocalizationData

type AppStoreVersionLocalizationData struct {
	Type       string                                `json:"type"`
	ID         string                                `json:"id"`
	Attributes AppStoreVersionLocalizationAttributes `json:"attributes"`
}

AppStoreVersionLocalizationData represents app store version localization for creation

type AppStoreVersionRelationships

type AppStoreVersionRelationships struct {
	AppStoreVersionLocalizations struct {
		Data []RelationshipData `json:"data"`
	} `json:"appStoreVersionLocalizations"`
}

AppStoreVersionRelationships represents app store version relationships

type AuthSession

type AuthSession struct {
	Client     *http.Client
	ProviderID int64
	TeamID     string
	UserEmail  string

	// Auth state needed for 2FA continuation.
	ServiceKey       string
	AppleIDSessionID string
	SCNT             string
}

AuthSession represents an authenticated IRIS session

func Login

func Login(creds LoginCredentials) (*AuthSession, error)

Login authenticates with Apple using SRP and returns a session

func TryResumeLastSession

func TryResumeLastSession() (*AuthSession, bool, error)

TryResumeLastSession attempts to resume the last cached session (if any), without requiring the caller to provide an Apple ID.

func TryResumeSession

func TryResumeSession(username string) (*AuthSession, bool, error)

TryResumeSession attempts to reuse a previously authenticated session (cookies) for the provided Apple ID. It validates the session via /olympus/v1/session.

If ok=false, callers should fall back to SRP login.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an IRIS API client

func NewClient

func NewClient(session *AuthSession) *Client

NewClient creates a new IRIS client with an authenticated session

func (*Client) CreateApp

func (c *Client) CreateApp(attrs AppCreateAttributes) (*AppResponse, error)

CreateApp creates a new app in App Store Connect using the IRIS API

func (*Client) FindApp

func (c *Client) FindApp(bundleID string) (*AppResponse, error)

FindApp finds an existing app by bundle ID

type LoginCredentials

type LoginCredentials struct {
	Username string
	Password string
}

LoginCredentials holds the credentials for login

type RelationshipData

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

RelationshipData represents a relationship data item

type SessionInfo

type SessionInfo struct {
	Provider struct {
		ProviderID int64  `json:"providerId"`
		Name       string `json:"name"`
	} `json:"provider"`
	User struct {
		EmailAddress string `json:"emailAddress"`
	} `json:"user"`
	AvailableProviders []struct {
		ProviderID int64  `json:"providerId"`
		Name       string `json:"name"`
	} `json:"availableProviders"`
}

SessionInfo represents the session information from Apple

type TwoFactorRequiredError

type TwoFactorRequiredError struct {
	AppleIDSessionID string
	SCNT             string
}

TwoFactorRequiredError indicates the Apple account requires 2FA to proceed.

This error intentionally does not include raw session tokens in its Error() string to avoid accidental logging.

func (*TwoFactorRequiredError) Error

func (e *TwoFactorRequiredError) Error() string

Jump to

Keyboard shortcuts

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