Documentation ¶
Index ¶
- Constants
- Variables
- func Marshal(v interface{}) []byte
- func ReadLine(prompt string) string
- type Client
- func (c *Client) Authenticate(force_refresh bool, service string) (err error)
- func (c *Client) IsTrustedSession() bool
- func (c *Client) Requires2FA() bool
- func (c *Client) Requires2SA() bool
- func (c *Client) SendVerificationCode(dev *api.Device) error
- func (c *Client) TrustSession() error
- func (c *Client) TrustedDevices() ([]api.Device, error)
- func (c *Client) Validate2FACode(code string) error
- func (c *Client) ValidateVerificationCode(dev *api.Device, code string) error
- type DriveNode
- func (n *DriveNode) Changed() time.Time
- func (n *DriveNode) Children() ([]*DriveNode, error)
- func (n *DriveNode) Delete() error
- func (n *DriveNode) Dir() ([]string, error)
- func (n *DriveNode) Download(path string) error
- func (n *DriveNode) Get(name string) (*DriveNode, error)
- func (n *DriveNode) IsDir() bool
- func (n *DriveNode) LastOpened() time.Time
- func (n *DriveNode) Mkdir(folder string) error
- func (n *DriveNode) Modified() time.Time
- func (n *DriveNode) Name() string
- func (n *DriveNode) Open() (io.ReadCloser, error)
- func (n *DriveNode) PutStream(in io.Reader, path string, size int64, mtime time.Time) error
- func (n *DriveNode) Rename(newName string) error
- func (n *DriveNode) Size() int64
- func (n *DriveNode) Stale()
- func (n *DriveNode) Type() string
- func (n *DriveNode) Upload(path string) error
- type DriveService
- type ErrAPI
- type ErrApple
Constants ¶
const ( AuthEndpoint = "https://idmsa.apple.com/appleauth/auth" HomeEndpoint = "https://www.icloud.com" SetupEndpoint = "https://setup.icloud.com/setup/ws/1" DefUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36" )
API endpoints
Variables ¶
var ( ErrServiceNotActive = NewErr("icloud service not activated") ErrLoginFailed = NewErr("icloud login failed") Err2SARequired = NewErr("2-step authentication required for account") ErrNoStoredPassword = NewErr("no stored icloud password available") ErrNoDevices = NewErr("no icloud device") ErrWrongVerification = NewErr("wrong verification code") ErrNotFound = NewErr("path not found") ErrNotDir = NewErr("path is not a directory") ErrNotFile = NewErr("path is not a file") )
var Debug = false
Functions ¶
Types ¶
type Client ¶
Client is iCloud API client
func NewClientWithOptions ¶
func NewClientWithOptions(client *http.Client, appleID, password, userAgent, sessPath string, verify, withFamily bool) (*Client, error)
NewClientWithOptions returns client with extra options
func (*Client) Authenticate ¶
Authenticate handles authentication, and persists cookies so that subsequent logins will not cause additional e-mails from Apple.
func (*Client) IsTrustedSession ¶
IsTrustedSession returns true if current session is trusted.
func (*Client) Requires2FA ¶
Requires2FA returns true if 2-factor authentication is required.
func (*Client) Requires2SA ¶
Requires2SA returns true if 2-step authentication is required.
func (*Client) SendVerificationCode ¶
SendVerificationCode makes iCloud send verification code to a device
func (*Client) TrustSession ¶
TrustSession requests session trust to avoid user log in going forward.
func (*Client) TrustedDevices ¶
TrustedDevices returns slice of trusted devices
func (*Client) Validate2FACode ¶
Validate2FACode verifies a code received via Apple's 2FA system (HSA2).
type DriveNode ¶
type DriveNode struct {
// contains filtered or unexported fields
}
DriveNode ...
type DriveService ¶
type DriveService struct {
// contains filtered or unexported fields
}
DriveService describes the Drive iCloud service
func NewDrive ¶
func NewDrive(c *Client) (d *DriveService, err error)
NewDrive returns new Drive service
func (*DriveService) Root ¶
func (d *DriveService) Root() (*DriveNode, error)
Root returns root folder