googleworkspace

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package googleworkspace applies Braidplane execution policies to Google's official clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the official Drive and Sheets services.

func New

func New(ctx context.Context, creds Credentials) (*Client, error)

New uses only the runtime token; the SDK must not discover ambient credentials.

func (*Client) CheckAccess

func (c *Client) CheckAccess(_ bool) error

func (*Client) Close

func (c *Client) Close() error

Close releases idle HTTP connections.

func (*Client) CreateNative

func (c *Client) CreateNative(ctx context.Context, folder, name, mimeType string, limits Limits) (*workspace.File, error)

CreateNative uses Drive so the blank file is created directly in the selected folder.

func (*Client) Discovery

func (c *Client) Discovery(ctx context.Context, options workspace.ListOptions, limits Limits, maxItems int) (*workspace.Discovery, error)

Discovery returns one bounded page of files accessible to the connected account.

func (*Client) Download

func (c *Client) Download(ctx context.Context, id string, limits Limits) ([]byte, error)

func (*Client) DownloadTo

func (c *Client) DownloadTo(ctx context.Context, id string, limits Limits, maxBytes int64, dst io.Writer) (*filestream.Metadata, error)

func (*Client) ExportPDF

func (c *Client) ExportPDF(ctx context.Context, id string, limits Limits) ([]byte, error)

func (*Client) ExportPDFTo

func (c *Client) ExportPDFTo(ctx context.Context, id string, limits Limits, maxBytes int64, dst io.Writer) (*filestream.Metadata, error)

func (*Client) FileMetadata

func (c *Client) FileMetadata(ctx context.Context, id string, limits Limits) (*workspace.File, error)

func (*Client) Metadata

func (c *Client) Metadata(ctx context.Context, id string, limits Limits) (*workspace.Metadata, error)

Metadata reads spreadsheet and worksheet metadata.

func (*Client) Read

func (c *Client) Read(ctx context.Context, id, cellRange string, limits Limits) ([][]any, error)

func (*Client) ReadNative

func (c *Client) ReadNative(ctx context.Context, resource, id string, limits Limits) (json.RawMessage, error)

ReadNative retains the native structure, including every Google Docs tab.

func (*Client) ReplaceNative

func (c *Client) ReplaceNative(ctx context.Context, resource, id, match, text string, limits Limits) (int64, error)

ReplaceNative exposes only a single literal, case-sensitive replacement request.

func (*Client) TestConnection

func (c *Client) TestConnection(ctx context.Context, limits Limits) error

func (*Client) Update

func (c *Client) Update(ctx context.Context, id, cellRange string, values [][]any, limits Limits) error

Update overwrites one exact rectangle. A dispatched write is never retried.

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, id, folder, name, contentType string, content []byte, limits Limits) (*workspace.File, error)

Upload has one provider attempt. A transport failure after dispatch is ambiguous.

func (*Client) UploadFrom

func (c *Client) UploadFrom(ctx context.Context, id, folder, name, contentType string, body io.Reader, size int64, limits Limits) (*workspace.File, error)

UploadFrom uses bounded SDK chunks. Completion still has provider-specific ambiguity; a successful source read alone cannot establish delivery.

type Credentials

type Credentials struct {
	AccessToken   string   `json:"access_token" validate:"required"`
	GrantedScopes []string `json:"granted_scopes"`
}

Credentials holds the short-lived OAuth access token supplied at runtime.

type Limits

type Limits struct {
	Timeout          time.Duration
	MaxResponseBytes int64
	MaxRequestBytes  int64
	RetryAttempts    int
	RetryBackoff     time.Duration
}

Limits bound one provider operation.

Jump to

Keyboard shortcuts

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