Documentation
¶
Overview ¶
Package googleworkspace applies Braidplane execution policies to Google's official clients.
Index ¶
- type Client
- func (c *Client) CheckAccess(_ bool) error
- func (c *Client) Close() error
- func (c *Client) CreateNative(ctx context.Context, folder, name, mimeType string, limits Limits) (*workspace.File, error)
- func (c *Client) Discovery(ctx context.Context, options workspace.ListOptions, limits Limits, ...) (*workspace.Discovery, error)
- func (c *Client) Download(ctx context.Context, id string, limits Limits) ([]byte, error)
- func (c *Client) DownloadTo(ctx context.Context, id string, limits Limits, maxBytes int64, dst io.Writer) (*filestream.Metadata, error)
- func (c *Client) ExportPDF(ctx context.Context, id string, limits Limits) ([]byte, error)
- func (c *Client) ExportPDFTo(ctx context.Context, id string, limits Limits, maxBytes int64, dst io.Writer) (*filestream.Metadata, error)
- func (c *Client) FileMetadata(ctx context.Context, id string, limits Limits) (*workspace.File, error)
- func (c *Client) Metadata(ctx context.Context, id string, limits Limits) (*workspace.Metadata, error)
- func (c *Client) Read(ctx context.Context, id, cellRange string, limits Limits) ([][]any, error)
- func (c *Client) ReadNative(ctx context.Context, resource, id string, limits Limits) (json.RawMessage, error)
- func (c *Client) ReplaceNative(ctx context.Context, resource, id, match, text string, limits Limits) (int64, error)
- func (c *Client) TestConnection(ctx context.Context, limits Limits) error
- func (c *Client) Update(ctx context.Context, id, cellRange string, values [][]any, limits Limits) error
- func (c *Client) Upload(ctx context.Context, id, folder, name, contentType string, content []byte, ...) (*workspace.File, error)
- func (c *Client) UploadFrom(ctx context.Context, id, folder, name, contentType string, body io.Reader, ...) (*workspace.File, error)
- type Credentials
- type Limits
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 (*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) DownloadTo ¶
func (*Client) ExportPDFTo ¶
func (*Client) FileMetadata ¶
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) 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 (*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.