document

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrShareConflict   = sdkdocument.ErrShareConflict
	ErrVersionConflict = sdkdocument.ErrVersionConflict
)

Re-export SDK sentinel errors.

View Source
var (
	ParseMultipartDocument = sdkdocument.ParseMultipartDocument
)

Re-export SDK functions.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether err indicates the document does not exist (HTTP 404), as opposed to a transient, auth, or other failure.

func ParseShareRef

func ParseShareRef(input string) (id, host string, err error)

ParseShareRef accepts a bare share ID or a pasted share link (`https://<env>/.../#share=<id>`) and returns the share ID plus the link's lowercase hostname ("" for a bare ID).

func UIURL

func UIURL(baseURL, docType, id string) string

UIURL returns the URL at which the environment's UI shows the document, or "" when the document type has no known viewer app. Custom document types (e.g. "acme:config") are not served by an app whose ID follows from the type, so no URL is better than a broken guess. The ID is escaped as one path segment, so a caller-chosen ID containing "/", "?", "#" or ":" cannot address a different route or lose its tail. Trailing slashes on baseURL are dropped, so an environment configured as "https://host/" does not yield "//ui/".

Types

type AddDirectShareRecipientsOptions

type AddDirectShareRecipientsOptions = sdkdocument.AddDirectShareRecipientsOptions

Re-export SDK types that don't have table tags (pure data types).

type CreateDirectShareRequest

type CreateDirectShareRequest = sdkdocument.CreateDirectShareRequest

Re-export SDK types that don't have table tags (pure data types).

type CreateEnvironmentShareRequest

type CreateEnvironmentShareRequest = sdkdocument.CreateEnvironmentShareRequest

Re-export SDK types that don't have table tags (pure data types).

type CreateRequest

type CreateRequest = sdkdocument.CreateRequest

Re-export SDK types that don't have table tags (pure data types).

type DeletionInfo

type DeletionInfo = sdkdocument.DeletionInfo

Re-export SDK trash types that don't have table tags.

type DirectShare

type DirectShare struct {
	ID         string   `json:"id" table:"ID"`
	DocumentID string   `json:"documentId" table:"DOCUMENT_ID"`
	Access     []string `json:"access" table:"ACCESS"`
}

DirectShare is the CLI read model for a direct share.

func (DirectShare) ExactAccess

func (s DirectShare) ExactAccess(level string) bool

ExactAccess reports whether the share grants exactly the given access level. Delegates to the SDK DirectShare.ExactAccess method.

type DirectShareList

type DirectShareList struct {
	Shares      []DirectShare `json:"directShares"`
	TotalCount  int           `json:"totalCount"`
	NextPageKey string        `json:"nextPageKey,omitempty"`
}

DirectShareList represents a list of direct shares.

type Document

type Document struct {
	ID          string    `json:"id" table:"ID"`
	Name        string    `json:"name" table:"NAME"`
	Type        string    `json:"type" table:"TYPE"`
	Owner       string    `json:"owner" table:"OWNER"`
	IsPrivate   bool      `json:"isPrivate" table:"PRIVATE"`
	Created     time.Time `json:"-" table:"CREATED"`
	Description string    `json:"description,omitempty" table:"DESCRIPTION,wide"`
	Version     int       `json:"version" table:"VERSION,wide"`
	Modified    time.Time `json:"-" table:"MODIFIED,wide"`
	Content     []byte    `json:"-" table:"-"`

	OriginAppID       string                   `json:"originAppId,omitempty" yaml:"originAppId,omitempty" table:"-"`
	OriginExtensionID string                   `json:"originExtensionId,omitempty" yaml:"originExtensionId,omitempty" table:"-"`
	Labels            []string                 `json:"labels,omitempty" yaml:"labels,omitempty" table:"-"`
	ShareInfo         *sdkdocument.ShareInfo   `json:"shareInfo,omitempty" yaml:"shareInfo,omitempty" table:"-"`
	UserContext       *sdkdocument.UserContext `json:"userContext,omitempty" yaml:"userContext,omitempty" table:"-"`
}

Document is the CLI read model for a document resource. It mirrors the SDK type but adds table tags for CLI table output.

func ConvertToDocuments

func ConvertToDocuments(list *DocumentList) []Document

ConvertToDocuments converts a list of DocumentMetadata to a list of Documents for table output.

func (Document) MarshalJSON

func (d Document) MarshalJSON() ([]byte, error)

MarshalJSON delegates to the SDK Document marshaler so that the document Content (stored as raw []byte) is rendered as structured JSON rather than being dropped (the field is tagged json:"-") or, for default marshaling, emitted as a list of raw byte values.

func (Document) MarshalYAML

func (d Document) MarshalYAML() (any, error)

MarshalYAML delegates to the SDK Document marshaler so that the document Content is rendered as structured YAML rather than a list of raw byte values.

func (*Document) UnmarshalJSON

func (d *Document) UnmarshalJSON(data []byte) error

UnmarshalJSON delegates to the SDK Document unmarshaler to handle flexible version fields.

type DocumentFilters

type DocumentFilters = sdkdocument.DocumentFilters

Re-export SDK types that don't have table tags (pure data types).

type DocumentList

type DocumentList = sdkdocument.DocumentList

Re-export SDK types that don't have table tags (pure data types).

type DocumentMetadata

type DocumentMetadata = sdkdocument.DocumentMetadata

Re-export SDK types that don't have table tags (pure data types).

type EnvironmentShare

type EnvironmentShare struct {
	ID         string   `json:"id" table:"ID"`
	DocumentID string   `json:"documentId" table:"DOCUMENT_ID"`
	Access     []string `json:"access" table:"ACCESS"`
	ClaimCount int      `json:"claimCount" table:"CLAIM_COUNT"`
}

EnvironmentShare is the CLI read model for an environment share.

func (EnvironmentShare) HasAccess

func (s EnvironmentShare) HasAccess(level string) bool

HasAccess reports whether the share grants the given access level. Delegates to the SDK EnvironmentShare.HasAccess method.

type EnvironmentShareClaim

type EnvironmentShareClaim struct {
	DocumentID   string   `json:"documentId" yaml:"documentId" table:"DOCUMENT_ID"`
	Name         string   `json:"name,omitempty" yaml:"name,omitempty" table:"NAME"`
	DocumentType string   `json:"documentType" yaml:"documentType" table:"TYPE"`
	Access       []string `json:"access" yaml:"access" table:"-"`
	AccessLevel  string   `json:"-" yaml:"-" table:"ACCESS"`
	URL          string   `json:"url,omitempty" yaml:"url,omitempty" table:"URL,wide"`
}

EnvironmentShareClaim is the CLI read model for a claimed environment share.

type EnvironmentShareList

type EnvironmentShareList struct {
	Shares      []EnvironmentShare `json:"environment-shares"`
	TotalCount  int                `json:"totalCount"`
	NextPageKey string             `json:"nextPageKey,omitempty"`
}

EnvironmentShareList represents a list of environment shares.

type Handler

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

Handler handles document resources (dashboards, notebooks, etc.) It delegates to the SDK handler and adds CLI-specific convenience methods.

func NewHandler

func NewHandler(c *client.Client) *Handler

NewHandler creates a new document handler.

func (*Handler) AddDirectShareRecipients

func (h *Handler) AddDirectShareRecipients(shareID string, recipients []SsoEntity) error

AddDirectShareRecipients adds recipients to a direct share.

func (*Handler) AddDirectShareRecipientsWithOptions

func (h *Handler) AddDirectShareRecipientsWithOptions(shareID string, recipients []SsoEntity,
	opts AddDirectShareRecipientsOptions) error

AddDirectShareRecipientsWithOptions adds recipients to a direct share, honoring opts.

func (*Handler) ClaimEnvironmentShare

func (h *Handler) ClaimEnvironmentShare(shareID string) (*EnvironmentShareClaim, error)

ClaimEnvironmentShare claims an environment share, granting the current user access to the shared document.

func (*Handler) Create

func (h *Handler) Create(req CreateRequest) (*Document, error)

Create creates a new document.

func (*Handler) CreateDirectShare

func (h *Handler) CreateDirectShare(req CreateDirectShareRequest) (*DirectShare, error)

CreateDirectShare creates a direct share for a document.

func (*Handler) CreateEnvironmentShare

func (h *Handler) CreateEnvironmentShare(req CreateEnvironmentShareRequest) (*EnvironmentShare, error)

CreateEnvironmentShare creates an environment-wide share for a document.

func (*Handler) Delete

func (h *Handler) Delete(id string, version int) error

Delete deletes a document.

func (*Handler) DeleteDirectShare

func (h *Handler) DeleteDirectShare(shareID string) error

DeleteDirectShare deletes a direct share.

func (*Handler) DeleteEnvironmentShare

func (h *Handler) DeleteEnvironmentShare(shareID string) error

DeleteEnvironmentShare deletes an environment share.

func (*Handler) DeleteSnapshot

func (h *Handler) DeleteSnapshot(documentID string, version int) error

DeleteSnapshot deletes a specific snapshot.

func (*Handler) EnsureEnvironmentShare

func (h *Handler) EnsureEnvironmentShare(documentID, access string) (*EnvironmentShare, error)

EnsureEnvironmentShare idempotently ensures the document has an environment share at the given access level, AND that the document itself is marked public (isPrivate=false).

This is a CLI-specific composite operation not present in the SDK.

func (*Handler) Get

func (h *Handler) Get(id string) (*Document, error)

Get retrieves a specific document by ID.

func (*Handler) GetAtVersion

func (h *Handler) GetAtVersion(id string, version int) (*Document, error)

GetAtVersion retrieves a document's content at a specific snapshot version.

func (*Handler) GetEnvironmentShare

func (h *Handler) GetEnvironmentShare(shareID string) (*EnvironmentShare, error)

GetEnvironmentShare retrieves an environment share by ID.

func (*Handler) GetMetadata

func (h *Handler) GetMetadata(id string) (*DocumentMetadata, error)

GetMetadata retrieves only the metadata for a document.

func (*Handler) GetRaw

func (h *Handler) GetRaw(id string) ([]byte, error)

GetRaw retrieves a document's content as raw bytes.

func (*Handler) GetSnapshot

func (h *Handler) GetSnapshot(documentID string, version int) (*Snapshot, error)

GetSnapshot retrieves metadata for a specific snapshot.

func (*Handler) List

func (h *Handler) List(filters DocumentFilters) (*DocumentList, error)

List retrieves documents matching the provided filters with automatic pagination.

func (*Handler) ListDirectShares

func (h *Handler) ListDirectShares(documentID string) (*DirectShareList, error)

ListDirectShares lists direct shares for a document.

func (*Handler) ListEnvironmentShares

func (h *Handler) ListEnvironmentShares(documentID string) (*EnvironmentShareList, error)

ListEnvironmentShares lists environment shares for a document (or all if documentID is empty).

func (*Handler) ListSnapshots

func (h *Handler) ListSnapshots(documentID string) (*SnapshotList, error)

ListSnapshots retrieves all snapshots for a document.

func (*Handler) RemoveDirectShareRecipients

func (h *Handler) RemoveDirectShareRecipients(shareID string, recipientIDs []string) error

RemoveDirectShareRecipients removes recipients from a direct share.

func (*Handler) RestoreSnapshot

func (h *Handler) RestoreSnapshot(documentID string, version int) (*DocumentMetadata, error)

RestoreSnapshot restores a document to a specific snapshot version.

func (*Handler) SetDocumentPublic

func (h *Handler) SetDocumentPublic(id string, version int) error

SetDocumentPublic flips a document's isPrivate flag to false.

func (*Handler) Update

func (h *Handler) Update(id string, version int, content []byte, contentType string) (*Document, error)

Update updates a document's content.

func (*Handler) UpdateDocument

func (h *Handler) UpdateDocument(id string, version int, req UpdateRequest) (*Document, error)

UpdateDocument performs a partial update of a document (content, name, description, and/or labels). It is the general form behind Update / UpdateWithMetadata and the only write path that can set labels.

func (*Handler) UpdateWithMetadata

func (h *Handler) UpdateWithMetadata(id string, version int, content []byte, contentType string, name string, description string) (*Document, error)

UpdateWithMetadata updates a document's content and optionally its metadata (name, description).

type ModificationInfo

type ModificationInfo = sdkdocument.ModificationInfo

Re-export SDK types that don't have table tags (pure data types).

type RestoreOptions

type RestoreOptions = sdkdocument.RestoreOptions

Re-export SDK trash types that don't have table tags.

type ShareInfo

type ShareInfo = sdkdocument.ShareInfo

Re-export SDK types that don't have table tags (pure data types).

type Snapshot

type Snapshot struct {
	SnapshotVersion  int                         `json:"snapshotVersion" table:"VERSION"`
	DocumentVersion  int                         `json:"documentVersion" table:"DOC_VERSION,wide"`
	Description      string                      `json:"description,omitempty" table:"DESCRIPTION"`
	ModificationInfo sdkdocument.SnapshotModInfo `json:"modificationInfo" table:"-"`
	CreatedBy        string                      `json:"-" table:"CREATED_BY"`
	CreatedTime      time.Time                   `json:"-" table:"CREATED"`
}

Snapshot is the CLI read model for a document snapshot.

func (Snapshot) MarshalYAML

func (s Snapshot) MarshalYAML() (any, error)

MarshalYAML renders the snapshot through its JSON shape so YAML output matches JSON: the display-only CreatedBy/CreatedTime (json:"-", duplicates of ModificationInfo) are excluded and keys keep their camelCase. Without it, yaml.v3 reflection would lowercase keys and leak createdby/createdtime.

func (*Snapshot) UnmarshalJSON

func (s *Snapshot) UnmarshalJSON(data []byte) error

UnmarshalJSON delegates to the SDK Snapshot unmarshaler to handle flexible int/string versions.

type SnapshotList

type SnapshotList struct {
	Snapshots   []Snapshot `json:"snapshots"`
	TotalCount  int        `json:"totalCount"`
	NextPageKey string     `json:"nextPageKey,omitempty"`
}

SnapshotList represents a list of snapshots.

type SnapshotModInfo

type SnapshotModInfo = sdkdocument.SnapshotModInfo

Re-export SDK types that don't have table tags (pure data types).

type SsoEntity

type SsoEntity = sdkdocument.SsoEntity

Re-export SDK types that don't have table tags (pure data types).

type TrashDocumentListEntry

type TrashDocumentListEntry struct {
	ID           string       `json:"id" yaml:"id" table:"ID"`
	Name         string       `json:"name" yaml:"name" table:"NAME"`
	Type         string       `json:"type" yaml:"type" table:"TYPE"`
	DeletionInfo DeletionInfo `json:"deletionInfo" yaml:"deletionInfo" table:"-"`
	DeletedBy    string       `json:"-" yaml:"-" table:"DELETED BY"`
	DeletedAt    time.Time    `json:"-" yaml:"-" table:"DELETED AT"`
}

TrashDocumentListEntry is the CLI read model for a trashed document list entry.

type TrashHandler

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

TrashHandler handles trash operations for documents. It delegates to the SDK trash handler.

func NewTrashHandler

func NewTrashHandler(c *client.Client) *TrashHandler

NewTrashHandler creates a new trash handler.

func (*TrashHandler) Delete

func (h *TrashHandler) Delete(id string) error

Delete permanently deletes a document from trash.

func (*TrashHandler) Get

func (h *TrashHandler) Get(id string) (*TrashedDocument, error)

Get retrieves a specific trashed document by ID.

func (*TrashHandler) List

List retrieves trashed documents matching the provided filters.

func (*TrashHandler) Restore

func (h *TrashHandler) Restore(id string, opts RestoreOptions) error

Restore restores a document from trash.

type TrashList

type TrashList struct {
	Documents   []TrashDocumentListEntry `json:"documents"`
	TotalCount  int                      `json:"totalCount"`
	NextPageKey string                   `json:"nextPageKey,omitempty"`
}

TrashList represents a list of trashed documents.

type TrashListOptions

type TrashListOptions = sdkdocument.TrashListOptions

Re-export SDK trash types that don't have table tags.

type TrashedDocument

type TrashedDocument struct {
	ID               string           `json:"id" yaml:"id" table:"ID"`
	Name             string           `json:"name" yaml:"name" table:"NAME"`
	Type             string           `json:"type" yaml:"type" table:"TYPE"`
	Version          int              `json:"version" yaml:"version" table:"VERSION,wide"`
	Owner            string           `json:"owner" yaml:"owner" table:"OWNER,wide"`
	DeletionInfo     DeletionInfo     `json:"deletionInfo" yaml:"deletionInfo" table:"-"`
	ModificationInfo ModificationInfo `json:"modificationInfo,omitempty" yaml:"modificationInfo,omitempty" table:"-"`
	DeletedBy        string           `json:"-" yaml:"-" table:"DELETED BY"`
	DeletedAt        time.Time        `json:"-" yaml:"-" table:"DELETED AT"`
}

TrashedDocument is the CLI read model for a trashed document.

type UpdateRequest

type UpdateRequest = sdkdocument.UpdateRequest

Re-export SDK types that don't have table tags (pure data types).

type UserContext

type UserContext = sdkdocument.UserContext

Re-export SDK types that don't have table tags (pure data types).

Jump to

Keyboard shortcuts

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