Create a DmsObject.
import { createDmsObject } from "@dvelop-sdk/dms";
import { readFileSync } from "fs";
//only node.js
const file: ArrayBuffer = readFileSync(`${ __dirname }/our-profits.kaching`).buffer;
const dmsObject: GetDmsObjectParams = await createDmsObject({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
categoryId: "GDYQ3PJKrT8",
properties: [
{
key: "AaGK-fj-BAM",
values: ["unpaid"]
}
],
fileName: "our-profits.kaching",
content: file,
});
Create a note for an existing DmsObject.
import { createDmsObjectNote } from "@dvelop-sdk/dms";
await createDmsObjectNote({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
dmsObjectId: "GDYQ3PJKrT8",
noteText: "This document is of importance for the Venture Trading Company!"
});
Deletes the current (last) version of a DmsObject. The version before that automatically becomes the current version.
Boolean value indicating if the dmsObject was completly deleted (aka: You just deleted the first version)
import { deleteCurrentDmsObjectVersion } from "@dvelop-sdk/dms";
await deleteCurrentDmsObjectVersion({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
dmsObjectId: "GDYQ3PJKrT8",
reason: "This shall be gone! Tout de suite!"
});
// Delete the whole DmsObject
// * Attention: This method wraps a HTTP-Call in a loop and can significantly slow down your code *
let deletedAllVersions: boolean = false;
while (!deletedAllVersions) {
deletedAllVersions = await deleteCurrentDmsObjectVersion({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
dmsObjectId: "GDYQ3PJKrT8",
reason: "This shall be gone! Tout de suite!"
});
}
Get a DmsObject.
import { getDmsObject } from "@dvelop-sdk/dms";
const dmsObject: DmsObject = await getDmsObject({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
},{
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
dmsObjectId: "GDYQ3PJKrT8",
});
console.log(dmsObject);
Download a DmsObject-file.
import { getDmsObjectMainFile } from "@dvelop-sdk/dms";
import { writeFileSync } from "fs";
const file: ArrayBuffer = await getDmsObjectMainFile({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
},{
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
dmsObjectId: "GDYQ3PJKrT8",
});
writeFileSync(`${__dirname}/our-profits.kaching`, Buffer.from(file)); // only node.js
Get all notes for an existing DmsObject.
import { getDmsObjectNotes } from "@dvelop-sdk/dms";
const notes: DmsObjectNote[] = getDmsObjectNotes({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
dmsObjectId: "GDYQ3PJKrT8"
});
notes.forEach(n => {
console.log(`${n.creator.displayName}: "${n.text}"`);
});
// Jastor Gallywix: "I need this taken care of ASAP!"
// Bing Zapcrackle: "I'm on it my prince."
Download a DmsObject-file as PDF.
import { getDmsObjectPdfFile } from "@dvelop-sdk/dms";
import { writeFileSync } from "fs";
const file: ArrayBuffer = await getDmsObjectPdfFile({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
},{
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
dmsObjectId: "GDYQ3PJKrT8",
});
writeFileSync(`${__dirname}/our-profits.pdf`, Buffer.from(file)); // only node.js
Link a DmsObject to multiple child DmsObjects.
import { linkDmsObjects } from "@dvelop-sdk/dms";
await linkDmsObjects({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
parentDmsObjectId: "GDYQ3PJKrT8",
childDmsObjectsIds: [
"N3bEh-PEk1g",
"AC86VI0j85M"
]
});
Release a DmsObject and update it. This is a variation of updateDmsObject which has the same syntax.
Internally this this is a wrapper around getDmsObject, updateDmsObjectStatus and updateDmsObject:
import { updateDmsObject } from "@dvelop-sdk/dms";
import { readFileSync } from "fs";
//only node.js
const file: ArrayBuffer = readFileSync(`${ __dirname }/our-profits.kaching`).buffer;
await releaseAndUpdateDmsObject({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
dmsObjectId: "GDYQ3PJKrT8",
alterationText: "Updated by SDK",
properties: [
{
key: "AaGK-fj-BAM",
values: ["paid"]
}
],
fileName: "our-profits.kaching",
content: file,
alterationText: "Released for automatic update"
});
Execute a search and returns the search-result. This result might be partial due to the defined pageSize
-property.
You can navigate pages with the getPreviousPage
- and getNextPage
-functions. If functions are undefined the page does not exist.
import { searchDmsObjects } from "@dvelop-sdk/dms";
const searchResult: SearchDmsObjectsResultPage = await searchDmsObjects({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
},{
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
categories: ["TIfAkOBMf5A"]
fulltext: "Ashenvale",
properties: [{
key: "AaGK-fj-BAM",
values: ["unpaid"]
}]
});
console.log(searchResult.dmsObjects.length);
Returns an URI under which a file is temporarily available for download.
import { storeFileTemporarily } from "@dvelop-sdk/dms";
import { readFileSync } from "fs";
//only node.js
const file: ArrayBuffer = readFileSync(`${ __dirname }/our-profits.kaching`).buffer;
const temporaryUri: string = await storeFileTemporarily({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
content: file
});
console.log(temporaryUri); // /dms/some-random-blob-url
Unlink a DmsObject from a child DmsObject.
import { unlinkDmsObjects } from "@dvelop-sdk/dms";
await unlinkDmsObjects({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
parentDmsObjectId: "GDYQ3PJKrT8",
childDmsObjectsId: "N3bEh-PEk1g"
});
Update a DmsObject.
import { updateDmsObject } from "@dvelop-sdk/dms";
import { readFileSync } from "fs";
//only node.js
const file: ArrayBuffer = readFileSync(`${ __dirname }/our-profits.kaching`).buffer;
await updateDmsObject({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source",
dmsObjectId: "GDYQ3PJKrT8",
alterationText: "Updated by SDK",
properties: [
{
key: "AaGK-fj-BAM",
values: ["paid"]
}
],
fileName: "our-profits.kaching",
content: file,
});
Update a DmsObject.
import { updateDmsObjectStatus } from "@dvelop-sdk/dms";
await updateDmsObjectStatus({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
dmsObjectId: "GDYQ3PJKrT8",
alterationText: "Updated by SDK",
status: "Processing",
editor: "NQlcUY5zDUk"
});
Get a list of property mappings for a given source.
import { getMappings } from "@dvelop-sdk/dms";
const dmsMappings: DmsMapping[] = await getMappings({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
},{
repositoryId: "qnydFmqHuVo",
sourceId: "/dms/r/qnydFmqHuVo/source"
});
console.log(dmsMappings);
Returns an array of all Repository-objects for a tenant.
import { Repository, getRepositories } from "@dvelop-sdk/dms";
const repos: Repository[] = await getRepositories({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
});
const repoList: string = repos.map(r => r.name).join(", ");
console.log("Repositories:", repoList); // Booty Bay, Everlook, Gadgetzan, Ratchet
Returns the Repository-object with the specified id.
import { Repository, getRepository } from "@dvelop-sdk/dms";
const repo: Repository = await getRepository({
systemBaseUri: "https://steamwheedle-cartel.d-velop.cloud",
authSessionId: "dQw4w9WgXcQ"
}, {
repositoryId: "qnydFmqHuVo",
});
console.log(repo.name); // Booty Bay Documents
Generated using TypeDoc
@dvelop-sdk/dms
This package contains functionality for the DMS-App in the d.velop cloud.
Explore the docs » Install via npm » Check us out on GitHub »