d-velop / dvelop-sdk-node

Official SDK to build Apps for d.velop cloud
Apache License 2.0
11 stars 14 forks source link

Feature request: Possiblity to only update the properties of a DMS object, not the file itself #177

Closed Frankst2 closed 11 months ago

Frankst2 commented 11 months ago

Hi there, I just started using the SDK, thanks for providing it! I think some feature that might be useful is missing (or I am missing something ;-): The function dms.updateDmsObject can only be used to update an object (file) including the properties. As far as I see the code also requires a file as input: https://github.com/d-velop/dvelop-sdk-node/blob/7eee024712aabe61b405a8475029486d8428a39d/packages/dms/src/dms-objects/update-dms-object/update-dms-object.ts#L88 however it would be useful if the updateDmsObject function (or a new function) could also be used to update just the properties of an object without uploading a new version of the file. According to https://portal.d-velop.de/documentation/dmsap/de/dms-api-538791722.html#DMSApp-API-AktualisiereneinesDMS-ObjektesohneBenutzerinteraktion this should be possible: "Wenn Sie nur Eigenschaften ändern möchten, geben Sie die Parameter contentLocationUri und filename nicht an."

Best regards

Frank

LenKlose commented 11 months ago

Hi @Frankst2 ,

what you are describing should be possible. I tested the following code without any problems:

import { updateDmsObject } from "@dvelop-sdk/dms";

async function main() {

  const ctx: any = {
    systemBaseUri: "<SYSTEM_BASE_URI>",
    authSessionId: "<API_KEY>"
  }

  const resp: any = await updateDmsObject(ctx, {
    repositoryId: "<REPO_ID>",
    sourceId: `/dms/r/<REPO_ID>/source`,
    dmsObjectId: "W300000008",
    alterationText: "test edit",
    properties: [
      {
        key: "68e5d415-7910-449a-871c-afccafbd1859",
        values: ["Update for Frank"]
      }
    ]
  });
}

main();

The UpdateDmsObjectParams also do not require any of fileName, contentUri, contentLocationUri or content (see packages/dms/src/dms-objects/update-dms-object/update-dms-object.ts)

LenKlose commented 11 months ago

What you are refering to is an internal function. You should never use functions beginning with an underscore by itself. See Advanced Topics for more details.

Frankst2 commented 11 months ago

You're right, looks like I misinterpreted an error message (and the code above), actually it was an error in my JSON. Thanks for testing though!