gdrive

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

View Source
const USE_DEFAULT_MAX_CONCURRENCY = -1

Variables

This section is empty.

Functions

func GetFileIdAndTypeFromUrl

func GetFileIdAndTypeFromUrl(url string) (string, string)

Uses regex to extract the file ID and the file type (type: file, folder) from the given URL

func GetOAuthUrl added in v1.1.0

func GetOAuthUrl(config *oauth2.Config) string

func ParseConfigFromClientJson added in v1.1.0

func ParseConfigFromClientJson(credsJson []byte) (*oauth2.Config, error)

func ParseTokenJson added in v1.1.0

func ParseTokenJson(tokenJson []byte) (*oauth2.Token, error)

func ProcessAuthCode added in v1.1.0

func ProcessAuthCode(ctx context.Context, authCode string, config *oauth2.Config) (*oauth2.Token, error)

func ProcessPostText

func ProcessPostText(postBodyStr, postFolderPath string, downloadGdrive bool, logUrls bool) []*httpfuncs.ToDownload

Process and detects for any external download links from the post's text content

func StartOAuthListener added in v1.1.0

func StartOAuthListener(ctx context.Context, config *oauth2.Config) (*oauth2.Token, error)

Types

type CredsInputs added in v1.1.0

type CredsInputs struct {
	ApiKey             string
	SrvAccJson         []byte
	ClientSecretJson   []byte
	UserOauthTokenJson []byte
}

type GDrive

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

func GetNewGDrive added in v1.1.0

func GetNewGDrive(ctx context.Context, creds *CredsInputs, maxDownloadWorkers int) (*GDrive, error)

Returns a GDrive structure with the given API key and max download workers

func (*GDrive) DownloadFile

func (gdrive *GDrive) DownloadFile(ctx context.Context, fileInfo *GdriveFileToDl, filePath string, progBarInfo *progress.ProgressBarInfo, queue chan struct{}) error

Downloads the given GDrive file using GDrive API v3

If the md5Checksum has a mismatch, the file will be overwritten and downloaded again Downloads the given GDrive file using GDrive API v3

If the md5Checksum has a mismatch, the file will be overwritten and downloaded again

func (*GDrive) DownloadGdriveUrls

func (gdrive *GDrive) DownloadGdriveUrls(gdriveUrls []*httpfuncs.ToDownload, progBarInfo *progress.ProgressBarInfo) []error

Downloads multiple GDrive files based on a slice of GDrive URL strings in parallel

func (*GDrive) DownloadMultipleFiles

func (gdrive *GDrive) DownloadMultipleFiles(files []*GdriveFileToDl, progBarInfo *progress.ProgressBarInfo) []error

Downloads the multiple GDrive file in parallel using GDrive API v3

func (*GDrive) GetFileDetails

func (gdrive *GDrive) GetFileDetails(gdriveInfo *GDriveToDl) (*GdriveFileToDl, error)

Retrieves the file details of the given GDrive file using GDrive API v3

func (*GDrive) GetFolderContents

func (gdrive *GDrive) GetFolderContents(folderId, logPath string) ([]*GdriveFileToDl, error)

Returns the contents of the given GDrive folder

func (*GDrive) GetNestedFolderContents

func (gdrive *GDrive) GetNestedFolderContents(folderId, logPath string) ([]*GdriveFileToDl, error)

Retrieves the content of a GDrive folder and its subfolders recursively using GDrive API v3

func (*GDrive) Release added in v1.1.0

func (gdrive *GDrive) Release()

type GDriveToDl

type GDriveToDl struct {
	Id       string
	Type     string
	FilePath string
}

type GdriveError

type GdriveError struct {
	Err      error
	FilePath string
}

type GdriveFileToDl

type GdriveFileToDl struct {
	Id          string
	Name        string
	Size        int64
	MimeType    string
	Md5Checksum string
	FilePath    string
}

Jump to

Keyboard shortcuts

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