Class

EntityFiles

EntityFiles(client, entityName, entityId)

Class corresponding to Aworks EntityFiles Endpoints
Constructor

# new EntityFiles(client, entityName, entityId)

Endpoint constructor
Parameters:
Name Type Description
client Client
entityName 'projects' | 'companies' | 'tasks' | 'comments' The name of the entity.
entityId String The id of the entity.
See:
  • [EntityFiles in Awork API Docs](https://openapi.awork.com/#/EntityFiles)

View Source endpoints/EntityFiles.js, line 13

Classes

EntityFiles

Methods

# async allFiles() → {Promise.<Array.<EntityFile>>}

Currently only allowed in the projects entity. Returns all files of the entity with the specified id.

View Source endpoints/EntityFiles.js, line 209

Promise.<Array.<EntityFile>>

# async byUrl(fileByUrlModel) → {Promise.<EntityFile>}

Uploads a new file by providing an url. The file needs to be a public available url. The file size must not exceed 100MB.
Parameters:
Name Type Description
fileByUrlModel FileByUrlModel The url, name and description of the file.

View Source endpoints/EntityFiles.js, line 154

Promise.<EntityFile>

# async changeEntity(fileId, entity) → {Promise.<void>}

Changes the entity this file belongs to. Switch to the specified entity or to a global file if the 'EntityId' of the model is set to null.
Parameters:
Name Type Description
fileId String The id of the file.
entity LinkedEntity The entity to move the file to.

View Source endpoints/EntityFiles.js, line 231

Promise.<void>

# async copy(fileId, entity) → {Promise.<void>}

Copys the file to a new entity (meta and content).
Parameters:
Name Type Description
fileId String The id of the file.
entity LinkedEntity The entity to copy the file to.

View Source endpoints/EntityFiles.js, line 200

Promise.<void>

# async create(file, metadata) → {Promise.<EntityFile>}

Uploads a File or Buffer Object
Parameters:
Name Type Description
file File | Buffer The file content eather as ES6 File object or Buffer.
metadata FileMetaData The file metadata.

View Source endpoints/EntityFiles.js, line 70

Promise.<EntityFile>

# async delete(fileId) → {Promise.<void>}

Deletes the file with the specified id of the entity with the specified Id.
Parameters:
Name Type Description
fileId String The id of the file.

View Source endpoints/EntityFiles.js, line 109

Promise.<void>

# async deleteAll() → {Promise.<void>}

Deletes all the files of the specified entity.

View Source endpoints/EntityFiles.js, line 117

Promise.<void>

# async download(fileId, optionsopt) → {String}

Parameters:
Name Type Attributes Description
fileId String The id of the file.
options DownloadOptions <optional>
The download options.

View Source endpoints/EntityFiles.js, line 172

binary
String

# async externalFiles(externalFileForm) → {Promise.<EntityFile>}

Endpoint to create file infos with batch operation. Created file infos don't have a version.
Parameters:
Name Type Description
externalFileForm Array.<ExternalFileForm> List of file forms.

View Source endpoints/EntityFiles.js, line 136

Promise.<EntityFile>

# async get(fileId) → {Promise.<EntityFile>}

Returns the file with the specified id of the entity with the specified Id
Parameters:
Name Type Description
fileId String The id of the file.

View Source endpoints/EntityFiles.js, line 41

Promise.<EntityFile>

# async list(optionsopt) → {Promise.<Array.<EntityFile>>}

Returns all files of the entity with the specified id.
Parameters:
Name Type Attributes Description
options ListOptions <optional>
Pagination and filtering options

View Source endpoints/EntityFiles.js, line 52

Promise.<Array.<EntityFile>>

# async pdf(fileId, inlineopt) → {String}

Returns the content of the entity file with the specified id as pdf if possible and returns bad request, if not valid type or conversion not possible.
Parameters:
Name Type Attributes Default Description
fileId String The id of the file.
inline Boolean <optional>
false Default: false. If inline is false, content-disposition header is attachment.

View Source endpoints/EntityFiles.js, line 183

binary
String

# async shareUrl(fileId) → {Promise.<String>}

Returns a url to share the file.
Parameters:
Name Type Description
fileId String The id of the file.

View Source endpoints/EntityFiles.js, line 220

Promise.<String>

# async update(fileId, entityFile) → {Promise.<EntityFile>}

Updates the file with the specified id of the entity with the specified Id.
Parameters:
Name Type Description
fileId String The id of the file.
entityFile EntityFileUpdateModel The model to update the file with the specified id.

View Source endpoints/EntityFiles.js, line 98

Promise.<EntityFile>

# versions(fileId) → {FileVersions}

Returns the FileVersions Endpoint with the specified entity name, entity id and file Id.
Parameters:
Name Type Description
fileId String The id of the file.

View Source endpoints/EntityFiles.js, line 241

FileVersions