Class Project

The Project class offers methods to manipulate a Matrix Project on a Matrix Instance. It is not meant to be created by the end user, rather the openProject() method is used on a StandaloneMatrixSDK object which represents the Matrix Instance.

Constructors

Properties

categories: Map<string, Category>
name: string

Methods

  • Files uploaded to the server with uploadFile() or uploadLocalFile() are retrieved with a special Url that depends on the Project. This method computes the url correctly.

    Parameters

    • fileInfo: AddFileAck

      an AddFileAck object with information about the uploaded file

    Returns string

    a Url pointing to the file on the server

  • Create an ItemsFieldMask for use with search functions.

    Parameters

    • Optional options: IFieldMaskOptions

      A IFieldMaskOptions object. If not specified, then appropriate defaults are chosen.

    Returns ItemsFieldMask

    an initialized ItemsFieldMask object which can be further customized.

  • Used to populate the rather complex ExecuteParam type. We need a mapping from clone source field ids to the output category field ids.

    Parameters

    • inputFolderIds: string[]
    • outputCategory: string
    • reason: string

    Returns ExecuteParam

    A populated ExecuteParam suitable for use with the execute method.

  • Create a folder. Every folder must contain only items of a particular type.

    Parameters

    • type: string

    Returns Item

    a new Folder item of the given type.

  • Parameters

    • users: string[]
    • type: TodoTypes
    • text: string
    • itemId: string
    • fieldId: number
    • atDate: Date

    Returns Promise<string>

  • Delete an Item from the project. If the Item is a folder with children, then parameter {force} must be true.

    Parameters

    • itemId: string

      A valid item

    • Optional force: boolean

    Returns Promise<string>

    A promise with the string "Ok" on success.

    Throws

    Error if the item is a non-empty folder and force was not specified as true.

  • Admin permission on the server is required to successfully call this.

    Parameters

    • jobId: number

      the jobId you wish to cancel

    • reason: string

      the reason for cancellation

    Returns Promise<string>

    string result

  • Download a job result

    Parameters

    • jobId: number
    • fileno: number
    • Optional mode: string
    • Optional format: string
    • Optional disposition: string
    • Optional options: unknown

    Returns Promise<ArrayBuffer>

    An ArrayBuffer

  • Export a DOC to an external file.

    Parameters

    • type: "html" | "docx" | "pdf" | "odt"

      Can be one of "pdf", "html", "docx", or "odt"

    • docId: string

      The DOC id

    • Optional progressReporter: ((jobId, jobDetails) => void)

      an optional callback with status updates

        • (jobId, jobDetails): void
        • Parameters

          Returns void

    Returns Promise<JobFileWithUrl[]>

    a pointer to the location on the server where the file can be downloaded

  • Get the TODOs for a project.

    Parameters

    • Optional itemRef: string

      if specified, returns all todos linked to an item, regardless of user

    • Optional includeDone: boolean

      if true, includes done todos

    • Optional includeAllUsers: boolean

      if true, includes all todos for all users.

    • Optional includeFuture: boolean

      false by default. If true, includes future todos.

    Returns Promise<GetTodosAck>

    Information on the todos.

  • Move items in the project to a particular folder.

    Parameters

    • folderId: string

      a valid folder id within the project

    • itemIds: string[]

      an array of itemIds

    Returns Promise<string>

    the string "Ok" on success

  • For implementors of server-side hooks and other services that use the Job API.

    Parameters

    • jobId: number

      the jobId on which you are reporting progress

    • progress: number

      Progress (0 to 100, 200 to indicate error)

    • Optional status: string

      optional status string like "Done" or "Error"

    Returns Promise<string>

    string result

  • Save an item into a given folder.

    Parameters

    • parentFolderId: string
    • item: Item

    Returns Promise<Item>

    A fresh copy of the Item from the server

  • Run a hook with the given name on a project item.

    Parameters

    • itemId: string
    • hookName: string
    • body: string

    Returns Promise<string>

    the return value of the hook.

  • Perform a search, returning IDs of Items that match.

    Parameters

    • term: string

      a search term. Consult documentation for valid searches, including "mrql" searches.

    Returns Promise<string[]>

    An array of matching item IDs.

  • Perform a search and return items that are initialized according to the provided mask settings. This allows you to efficiently gather data from the server with only the fields you need brought down.

    Parameters

    • term: string

      the search term

    • filter: string = ""

      by default empty string

    • treeOrder: boolean = false

      return results in tree order (by default false)

    • Optional mask: ItemsFieldMask

      an optional mask

    Returns Promise<Item[]>

    an array of filled-in Item objects.

  • Execute a more complex search, where the fields in the results can be limited.

    Parameters

    • term: string
    • Optional options: IProjectSearchOptions

    Returns Promise<ISearchResult[]>

    returns an array of ISearchResult objects.

  • set a field of an item in the database

    Use: await project.setField("PROC-83", "plain english", "x");

    Parameters

    • itemId: string

      itemId the id of the item like "REQ-1"

    • fieldName: string

      name of the field

    • value: string

      value of the field

    Returns Promise<IItemGet>

    Promise to the updated item

    Throws

    Error in case of invalid itemId or fieldName

  • sets multiple fields in the database

    Use: await api.setFields("PROC-83", [{fieldName:"plain english",value:"x"}] )

    Parameters

    • itemId: string

      itemId itemId the id of the item like "REQ-1"

    • data: ISetField[]

      array of fieldName and value tupels

    Returns Promise<IItemGet>

    the updated item

    Throws

    Error in case of invalid id or fields

  • Upload a file to the server in Node. Not suitable for call in a web browser, as the necessary libraries (and access to the file system) are not available.

    Parameters

    • axiosLib: unknown

      A pointer to your local Axios library

    • file: unknown

      Passed through to an Axios request. A fs.ReadStream object is appropriate.

    • progress: ((p) => void)

      a callback to be notified of upload progress.

    Returns Promise<AddFileAck>

    a IFileUploadResult object.

  • Some server operations that return files as URLs are long-running jobs. With a jobId, you can wait on their result while also getting progress updates.

    Parameters

    • jobId: number
    • Optional progressReporter: ((jobId, jobDetails) => void)

      an optional callback to be notified of the job's progress.

        • (jobId, jobDetails): void
        • Parameters

          Returns void

    Returns Promise<JobFileWithUrl[]>

    an array of JobFileWithUrl structures

Generated using TypeDoc