Skip to content

js-bao-wss-client


js-bao-wss-client / DocumentContext

Interface: DocumentContext

Scoped API for operating on a single document without repeating the document ID.

Methods

acceptInvitation()

acceptInvitation(): Promise<DocumentAccessResult>

Accept a pending invitation to access this document.

Returns

Promise<DocumentAccessResult>

Deprecated

The per-document accept concept has been removed. Document shares to existing users take effect immediately via documents.updatePermissions — no accept call is needed. For not-yet-registered users, deferred grants resolve when the recipient accepts the app-level invitation via client.invitations.accept(inviteToken). The inviteToken is provided in the deferred-grant response of documents.updatePermissions on the inviter side, not via any invitee-callable on documents.*. See issue #619 and DocumentsAPI.acceptInvitation.


blobs()

blobs(): DocumentBlobContext

Get the blob API context for this document.

Returns

DocumentBlobContext


declineInvitation()

declineInvitation(invitationId): Promise<{ message: string; success: boolean; }>

Decline a pending invitation to access this document.

Parameters

invitationId

string

The identifier of the specific invitation to decline

Returns

Promise<{ message: string; success: boolean; }>

Deprecated

No invitee-side decline verb. Pending invitations expire automatically, so a recipient who hasn't accepted can simply ignore the invite. To remove yourself from an already-accepted share, call documents.removePermission(documentId, { userId: <your userId> }). See issue #619 and DocumentsAPI.declineInvitation.


delete()

delete(options?): Promise<void>

Delete this document from the server and evict its local data.

Parameters

options?

DeleteDocumentOptions

Options for document deletion

Returns

Promise<void>


get()

get(): Promise<DocumentInfo>

Fetch this document's metadata from the server.

Returns

Promise<DocumentInfo>


getLocalMetadata()

getLocalMetadata(): Promise<LocalMetadataEntry | null>

Get locally cached metadata for this document.

Returns

Promise<LocalMetadataEntry | null>


getPermissions()

getPermissions(): Promise<DocumentPermissionEntry[]>

Get the list of user permissions for this document.

Returns

Promise<DocumentPermissionEntry[]>


getUploadConcurrency()

getUploadConcurrency(): number

Get the current maximum number of concurrent blob uploads.

Returns

number


grantGroupPermission()

grantGroupPermission(params): Promise<DocumentGroupPermissionEntry>

Grant a group permission on this document.

Parameters

params

GrantGroupPermissionParams

The group permission to grant

Returns

Promise<DocumentGroupPermissionEntry>


isReadOnly()

isReadOnly(): boolean

Check whether this document is read-only for the current user.

Returns

boolean


isRoot()

isRoot(): boolean

Check whether this document is the app's root document.

Returns

boolean


listGroupPermissions()

listGroupPermissions(options?): Promise<DocumentGroupPermissionEntry[]>

List all group-based permissions for this document.

By default, platform-managed internal groups (groupType prefixed with _) are excluded. Pass { includeSystem: true } to include them.

Parameters

options?
includeSystem?

boolean

Returns

Promise<DocumentGroupPermissionEntry[]>


pauseAllUploads()

pauseAllUploads(): void

Pause all blob uploads for this document.

Returns

void


pauseUpload()

pauseUpload(blobId): boolean

Pause a specific blob upload for this document.

Parameters

blobId

string

The identifier of the blob upload to pause

Returns

boolean


resumeAllUploads()

resumeAllUploads(): void

Resume all paused blob uploads for this document.

Returns

void


resumeUpload()

resumeUpload(blobId): boolean

Resume a specific paused blob upload for this document.

Parameters

blobId

string

The identifier of the paused blob upload to resume

Returns

boolean


revokeGroupPermission()

revokeGroupPermission(groupType, groupId): Promise<{ success: boolean; }>

Revoke a group's permission on this document.

Parameters

groupType

string

The type of group whose permission to revoke

groupId

string

The identifier of the group whose permission to revoke

Returns

Promise<{ success: boolean; }>


setUploadConcurrency()

setUploadConcurrency(concurrency): void

Set the maximum number of concurrent blob uploads.

Parameters

concurrency

number

The maximum number of blob uploads that can run simultaneously

Returns

void


transferOwnership()

transferOwnership(newOwnerId): Promise<void>

Transfer ownership of this document to another user.

Parameters

newOwnerId

string

The user ID of the new owner

Returns

Promise<void>


update()

update(data): Promise<DocumentInfo>

Update this document's metadata such as its title.

Parameters

data

UpdateDocumentData

The document metadata fields to update

Returns

Promise<DocumentInfo>


uploads()

uploads(): BlobUploadStatus[]

List active blob uploads for this document.

Returns

BlobUploadStatus[]