Versions in this module Expand all Collapse all v1 v1.0.0 Sep 10, 2023 Changes in this version + var DOWNLOAD_BATCH_BLOCK_SIZE = 1 + var ErrCantFindActiveRevision = errors.New("can't find an active revision") + var ErrCantFindDraftRevision = errors.New("can't find a draft revision") + var ErrCantLocateRevision = errors.New(...) + var ErrDataFolderNameIsEmpty = errors.New("please supply a DataFolderName to enabling file downloading") + var ErrDownloadedBlockHashVerificationFailed = errors.New("the hash of the downloaded block doesn't match the original hash") + var ErrDraftExists = errors.New(...) + var ErrFolderIsNotEmpty = errors.New("folder can't be deleted because it is not empty") + var ErrInternalErrorOnFileUpload = errors.New("either link or file creation request should be not nil") + var ErrLinkMustBeActive = errors.New("can not operate on link state other than active") + var ErrLinkMustNotBeNil = errors.New("missing input proton link") + var ErrLinkTypeMustToBeFileType = errors.New("the link type must be of file type") + var ErrLinkTypeMustToBeFolderType = errors.New("the link type must be of folder type") + var ErrMainSharePreconditionsFailed = errors.New("the main share assumption has failed") + var ErrMissingInputUploadAndCollectBlockData = errors.New("missing either session key or key ring") + var ErrNoKeyringForSignatureVerification = errors.New(("internal error for signature verification - no keyring is generated")) + var ErrSeekOffsetAfterSkippingBlocks = errors.New("internal error for download seek - the offset after skipping blocks is wrong") + var ErrWrongUsageOfGetLink = errors.New("internal error for getLink - empty linkID passed in") + var ErrWrongUsageOfGetLinkKR = errors.New("internal error for GetLinkKR - nil passed in for link") + var LIB_VERSION = "1.0.0" + var UPLOAD_BATCH_BLOCK_SIZE = 8 + var UPLOAD_BLOCK_SIZE = 4 * 1024 * 1024 + func NewDefaultConfig() *common.Config + func RandomString(n int) string + func StringFn(n int, randIntn func(n int) int) string + type FileDownloadReader struct + func (r *FileDownloadReader) Close() error + func (r *FileDownloadReader) Read(p []byte) (int, error) + type FileSystemAttrs struct + BlockSizes []int64 + Digests string + ModificationTime time.Time + Size int64 + type MailSendingParameters struct + EmailAttachments []string + EmailContentIDs []string + EmailSubject string + RecipientEmailAddress string + TemplateFile string + type ProtonDirectoryData struct + IsFolder bool + Link *proton.Link + Name string + type ProtonDrive struct + Config *common.Config + DefaultAddrKR *crypto.KeyRing + MainShare *proton.Share + MainShareKR *crypto.KeyRing + RootLink *proton.Link + func NewProtonDrive(ctx context.Context, config *common.Config, authHandler proton.AuthHandler, ...) (*ProtonDrive, *common.ProtonDriveCredential, error) + func (protonDrive *ProtonDrive) About(ctx context.Context) (*proton.User, error) + func (protonDrive *ProtonDrive) ClearCache() + func (protonDrive *ProtonDrive) CreateNewFolder(ctx context.Context, parentLink *proton.Link, folderName string) (string, error) + func (protonDrive *ProtonDrive) CreateNewFolderByID(ctx context.Context, parentLinkID string, folderName string) (string, error) + func (protonDrive *ProtonDrive) DownloadFile(ctx context.Context, link *proton.Link, offset int64) (io.ReadCloser, int64, *FileSystemAttrs, error) + func (protonDrive *ProtonDrive) DownloadFileByID(ctx context.Context, linkID string, offset int64) (io.ReadCloser, int64, *FileSystemAttrs, error) + func (protonDrive *ProtonDrive) EmptyRootFolder(ctx context.Context) error + func (protonDrive *ProtonDrive) EmptyTrash(ctx context.Context) error + func (protonDrive *ProtonDrive) GetActiveRevisionAttrs(ctx context.Context, link *proton.Link) (*FileSystemAttrs, error) + func (protonDrive *ProtonDrive) GetActiveRevisionAttrsByID(ctx context.Context, linkID string) (*FileSystemAttrs, error) + func (protonDrive *ProtonDrive) GetActiveRevisionWithAttrs(ctx context.Context, link *proton.Link) (*proton.Revision, *FileSystemAttrs, error) + func (protonDrive *ProtonDrive) GetLink(ctx context.Context, linkID string) (*proton.Link, error) + func (protonDrive *ProtonDrive) GetRevisions(ctx context.Context, link *proton.Link, revisionType proton.RevisionState) ([]*proton.RevisionMetadata, error) + func (protonDrive *ProtonDrive) ListDirectory(ctx context.Context, folderLinkID string) ([]*ProtonDirectoryData, error) + func (protonDrive *ProtonDrive) Logout(ctx context.Context) error + func (protonDrive *ProtonDrive) MoveFile(ctx context.Context, srcLink *proton.Link, dstParentLink *proton.Link, ...) error + func (protonDrive *ProtonDrive) MoveFileByID(ctx context.Context, srcLinkID, dstParentLinkID string, dstName string) error + func (protonDrive *ProtonDrive) MoveFileToTrashByID(ctx context.Context, linkID string) error + func (protonDrive *ProtonDrive) MoveFolder(ctx context.Context, srcLink *proton.Link, dstParentLink *proton.Link, ...) error + func (protonDrive *ProtonDrive) MoveFolderByID(ctx context.Context, srcLinkID, dstParentLinkID, dstName string) error + func (protonDrive *ProtonDrive) MoveFolderToTrashByID(ctx context.Context, linkID string, onlyOnEmpty bool) error + func (protonDrive *ProtonDrive) SearchByNameInActiveFolder(ctx context.Context, folderLink *proton.Link, targetName string, ...) (*proton.Link, error) + func (protonDrive *ProtonDrive) SearchByNameInActiveFolderByID(ctx context.Context, folderLinkID string, targetName string, ...) (*proton.Link, error) + func (protonDrive *ProtonDrive) SearchByNameRecursively(ctx context.Context, folderLink *proton.Link, targetName string, isFolder bool, ...) (*proton.Link, error) + func (protonDrive *ProtonDrive) SendEmail(ctx context.Context, i int, errChan chan error, config *MailSendingParameters) + func (protonDrive *ProtonDrive) UploadFileByPath(ctx context.Context, parentLink *proton.Link, filename string, filePath string, ...) (string, *proton.RevisionXAttrCommon, error) + func (protonDrive *ProtonDrive) UploadFileByReader(ctx context.Context, parentLinkID string, filename string, modTime time.Time, ...) (string, *proton.RevisionXAttrCommon, error)