node wrapper around tDoc REST-ful APIs
All the methods have a single object parameter, used as a way to improve readability and have optional parameters.
All methods return a native Promiseand since 1.0.0 no longer accept an optional Node-style callback(err, data) parameter.
All methods accept a user parameter used to specify the user the request is made on the behalf of (to be used if and only if the authentication user is root).
uploadupdatedocumentdocumentMetasearchsearchOneparcelCreateparcelCloseparcelDeletedocumentDeletecompanyListdoctypeListdoctypeInfo
Upload a document.
Arguments
- document content (optional if
readyis false), either:file: path of the file to be uploadeddata: aBufferorbinarystring with raw data
mimetype: the content media type (defaults toapplication/pdf)doctype: docType to upload the document intoperiod: fiscal period the document refers to; use current year for documents that don't have such conceptparcel: an optional parcel identifier (created withparcelCreate)meta: all the metadata to associate to the document (optional ifreadyis false)ready: if the document is ready for preservation or still incomplete (defaults totrue)company: if the user has access to more than one company, use this optional field to specify which one thedoctyperefers toalias&pin: specify those fields when you need to apply a digital signature to the documentoverwrite: the document identifier of a (not yet preserved) document to overwrite (optional)
Returns
Full document metadata.
Update a document.
Arguments
id: the identifier of the document to update- document content (optional if
readyis false), either:file: path of the file to be uploadeddata: aBufferorbinarystring with raw data
mimetype: the content media type (defaults toapplication/pdf)meta: all the metadata to associate to the document (optional ifreadyis false)ready: if the document is ready for preservation or still incomplete (defaults totrue)company: if the user has access to more than one company, use this optional field to specify which one thedoctyperefers toalias&pin: specify those fields when you need to apply a digital signature to the documentoverwrite: the document identifier of a (not yet preserved) document to overwrite (optional)
Returns
Full document metadata.
Retrieves a Buffer with the content of a document.
Arguments
id: the identifier of the document
Returns
Full document content.
Retrieves the full metadata of a document.
Arguments
id: the identifier of the document
Returns
Full document metadata.
Search for documents matching some metadata.
Arguments
doctype: docType to searchperiod: (optional) fiscal period to searchmeta: any metadata to search for
Returns
An array of document identifier.
Search for a single document matching some metadata. Returns full metadata of the searched document.
Warning: it is implemented using search and documentMeta and thus requires two round trip times.
Arguments
doctype: docType to searchperiod: (optional) fiscal period to searchmeta: any metadata to search for
Returns
Full document metadata.
Opens a new parcel to upload one or more documents as a single entity.
Arguments
doctype: docType to create the parcel infilename: the (unique) filename of this parcel
Returns
The parcel unique identifier.
Closes the parcel.
Arguments
id: the identifier of the parcelextra: (optional) a string containing the parcel source metadata
Returns
All the metadata of the closed parcel.
Deletes the parcel (and all the documents it contained).
Arguments
id: the identifier of the parcelerror: (optional) a string containing the error that required the deletion of the parcelextra: (optional) a string containing the parcel source metadata
Returns
All the metadata of the closed parcel.
Deletes a document.
Arguments
id: the identifier of the document
Returns
Nothing.
List of companies the user has access to.
Arguments
None.
Returns
A JSON object with short company names as keys and long names as values.
List of doctypes the user has access to.
Arguments
None.
Returns
A JSON object with short company names as keys and an array of doctypes names as values.
Full information about a doctype.
Arguments
doctype: the doctype (defaults to all of them)
Returns
An array of doctype objects.