gdrive

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GroupAPI is the group API scope use in this package
	GroupAPI = "sxlibs.k8s.startx.fr"
	// GroupName is the group name use in this package
	GroupName = "gdrive"
)
View Source
const (
	// GroupName is the group name use in this package
	GroupNameGDrive = "gsheet"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GDrive

type GDrive struct {
	CredentialFilePath string
	CredentialFileBase string
	CredentialFileName string
	Domain             string
	// contains filtered or unexported fields
}

GDrive is a wrapper around api.Config

func NewGDrive

func NewGDrive(credentialFileName string, credentialFileDir string, domain string) *GDrive

Initialize a gdrive object ex:

gdrive := kc.NewGDrive()

func (*GDrive) CheckCredentials

func (gdrive *GDrive) CheckCredentials() error

CheckCredentials verifies if the credentials file is valid for connecting to Google API

func (*GDrive) SetCredentialsContent

func (gdrive *GDrive) SetCredentialsContent(
	typeName string,
	project_id string,
	private_key_id string,
	private_key string,
	client_email string,
	client_id string,
	auth_uri string,
	token_uri string,
	auth_provider_x509_cert_url string,
	client_x509_cert_url string,
	universe_domain string,
) error

Set the credentials content from params

func (*GDrive) SetCredentialsFile

func (gdrive *GDrive) SetCredentialsFile(credentialFileName string, credentialFileDir string) *GDrive

Set the credentials file name

type GDriveSpreadsheet

type GDriveSpreadsheet struct {
	GDrive        *GDrive
	Service       *sheets.Service
	SpreadsheetID string
	Spreadsheet   *sheets.Spreadsheet
	// contains filtered or unexported fields
}

GDrive is a wrapper around api.Config

func NewGDriveSpreadsheet

func NewGDriveSpreadsheet(gdrive *GDrive, spreadsheetID string) *GDriveSpreadsheet

Initialize a gdrive object ex:

gdrive := kc.NewGDrive()

func (*GDriveSpreadsheet) AddSheet

func (spreadsheet *GDriveSpreadsheet) AddSheet(title string) (int64, error)

Add a sheet and return its object

func (*GDriveSpreadsheet) AddSpreadsheet

func (spreadsheet *GDriveSpreadsheet) AddSpreadsheet(spreadsheetTitle string, isDomain bool) error

Add a spreadsheet and load it

func (*GDriveSpreadsheet) GetSheetByTitle

func (spreadsheet *GDriveSpreadsheet) GetSheetByTitle(title string) (int64, error)

Get a sheet and return its ID

func (*GDriveSpreadsheet) GetSpreadsheet

func (spreadsheet *GDriveSpreadsheet) GetSpreadsheet(spreadsheetID string) (*sheets.Spreadsheet, error)

Get a spreadsheet and return its object

func (*GDriveSpreadsheet) InitSpreadsheet

func (spreadsheet *GDriveSpreadsheet) InitSpreadsheet() error

Initialize a spreadsheet must be used prior to calling any other method

func (*GDriveSpreadsheet) LoadSpreadsheet

func (spreadsheet *GDriveSpreadsheet) LoadSpreadsheet() error

Load a spreadsheet

func (*GDriveSpreadsheet) SetSpreadsheetService

func (spreadsheet *GDriveSpreadsheet) SetSpreadsheetService() error

Set the spreadsheet Service

func (*GDriveSpreadsheet) UpsertSheet

func (spreadsheet *GDriveSpreadsheet) UpsertSheet(title string) (int64, error)

Update or insert a sheet and return its object

type SACreds

type SACreds struct {
	Type                string `json:"type"`
	ProjectID           string `json:"project_id"`
	PrivateKeyID        string `json:"private_key_id"`
	PrivateKey          string `json:"private_key"`
	ClientEmail         string `json:"client_email"`
	ClientID            string `json:"client_id"`
	AuthURI             string `json:"auth_uri"`
	TokenURI            string `json:"token_uri"`
	AuthProviderCertURL string `json:"auth_provider_x509_cert_url"`
	ClientCertURL       string `json:"client_x509_cert_url"`
	UniverseDomain      string `json:"universe_domain"`
}

Jump to

Keyboard shortcuts

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