Documentation
¶
Index ¶
- Variables
- func IsNotFound(err error) bool
- func ParseShareRef(input string) (id, host string, err error)
- func UIURL(baseURL, docType, id string) string
- type AddDirectShareRecipientsOptions
- type CreateDirectShareRequest
- type CreateEnvironmentShareRequest
- type CreateRequest
- type DeletionInfo
- type DirectShare
- type DirectShareList
- type Document
- type DocumentFilters
- type DocumentList
- type DocumentMetadata
- type EnvironmentShare
- type EnvironmentShareClaim
- type EnvironmentShareList
- type Handler
- func (h *Handler) AddDirectShareRecipients(shareID string, recipients []SsoEntity) error
- func (h *Handler) AddDirectShareRecipientsWithOptions(shareID string, recipients []SsoEntity, opts AddDirectShareRecipientsOptions) error
- func (h *Handler) ClaimEnvironmentShare(shareID string) (*EnvironmentShareClaim, error)
- func (h *Handler) Create(req CreateRequest) (*Document, error)
- func (h *Handler) CreateDirectShare(req CreateDirectShareRequest) (*DirectShare, error)
- func (h *Handler) CreateEnvironmentShare(req CreateEnvironmentShareRequest) (*EnvironmentShare, error)
- func (h *Handler) Delete(id string, version int) error
- func (h *Handler) DeleteDirectShare(shareID string) error
- func (h *Handler) DeleteEnvironmentShare(shareID string) error
- func (h *Handler) DeleteSnapshot(documentID string, version int) error
- func (h *Handler) EnsureEnvironmentShare(documentID, access string) (*EnvironmentShare, error)
- func (h *Handler) Get(id string) (*Document, error)
- func (h *Handler) GetAtVersion(id string, version int) (*Document, error)
- func (h *Handler) GetEnvironmentShare(shareID string) (*EnvironmentShare, error)
- func (h *Handler) GetMetadata(id string) (*DocumentMetadata, error)
- func (h *Handler) GetRaw(id string) ([]byte, error)
- func (h *Handler) GetSnapshot(documentID string, version int) (*Snapshot, error)
- func (h *Handler) List(filters DocumentFilters) (*DocumentList, error)
- func (h *Handler) ListDirectShares(documentID string) (*DirectShareList, error)
- func (h *Handler) ListEnvironmentShares(documentID string) (*EnvironmentShareList, error)
- func (h *Handler) ListSnapshots(documentID string) (*SnapshotList, error)
- func (h *Handler) RemoveDirectShareRecipients(shareID string, recipientIDs []string) error
- func (h *Handler) RestoreSnapshot(documentID string, version int) (*DocumentMetadata, error)
- func (h *Handler) SetDocumentPublic(id string, version int) error
- func (h *Handler) Update(id string, version int, content []byte, contentType string) (*Document, error)
- func (h *Handler) UpdateDocument(id string, version int, req UpdateRequest) (*Document, error)
- func (h *Handler) UpdateWithMetadata(id string, version int, content []byte, contentType string, name string, ...) (*Document, error)
- type ModificationInfo
- type RestoreOptions
- type ShareInfo
- type Snapshot
- type SnapshotList
- type SnapshotModInfo
- type SsoEntity
- type TrashDocumentListEntry
- type TrashHandler
- type TrashList
- type TrashListOptions
- type TrashedDocument
- type UpdateRequest
- type UserContext
Constants ¶
This section is empty.
Variables ¶
var ( ErrVersionConflict = sdkdocument.ErrVersionConflict )
Re-export SDK sentinel errors.
var (
ParseMultipartDocument = sdkdocument.ParseMultipartDocument
)
Re-export SDK functions.
Functions ¶
func IsNotFound ¶
IsNotFound reports whether err indicates the document does not exist (HTTP 404), as opposed to a transient, auth, or other failure.
func ParseShareRef ¶
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 ¶
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 {
}
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 {
}
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:"-"`
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 ¶
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 ¶
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 ¶
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 {
}
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 {
}
EnvironmentShareClaim is the CLI read model for a claimed environment share.
type EnvironmentShareList ¶
type EnvironmentShareList struct {
}
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 ¶
NewHandler creates a new document handler.
func (*Handler) AddDirectShareRecipients ¶
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) DeleteDirectShare ¶
DeleteDirectShare deletes a direct share.
func (*Handler) DeleteEnvironmentShare ¶
DeleteEnvironmentShare deletes an environment share.
func (*Handler) DeleteSnapshot ¶
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) GetAtVersion ¶
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) GetSnapshot ¶
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 ¶
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 ¶
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 ¶
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.
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 ¶
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 ¶
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 ¶
func (h *TrashHandler) List(opts TrashListOptions) ([]TrashDocumentListEntry, error)
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).