api

package
v1.74.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 33 Imported by: 3

Documentation

Overview

Package api provides functionality for interacting with the iCloud API

Index

Constants

This section is empty.

Variables

View Source
var SmartAlbums = buildSmartAlbums()

SmartAlbums defines the built-in smart album types available in iCloud Photos 10 filter-based albums are generated from smartAlbumFilters; 4 special albums (All Photos, Bursts, Hidden, Recently Deleted) use unique recordTypes

Functions

func ClearCacheDir added in v1.74.0

func ClearCacheDir(remoteName string)

ClearCacheDir removes all disk cache files for a remote

func ConstructDriveID

func ConstructDriveID(id string, zone string, t string) string

ConstructDriveID constructs a drive ID from the given components.

func DeconstructDriveID

func DeconstructDriveID(id string) (docType, zone, docid string)

DeconstructDriveID returns the document type, zone, and document ID from the drive ID.

func GetCommonHeaders

func GetCommonHeaders(overwrite map[string]string) map[string]string

GetCommonHeaders generates common HTTP headers with optional overwrite

func GetContentTypeForFile

func GetContentTypeForFile(name string) string

GetContentTypeForFile detects content type for given file name.

func GetDocIDFromDriveID

func GetDocIDFromDriveID(id string) string

GetDocIDFromDriveID returns the DocumentID from the drive ID.

func IntoReader

func IntoReader(values any) (*bytes.Reader, error)

IntoReader marshals the provided values into a JSON encoded reader

Types

type AccountInfo

type AccountInfo struct {
	DsInfo               *dsInfo                `json:"dsInfo"`
	Webservices          map[string]*webService `json:"webservices"`
	HsaChallengeRequired bool                   `json:"hsaChallengeRequired"`
}

AccountInfo represents the subset of Apple's account response we actually use json.Unmarshal silently ignores extra fields in the response

type Album added in v1.74.0

type Album struct {
	Name       string            `json:"name"`
	ObjectType string            `json:"objectType"`
	ListType   string            `json:"listType"`
	Direction  string            `json:"direction"`
	Filters    []Filter          `json:"filters,omitempty"`
	RecordName string            `json:"recordName,omitempty"`
	IsFolder   bool              `json:"isFolder,omitempty"`
	Children   map[string]*Album `json:"children,omitempty"`
	// contains filtered or unexported fields
}

Album represents a photo album with its metadata and query configuration

func (*Album) GetPhotoByName added in v1.74.0

func (album *Album) GetPhotoByName(ctx context.Context, filename string) (*Photo, error)

GetPhotoByName looks up a photo by filename, using cache if available CloudKit has no filterBy on filename fields - the only queryable fields are rank, date, smartAlbum, etc. Apple's own icloud.com UI paginates the full album and indexes client-side. On cache miss we must enumerate the entire album via GetPhotos before lookup

func (*Album) GetPhotos added in v1.74.0

func (album *Album) GetPhotos(ctx context.Context) ([]*Photo, error)

GetPhotos retrieves photos from this album using parallel partitions with disk cache

func (*Album) SetTestPhotoCache added in v1.74.0

func (album *Album) SetTestPhotoCache(cache map[string]*Photo)

SetTestPhotoCache populates an album's photo cache for testing

type AuthStateResponse added in v1.74.0

type AuthStateResponse struct {
	TrustedPhoneNumbers     []TrustedPhoneNumber `json:"trustedPhoneNumbers"`
	TrustedPhoneNumber      *TrustedPhoneNumber  `json:"trustedPhoneNumber"`
	NoTrustedDevices        bool                 `json:"noTrustedDevices"`
	AuthenticationType      string               `json:"authenticationType"`
	Hsa2Account             bool                 `json:"hsa2Account"`
	PhoneNumberVerification *AuthStateResponse   `json:"phoneNumberVerification"`
}

AuthStateResponse is the response from GET /appleauth/auth after sign-in Some accounts return fields at top level, others nest them under phoneNumberVerification

type Client

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

Client defines the client configuration

func New

func New(appleID, password, trustToken string, clientID string, cookies []*http.Cookie, sessionSaveCallback sessionSave, remoteName string) (*Client, error)

New creates a new iCloud API client and initializes its HTTP session

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context) error

Authenticate authenticates the client, reusing existing session if valid

func (*Client) CacheDir added in v1.74.0

func (c *Client) CacheDir() string

CacheDir returns the disk cache directory for this remote

func (*Client) DriveService

func (c *Client) DriveService() (*DriveService, error)

DriveService returns the DriveService instance, creating it on first call

func (*Client) Request

func (c *Client) Request(ctx context.Context, opts rest.Opts, request any, response any) (resp *http.Response, err error)

Request makes a request to the iCloud API, re-authenticating on 401/421

type CreateFoldersResponse

type CreateFoldersResponse struct {
	Folders []*DriveItem `json:"folders"`
}

CreateFoldersResponse is the response of a create folders request.

type Document

type Document struct {
	Status struct {
		StatusCode   int    `json:"status_code"`
		ErrorMessage string `json:"error_message"`
	} `json:"status"`
	DocumentID string `json:"document_id"`
	ItemID     string `json:"item_id"`
	Urls       struct {
		URLDownload string `json:"url_download"`
	} `json:"urls"`
	Etag           string       `json:"etag"`
	ParentID       string       `json:"parent_id"`
	Name           string       `json:"name"`
	Type           string       `json:"type"`
	Deleted        bool         `json:"deleted"`
	Mtime          int64        `json:"mtime"`
	LastEditorName string       `json:"last_editor_name"`
	Data           DocumentData `json:"data"`
	Size           int64        `json:"size"`
	Btime          int64        `json:"btime"`
	Zone           string       `json:"zone"`
	FileFlags      struct {
		IsExecutable bool `json:"is_executable"`
		IsWritable   bool `json:"is_writable"`
		IsHidden     bool `json:"is_hidden"`
	} `json:"file_flags"`
	LastOpenedTime   int64 `json:"lastOpenedTime"`
	RestorePath      any   `json:"restorePath"`
	HasChainedParent bool  `json:"hasChainedParent"`
}

Document represents a document on iCloud.

func (*Document) DriveID

func (d *Document) DriveID() string

DriveID returns the drive ID of the Document.

type DocumentData

type DocumentData struct {
	Signature          string `json:"signature"`
	Owner              string `json:"owner"`
	Size               int64  `json:"size"`
	ReferenceSignature string `json:"reference_signature"`
	WrappingKey        string `json:"wrapping_key"`
	PcsInfo            string `json:"pcsInfo"`
}

DocumentData represents the data of a document.

type DocumentUpdateResponse

type DocumentUpdateResponse struct {
	Status struct {
		StatusCode   int    `json:"status_code"`
		ErrorMessage string `json:"error_message"`
	} `json:"status"`
	Results []struct {
		Status struct {
			StatusCode   int    `json:"status_code"`
			ErrorMessage string `json:"error_message"`
		} `json:"status"`
		OperationID any       `json:"operation_id"`
		Document    *Document `json:"document"`
	} `json:"results"`
}

DocumentUpdateResponse is the response of a document update request.

type DriveItem

type DriveItem struct {
	DateCreated         time.Time    `json:"dateCreated"`
	Drivewsid           string       `json:"drivewsid"`
	Docwsid             string       `json:"docwsid"`
	Itemid              string       `json:"item_id"`
	Zone                string       `json:"zone"`
	Name                string       `json:"name"`
	ParentID            string       `json:"parentId"`
	Hierarchy           []DriveItem  `json:"hierarchy"`
	Etag                string       `json:"etag"`
	Type                string       `json:"type"`
	AssetQuota          int64        `json:"assetQuota"`
	FileCount           int64        `json:"fileCount"`
	ShareCount          int64        `json:"shareCount"`
	ShareAliasCount     int64        `json:"shareAliasCount"`
	DirectChildrenCount int64        `json:"directChildrenCount"`
	Items               []*DriveItem `json:"items"`
	NumberOfItems       int64        `json:"numberOfItems"`
	Status              string       `json:"status"`
	Extension           string       `json:"extension,omitempty"`
	DateModified        time.Time    `json:"dateModified"`
	DateChanged         time.Time    `json:"dateChanged"`
	Size                int64        `json:"size,omitempty"`
	LastOpenTime        time.Time    `json:"lastOpenTime"`
	Urls                struct {
		URLDownload string `json:"url_download"`
	} `json:"urls"`
}

DriveItem represents an item on iCloud.

func (*DriveItem) DownloadURL

func (d *DriveItem) DownloadURL() string

DownloadURL returns the download URL of the item.

func (*DriveItem) FullName

func (d *DriveItem) FullName() string

FullName returns the full name of the item. name + extension

func (*DriveItem) IsFolder

func (d *DriveItem) IsFolder() bool

IsFolder returns true if the item is a folder.

type DriveItemRaw

type DriveItemRaw struct {
	ItemID   string            `json:"item_id"`
	ItemInfo *DriveItemRawInfo `json:"item_info"`
}

DriveItemRaw is a raw drive item. not suure what to call this but there seems to be a "unified" and non "unified" drive item response. This is the non unified.

func (*DriveItemRaw) CreatedTime

func (d *DriveItemRaw) CreatedTime() time.Time

CreatedTime returns the creation time of the DriveItemRaw.

It parses the CreatedAt field of the ItemInfo struct and converts it to a time.Time value. If the parsing fails, it returns the zero value of time.Time. The returned time.Time

func (*DriveItemRaw) IntoDriveItem

func (d *DriveItemRaw) IntoDriveItem() *DriveItem

IntoDriveItem converts a DriveItemRaw into a DriveItem.

It takes no parameters. It returns a pointer to a DriveItem.

func (*DriveItemRaw) ModTime

func (d *DriveItemRaw) ModTime() time.Time

ModTime returns the modification time of the DriveItemRaw.

It parses the ModifiedAt field of the ItemInfo struct and converts it to a time.Time value. If the parsing fails, it returns the zero value of time.Time. The returned time.Time value represents the modification time of the DriveItemRaw.

func (*DriveItemRaw) SplitName

func (d *DriveItemRaw) SplitName() (string, string)

SplitName splits the name of a DriveItemRaw into its name and extension.

It returns the name and extension as separate strings. If the name ends with a dot, it means there is no extension, so an empty string is returned for the extension. If the name does not contain a dot, it means

type DriveItemRawInfo

type DriveItemRawInfo struct {
	Name string `json:"name"`
	// Extension is absolutely borked on endpoints so dont use it.
	Extension  string `json:"extension"`
	Size       int64  `json:"size,string"`
	Type       string `json:"type"`
	Version    string `json:"version"`
	ModifiedAt string `json:"modified_at"`
	CreatedAt  string `json:"created_at"`
	Urls       struct {
		URLDownload string `json:"url_download"`
	} `json:"urls"`
}

DriveItemRawInfo is the raw information about a drive item.

type DriveService

type DriveService struct {
	RootID string
	// contains filtered or unexported fields
}

DriveService represents an iCloud Drive service.

func NewDriveService

func NewDriveService(icloud *Client) (*DriveService, error)

NewDriveService creates a new DriveService instance.

func (*DriveService) CopyDocByItemID

func (d *DriveService) CopyDocByItemID(ctx context.Context, itemID string) (*DriveItemRaw, *http.Response, error)

CopyDocByItemID copies a document by its item ID.

func (*DriveService) CreateNewFolderByDriveID

func (d *DriveService) CreateNewFolderByDriveID(ctx context.Context, drivewsid, name string) (*DriveItem, *http.Response, error)

CreateNewFolderByDriveID creates a new folder by its Drive ID.

func (*DriveService) CreateNewFolderByItemID

func (d *DriveService) CreateNewFolderByItemID(ctx context.Context, id, name string) (*DriveItem, *http.Response, error)

CreateNewFolderByItemID creates a new folder by item ID.

func (*DriveService) CreateUpload

func (d *DriveService) CreateUpload(ctx context.Context, size int64, name string) (*UploadResponse, *http.Response, error)

CreateUpload creates an url for an upload.

func (*DriveService) DownloadFile

func (d *DriveService) DownloadFile(ctx context.Context, url string, opt []fs.OpenOption) (*http.Response, error)

DownloadFile downloads a file from the given URL using the provided options.

func (*DriveService) GetDocByItemID

func (d *DriveService) GetDocByItemID(ctx context.Context, id string) (*Document, *http.Response, error)

GetDocByItemID retrieves a document by its item ID.

func (*DriveService) GetDocByPath

func (d *DriveService) GetDocByPath(ctx context.Context, path string) (*Document, *http.Response, error)

GetDocByPath retrieves a document by its path.

func (*DriveService) GetDownloadURLByDriveID

func (d *DriveService) GetDownloadURLByDriveID(ctx context.Context, id string) (string, *http.Response, error)

GetDownloadURLByDriveID retrieves the download URL for a file in the DriveService.

func (*DriveService) GetItemByDriveID

func (d *DriveService) GetItemByDriveID(ctx context.Context, id string, includeChildren bool) (*DriveItem, *http.Response, error)

GetItemByDriveID retrieves a DriveItem by its Drive ID.

func (*DriveService) GetItemByPath

func (d *DriveService) GetItemByPath(ctx context.Context, path string) (*DriveItem, *http.Response, error)

GetItemByPath retrieves a DriveItem by its path.

func (*DriveService) GetItemRawByItemID

func (d *DriveService) GetItemRawByItemID(ctx context.Context, id string) (*DriveItemRaw, *http.Response, error)

GetItemRawByItemID retrieves a DriveItemRaw by its item ID.

func (*DriveService) GetItemsByDriveID

func (d *DriveService) GetItemsByDriveID(ctx context.Context, ids []string, includeChildren bool) ([]*DriveItem, *http.Response, error)

GetItemsByDriveID retrieves DriveItems by their Drive IDs.

func (*DriveService) GetItemsInFolder

func (d *DriveService) GetItemsInFolder(ctx context.Context, id string, limit int64) ([]*DriveItemRaw, *http.Response, error)

GetItemsInFolder retrieves a list of DriveItemRaw objects in a folder with the given ID.

func (*DriveService) MoveItemByDriveID

func (d *DriveService) MoveItemByDriveID(ctx context.Context, id, etag, dstID string, force bool) (*DriveItem, *http.Response, error)

MoveItemByDriveID moves an item by its drive ID.

func (*DriveService) MoveItemByItemID

func (d *DriveService) MoveItemByItemID(ctx context.Context, id, etag, dstID string, force bool) (*DriveItem, *http.Response, error)

MoveItemByItemID moves an item by its item ID to a destination item ID.

func (*DriveService) MoveItemToTrashByID

func (d *DriveService) MoveItemToTrashByID(ctx context.Context, drivewsid, etag string, force bool) (*DriveItem, *http.Response, error)

MoveItemToTrashByID moves an item to the trash based on the item ID.

func (*DriveService) MoveItemToTrashByItemID

func (d *DriveService) MoveItemToTrashByItemID(ctx context.Context, id, etag string, force bool) (*DriveItem, *http.Response, error)

MoveItemToTrashByItemID moves an item to the trash based on the item ID.

func (*DriveService) RenameItemByDriveID

func (d *DriveService) RenameItemByDriveID(ctx context.Context, id, etag, name string, force bool) (*DriveItem, *http.Response, error)

RenameItemByDriveID renames a DriveItem by its drive ID.

func (*DriveService) RenameItemByItemID

func (d *DriveService) RenameItemByItemID(ctx context.Context, id, etag, name string, force bool) (*DriveItem, *http.Response, error)

RenameItemByItemID renames a DriveItem by its item ID.

func (*DriveService) UpdateFile

func (d *DriveService) UpdateFile(ctx context.Context, r *UpdateFileInfo) (*DriveItem, *http.Response, error)

UpdateFile updates a file in the DriveService.

ctx: the context.Context object for the request. r: a pointer to the UpdateFileInfo struct containing the information for the file update. Returns a pointer to the DriveItem struct representing the updated file, the http.Response object, and an error if any.

func (*DriveService) Upload

func (d *DriveService) Upload(ctx context.Context, in io.Reader, size int64, name, uploadURL string) (*SingleFileResponse, *http.Response, error)

Upload uploads a file to the given url

type FileFlags

type FileFlags struct {
	IsExecutable bool `json:"is_executable"`
	IsHidden     bool `json:"is_hidden"`
	IsWritable   bool `json:"is_writable"`
}

FileFlags defines the file flags for a document.

type FileRequest

type FileRequest struct {
	DocumentID   string            `json:"document_id"`
	ItemID       string            `json:"item_id"`
	OwnerDsid    int64             `json:"owner_dsid"`
	DataToken    *FileRequestToken `json:"data_token,omitempty"`
	PackageToken *FileRequestToken `json:"package_token,omitempty"`
	DoubleEtag   string            `json:"double_etag"`
}

FileRequest represents the request of a file.

type FileRequestToken

type FileRequestToken struct {
	URL                string `json:"url"`
	Token              string `json:"token"`
	Signature          string `json:"signature"`
	WrappingKey        string `json:"wrapping_key"`
	ReferenceSignature string `json:"reference_signature"`
}

FileRequestToken represents the token of a file request.

type Filter added in v1.74.0

type Filter struct {
	FieldName  string `json:"fieldName"`
	Comparator string `json:"comparator"`
	FieldValue any    `json:"fieldValue"`
}

Filter represents a CloudKit query filter

type Library added in v1.74.0

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

Library represents a photo library in a specific zone

func (*Library) GetAlbumCounts added in v1.74.0

func (lib *Library) GetAlbumCounts(ctx context.Context) (map[string]int64, error)

GetAlbumCounts returns photo counts for all albums in a single batch request

func (*Library) GetAlbums added in v1.74.0

func (lib *Library) GetAlbums(ctx context.Context) (map[string]*Album, error)

GetAlbums returns all albums for this library

type Photo added in v1.74.0

type Photo struct {
	ID          string
	Filename    string
	Size        int64
	AssetDate   int64 // Unix timestamp in milliseconds
	AddedDate   int64
	Width       int
	Height      int
	IsFavorite  bool
	IsHidden    bool
	SmartAlbums []string // smart album names this photo belongs to (for delta sync routing)
	ResourceKey string   // CloudKit field name for download (default: resOriginalRes)
}

Photo represents a photo or video with its metadata

type PhotosService added in v1.74.0

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

PhotosService manages iCloud Photos API interactions

func NewPhotosService added in v1.74.0

func NewPhotosService(ctx context.Context, client *Client, pacer *fs.Pacer, shouldRetry ShouldRetryFunc) (*PhotosService, error)

NewPhotosService creates a new PhotosService instance

func NewTestPhotosService added in v1.74.0

func NewTestPhotosService(libs map[string]map[string]*Album) *PhotosService

NewTestPhotosService creates a PhotosService with pre-populated libraries for testing

func (*PhotosService) FlushCaches added in v1.74.0

func (ps *PhotosService) FlushCaches()

FlushCaches clears all cached libraries, albums, and photos

func (*PhotosService) GetLibraries added in v1.74.0

func (ps *PhotosService) GetLibraries(ctx context.Context) (map[string]*Library, error)

GetLibraries returns all available photo libraries

func (*PhotosService) GetLibraryAlbumCounts added in v1.74.0

func (ps *PhotosService) GetLibraryAlbumCounts(ctx context.Context) (map[string]int64, error)

GetLibraryAlbumCounts returns the album count for each library in a single batched request, keyed by zone name (e.g. "PrimarySync")

func (*PhotosService) LookupDownloadURL added in v1.74.0

func (ps *PhotosService) LookupDownloadURL(ctx context.Context, recordName, zone, resourceKey string) (string, error)

LookupDownloadURL fetches a fresh download URL for a record recordName is the CPLMaster or CPLAsset recordName depending on the resource resourceKey selects which resource to look up (e.g. "resOriginalRes", "resOriginalVidComplRes" for Live Photo video, "resJPEGFullRes" for edited)

func (*PhotosService) PollForChanges added in v1.74.0

func (ps *PhotosService) PollForChanges(ctx context.Context) []string

PollForChanges checks all zones for changes in a single API call using separate notification tokens, returns zone names that have been modified Used by ChangeNotify - does not consume or interfere with listing delta sync

type RequestError

type RequestError struct {
	Status string
	Text   string
}

RequestError holds info on a result state, icloud can return a 200 but the result is unknown

func (*RequestError) Error

func (e *RequestError) Error() string

Error satisfies the error interface

type Session

type Session struct {
	SessionToken   string         `json:"session_token"`
	Scnt           string         `json:"scnt"`
	SessionID      string         `json:"session_id"`
	AccountCountry string         `json:"account_country"`
	TrustToken     string         `json:"trust_token"`
	ClientID       string         `json:"client_id"`
	AuthAttributes string         `json:"auth_attributes"`
	FrameID        string         `json:"frame_id"`
	Cookies        []*http.Cookie `json:"cookies"`
	AccountInfo    AccountInfo    `json:"account_info"`
	// contains filtered or unexported fields
}

Session represents an iCloud session

func NewSession

func NewSession() *Session

NewSession creates a new Session instance with default values

func (*Session) AuthWithToken

func (s *Session) AuthWithToken(ctx context.Context) error

AuthWithToken authenticates the session

func (*Session) GetAuthHeaders

func (s *Session) GetAuthHeaders(overwrite map[string]string) map[string]string

GetAuthHeaders returns the authentication headers for the session Used for 2FA validation and trust requests to idmsa.apple.com

func (*Session) GetAuthState added in v1.74.0

func (s *Session) GetAuthState(ctx context.Context) (*AuthStateResponse, error)

GetAuthState retrieves the current auth state including trusted phone numbers for SMS 2FA

func (*Session) GetCookieString

func (s *Session) GetCookieString() string

GetCookieString returns the cookie header string for the session

func (*Session) GetHeaders

func (s *Session) GetHeaders(overwrite map[string]string) map[string]string

GetHeaders returns the authentication headers required for a request

func (*Session) Request

func (s *Session) Request(ctx context.Context, opts rest.Opts, request any, response any) (*http.Response, error)

Request makes a JSON API request and extracts session headers

func (*Session) RequestPushNotification added in v1.74.0

func (s *Session) RequestPushNotification(ctx context.Context) error

RequestPushNotification explicitly requests a push notification to trusted devices Required for iOS 26.4+ where the SRP 409 response no longer auto-pushes

func (*Session) RequestSMSCode added in v1.74.0

func (s *Session) RequestSMSCode(ctx context.Context, phoneID int, mode string) error

RequestSMSCode triggers SMS code delivery to a trusted phone number

func (*Session) Requires2FA

func (s *Session) Requires2FA() bool

Requires2FA returns true if the session requires 2FA

func (*Session) SignIn

func (s *Session) SignIn(ctx context.Context, appleID, password string) error

SignIn performs SRP-based authentication against Apple's idmsa endpoint

func (*Session) TrustSession

func (s *Session) TrustSession(ctx context.Context) error

TrustSession trusts the session

func (*Session) Validate2FACode

func (s *Session) Validate2FACode(ctx context.Context, code string) error

Validate2FACode validates the 2FA code from a trusted device push notification

func (*Session) ValidateSMSCode added in v1.74.0

func (s *Session) ValidateSMSCode(ctx context.Context, code string, phoneID int, mode string) error

ValidateSMSCode validates a 2FA code received via SMS

func (*Session) ValidateSession

func (s *Session) ValidateSession(ctx context.Context) error

ValidateSession validates the session

type ShouldRetryFunc added in v1.74.0

type ShouldRetryFunc func(ctx context.Context, resp *http.Response, err error) (bool, error)

ShouldRetryFunc classifies whether an HTTP response/error is retryable

type SingleFileInfo

type SingleFileInfo struct {
	ReferenceSignature string `json:"referenceChecksum"`
	Size               int64  `json:"size"`
	Signature          string `json:"fileChecksum"`
	WrappingKey        string `json:"wrappingKey"`
	Receipt            string `json:"receipt"`
}

SingleFileInfo represents the information of a single file.

type SingleFileResponse

type SingleFileResponse struct {
	SingleFile *SingleFileInfo `json:"singleFile"`
}

SingleFileResponse is the response of a single file request.

type TrustedPhoneNumber added in v1.74.0

type TrustedPhoneNumber struct {
	ID                 int    `json:"id"`
	NumberWithDialCode string `json:"numberWithDialCode"`
	ObfuscatedNumber   string `json:"obfuscatedNumber"`
	PushMode           string `json:"pushMode"`
	NonFTEU            bool   `json:"nonFTEU"`
}

TrustedPhoneNumber represents a phone number that can receive SMS verification codes

type UpdateFileInfo

type UpdateFileInfo struct {
	AllowConflict   bool   `json:"allow_conflict"`
	Btime           int64  `json:"btime"`
	Command         string `json:"command"`
	CreateShortGUID bool   `json:"create_short_guid"`
	Data            struct {
		Receipt            string `json:"receipt,omitempty"`
		ReferenceSignature string `json:"reference_signature,omitempty"`
		Signature          string `json:"signature,omitempty"`
		Size               int64  `json:"size,omitempty"`
		WrappingKey        string `json:"wrapping_key,omitempty"`
	} `json:"data"`
	DocumentID string    `json:"document_id"`
	FileFlags  FileFlags `json:"file_flags"`
	Mtime      int64     `json:"mtime"`
	Path       struct {
		Path               string `json:"path"`
		StartingDocumentID string `json:"starting_document_id"`
	} `json:"path"`
}

UpdateFileInfo represents the information for an update to a file in the DriveService.

func NewUpdateFileInfo

func NewUpdateFileInfo() UpdateFileInfo

NewUpdateFileInfo creates a new UpdateFileInfo object with default values.

Returns an UpdateFileInfo object.

type UploadResponse

type UploadResponse struct {
	URL        string `json:"url"`
	DocumentID string `json:"document_id"`
}

UploadResponse is the response of an upload request.

Jump to

Keyboard shortcuts

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