Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • CollabClient

Index

Constructors

constructor

Properties

currentUser

currentUser: GetUser_user

Static LogLevels

LogLevels: { DEBUG: "debug"; ERROR: "error"; HTTP: "http"; INFO: "info"; NONE: "none"; SILLY: "silly"; VERBOSE: "verbose"; WARN: "warn" } = LogLevels

Type declaration

  • DEBUG: "debug"
  • ERROR: "error"
  • HTTP: "http"
  • INFO: "info"
  • NONE: "none"
  • SILLY: "silly"
  • VERBOSE: "verbose"
  • WARN: "warn"

Static defaultNotificationHandler

defaultNotificationHandler: defaultHandler = defaultNotificationHandler

Accessors

currentDocumentId

  • get currentDocumentId(): string
  • set currentDocumentId(id: string): void
  • Returns string

  • Parameters

    • id: string

    Returns void

Methods

copyAnnotations

  • copyAnnotations(from: string, to: string, options: { annotationIds?: string[]; copyAllAnnotations?: boolean }): Promise<boolean>
  • Copy annotations from one document to another

    Parameters

    • from: string

      Id of the document that you want copy from

    • to: string

      Id of the document that you want copy to

    • options: { annotationIds?: string[]; copyAllAnnotations?: boolean }

      Options to copy annotations

      • Optional annotationIds?: string[]

        Option to copy annotations by their id

      • Optional copyAllAnnotations?: boolean

        Option to copy all annotations

    Returns Promise<boolean>

customQuery

  • customQuery(object: string, data: { args?: {}; fields: string[] }): Promise<any>
  • Add custom GraphQL query

    Parameters

    • object: string

      The object you want to fetch from your service

    • data: { args?: {}; fields: string[] }

      Parameters to fetch data from object

      • Optional args?: {}

        Pass arguments to fields

        • [name: string]: any
      • fields: string[]

        Array of fields on objects that you want to have in returned data

    Returns Promise<any>

    Returns the fetched data

editDocument

  • editDocument(docId: string, data: { isPublic?: boolean; name?: string; url?: string }): Promise<EditDocument_editDocument>
  • Edits a document in the database

    Parameters

    • docId: string

      the ID of the document to edit

    • data: { isPublic?: boolean; name?: string; url?: string }

      paramateres to edit. At least one key is required

      • Optional isPublic?: boolean

        Toggle if the document is public or not

      • Optional name?: string

        The new name for the document

      • Optional url?: string

        The new URL location for the document

    Returns Promise<EditDocument_editDocument>

    Returns the document object

getAllDocuments

  • getAllDocuments(): Promise<getUserDocuments_user_documents[]>
  • Gets all the documents for the current user. It is recommended to use the 'getDocumentPaginator' API instead, since this API will not scale with the number of user documents

    Returns Promise<getUserDocuments_user_documents[]>

getConnectedUsers

  • getConnectedUsers(documentId: string): Promise<ConnectedDocUser[]>
  • Get Users connected to the document

    Parameters

    • documentId: string

      id of the document that the user joins

    Returns Promise<ConnectedDocUser[]>

    Returns the array of connected users include userId and currentPage number

getDocumentId

  • getDocumentId(): string
  • Gets the current document ID

    Returns string

getDocumentInfo

  • getDocumentInfo(docId: string): Promise<GetDocumentMetadataByIdQuery_document>
  • Gets information about a document

    Parameters

    • docId: string

      The documents ID

    Returns Promise<GetDocumentMetadataByIdQuery_document>

getDocumentPaginator

  • getDocumentPaginator(params: PaginateParams): Paginator<GetDocumentsFilteredVariables, { __typename?: "Document"; annotations: Array<Annotation>; authorId: Scalars["ID"]; createdAt: Scalars["Date"]; id: Scalars["ID"]; isPublic?: Maybe<Scalars["Boolean"]>; members: Array<DocumentMember>; name?: Maybe<Scalars["String"]>; unreadCount: Scalars["Int"]; updatedAt: Scalars["Date"] }>
  • Returns a Paginator that can be used to fetch user documents

    Parameters

    Returns Paginator<GetDocumentsFilteredVariables, { __typename?: "Document"; annotations: Array<Annotation>; authorId: Scalars["ID"]; createdAt: Scalars["Date"]; id: Scalars["ID"]; isPublic?: Maybe<Scalars["Boolean"]>; members: Array<DocumentMember>; name?: Maybe<Scalars["String"]>; unreadCount: Scalars["Int"]; updatedAt: Scalars["Date"] }>

getUnreadCountForDocument

  • getUnreadCountForDocument(document: Document): number
  • Returns the total number of unread annotations for a document

    Parameters

    • document: Document

      The document to check

    Returns number

getUserSession

  • getUserSession(__namedParameters?: { signInIfExists: boolean }): Promise<GetSession_session>
  • Returns the currently signed in user, if it exists

    Parameters

    • Default value __namedParameters: { signInIfExists: boolean } = {}
      • signInIfExists: boolean

    Returns Promise<GetSession_session>

inviteUsersToDocument

  • inviteUsersToDocument(docId: string, invitedUserDetails?: string[]): Promise<InviteUsersToDocument_inviteUsersToDocument>
  • Invites a list of users to a document

    Parameters

    • docId: string

      The ID of the document to invite to

    • Default value invitedUserDetails: string[] = []

    Returns Promise<InviteUsersToDocument_inviteUsersToDocument>

isAnnotationUnread

  • isAnnotationUnread(annotation: Annotation): boolean
  • Checks if an annotation is unread or not for the current user

    Parameters

    • annotation: Annotation

      The annotation to check

    Returns boolean

joinDocument

  • joinDocument(id: string): Promise<InviteUsersToDocument_inviteUsersToDocument>
  • Allows the current signed in user to join a public document

    Parameters

    • id: string

      Id of the document that the user joins

    Returns Promise<InviteUsersToDocument_inviteUsersToDocument>

joinScrollSync

  • joinScrollSync(): Promise<void>
  • Join scroll synchronization and subscribe or send scroll position

    Returns Promise<void>

leaveDocument

  • leaveDocument(id: string): Promise<boolean>
  • Removes a user's membership from a document

    Parameters

    • id: string

      ID of the document to leave

    Returns Promise<boolean>

leaveScrollSync

  • leaveScrollSync(): Promise<void>
  • Leave scroll synchronization and cleanup

    Returns Promise<void>

loadDocument

  • loadDocument(path: Parameters<WebViewerInstance["loadDocument"]>[0], options: Parameters<WebViewerInstance["loadDocument"]>[1] & { documentId?: string; isPublic?: boolean }): Promise<{ id: string; name?: string }>
  • Parameters

    • path: Parameters<WebViewerInstance["loadDocument"]>[0]
    • options: Parameters<WebViewerInstance["loadDocument"]>[1] & { documentId?: string; isPublic?: boolean }

    Returns Promise<{ id: string; name?: string }>

loginAnonymously

  • loginAnonymously(userName?: string): Promise<{ user: LoginAnonymous_loginAnonymous_user }>
  • Logs in a user anonymously. The user's info will be cached and restored if they reload the page and 'loginAnonymously' is called again.

    Parameters

    • Default value userName: string = "Guest"

      The display name to use for the user. Defaults to 'Guest'

    Returns Promise<{ user: LoginAnonymous_loginAnonymous_user }>

loginWithPassword

  • loginWithPassword(email: string, password: string): Promise<{ user: Login_login_user }>
  • Logs in a user with an email and password Returns an object with a user property if the token is valid. Returns null if token is invalid or any other errors occur

    Parameters

    • email: string

      The email to send to the server

    • password: string

      The password to send to the server

    Returns Promise<{ user: Login_login_user }>

loginWithToken

  • loginWithToken(token: string): Promise<{ user: { email: string; id: string } } | null>
  • Logs in a user with an authentication token. Returns an object with a user property if the token is valid. Returns null if token is invalid or any other errors occur

    Parameters

    • token: string

      The token to validate on the server

    Returns Promise<{ user: { email: string; id: string } } | null>

logout

  • logout(): Promise<void>
  • Logs a user out and removes all listeners

    Returns Promise<void>

markAllAnnotationsAsRead

  • markAllAnnotationsAsRead(documentId: string): Promise<void>
  • Set all annotations in the document as read for current user

    Parameters

    • documentId: string

      the id of the document of which all its annotations to be set as read

    Returns Promise<void>

scrollSyncAvailable

  • scrollSyncAvailable(): Promise<boolean>
  • Check if the document author is in scroll sync mode

    Returns Promise<boolean>

    Returns true or false

setInstance

  • setInstance(instance: WebViewerInstance): void
  • Parameters

    • instance: WebViewerInstance

    Returns void

subscribe

  • subscribe<T>(event: T, callback: EventMap[T]): (Anonymous function)
  • Subscribe to a collaboration event

    Type parameters

    Parameters

    • event: T

      The name of the event

    • callback: EventMap[T]

      Callback function that is called when the event is fired

    Returns (Anonymous function)

    Returns a function that can be called to unsubscribe from the event

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc