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)
Classes
Methods
# async allFiles() → {Promise.<Array.<EntityFile>>}
Currently only allowed in the projects entity. Returns all files of the entity with the specified id.
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. |
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. |
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. |
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. |
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. |
Promise.<void>
# async deleteAll() → {Promise.<void>}
Deletes all the files of the specified entity.
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. |
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. |
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. |
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 |
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. |
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. |
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. |
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. |