googledrive

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package googledrive provides an abstraction layer over the Google Drive API. It simplifies creating and uploading files to Google Drive by wrapping the complex API calls into more manageable functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// CreateFolder creates a new folder in Google Drive.
	// folderName is the name of the new folder. parentFolders is an optional list of
	// parent folder IDs where the new folder will be created.
	// Returns the ID of the created folder or an error if the operation fails.
	CreateFolder(folderName string, parentFolders ...string) (string, error)

	// UploadFile uploads a file to Google Drive.
	// file is a pointer to the os.File object to be uploaded. parentFolders is an
	// optional list of parent folder IDs where the file will be uploaded.
	// Returns the ID of the uploaded file or an error if the operation fails.
	UploadFile(file *os.File, parentFolders ...string) (string, error)
}

Client defines the interface for interacting with Google Drive. It abstracts the functionality for creating folders and uploading files.

func New

func New(ctx context.Context, credsFilePath string) (Client, error)

New creates a new instance of a Client. ctx is the context for the drive service, and credsFilePath is the path to the credentials file for Google Drive API. Returns an instance of Client or an error if the drive service cannot be created.

Jump to

Keyboard shortcuts

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