tentwentyfour / nextcloud-link

Javascript/Typescript client that communicates with Nextcloud's WebDAV and OCS APIs
MIT License
56 stars 7 forks source link

Documentation for extraProperties #46

Closed Mangatt closed 2 years ago

Mangatt commented 2 years ago

It would be great to have documentation and/or examples for extraProperties in getFolderProperties and getFolderFileDetails. In current state of things it's pretty much impossible to use that.

kwisatz commented 2 years ago

In a nutshell, extraProperties is a list of optional properties that are not returned by the WebDAV interface by default. Which properties get returned by default and which ones are available at request can be read here: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html#requesting-properties

An example that requests the Owncloud extra property fileid on top of the default properties would be:

const fileId = createOwnCloudFileDetailProperty('fileid', true);
const documentList  = await client.getFolderFileDetails('/Documents', [fileId]);
for (const directory of documentList) {
    const folderId = directory.extraProperties.fileid;
}

You can find more example for both OwnCloud and Nextcloud-specific properties inside the webdav jest tests, e.g. from line 486.