Class: SevdeskVoucherImporter

SevdeskVoucherImporter(apiToken)

The main voucher importer class.

Constructor

new SevdeskVoucherImporter(apiToken)

Creates a new instance of the importer class. The instance can be used for a single import process.
Parameters:
Name Type Description
apiToken string The sevDesk API Token to be used
Source:

Members

newDocumentId :number|null

After the import process is complete, contains the sevDesk ID of the newly created document. Is null on error or default.
Type:
  • number | null
Source:

Methods

(async) importBuffer(data, filename) → {Promise.<void>}

Imports a PDF or image file from a buffer. The filename is provided separately.
Parameters:
Name Type Description
data Buffer The content of the file to be uploaded as buffer.
filename string The file name of the file to be uploaded. (Needed for mime type detection.)
Source:
Throws:
An error happened during the import. Inner exceptions are not being wrapped.
Type
Error
Returns:
An empty promise is returned.
Type
Promise.<void>

(async) importLocalFile(filePath) → {Promise.<void>}

Imports a single local file. The file is most likely a PDF or image file.
Parameters:
Name Type Description
filePath string Path to the local file to be imported.
Source:
Throws:
An error happened during the import. Inner exceptions are not being wrapped.
Type
Error
Returns:
An empty promise is returned.
Type
Promise.<void>