1.0.1 • Published 1 year ago

tdoc-api v1.0.1

Weekly downloads
6
License
ISC
Repository
github
Last release
1 year ago

tdoc-api

node wrapper around tDoc REST-ful APIs

API

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).

upload

Upload a document.

Arguments

  • document content (optional if ready is false), either:
    • file: path of the file to be uploaded
    • data: a Buffer or binary string with raw data
  • mimetype: the content media type (defaults to application/pdf)
  • doctype: docType to upload the document into
  • period: fiscal period the document refers to; use current year for documents that don't have such concept
  • parcel: an optional parcel identifier (created with parcelCreate)
  • meta: all the metadata to associate to the document (optional if ready is false)
  • ready: if the document is ready for preservation or still incomplete (defaults to true)
  • company: if the user has access to more than one company, use this optional field to specify which one the doctype refers to
  • alias & pin: specify those fields when you need to apply a digital signature to the document
  • overwrite: the document identifier of a (not yet preserved) document to overwrite (optional)

Returns

Full document metadata.

update

Update a document.

Arguments

  • id: the identifier of the document to update
  • document content (optional if ready is false), either:
    • file: path of the file to be uploaded
    • data: a Buffer or binary string with raw data
  • mimetype: the content media type (defaults to application/pdf)
  • meta: all the metadata to associate to the document (optional if ready is false)
  • ready: if the document is ready for preservation or still incomplete (defaults to true)
  • company: if the user has access to more than one company, use this optional field to specify which one the doctype refers to
  • alias & pin: specify those fields when you need to apply a digital signature to the document
  • overwrite: the document identifier of a (not yet preserved) document to overwrite (optional)

Returns

Full document metadata.

document

Retrieves a Buffer with the content of a document.

Arguments

  • id: the identifier of the document

Returns

Full document content.

documentMeta

Retrieves the full metadata of a document.

Arguments

  • id: the identifier of the document

Returns

Full document metadata.

search

Search for documents matching some metadata.

Arguments

  • doctype: docType to search
  • period: (optional) fiscal period to search
  • meta: any metadata to search for

Returns

An array of document identifier.

searchOne

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 search
  • period: (optional) fiscal period to search
  • meta: any metadata to search for

Returns

Full document metadata.

parcelCreate

Opens a new parcel to upload one or more documents as a single entity.

Arguments

  • doctype: docType to create the parcel in
  • filename: the (unique) filename of this parcel

Returns

The parcel unique identifier.

parcelClose

Closes the parcel.

Arguments

  • id: the identifier of the parcel
  • extra: (optional) a string containing the parcel source metadata

Returns

All the metadata of the closed parcel.

parcelDelete

Deletes the parcel (and all the documents it contained).

Arguments

  • id: the identifier of the parcel
  • error: (optional) a string containing the error that required the deletion of the parcel
  • extra: (optional) a string containing the parcel source metadata

Returns

All the metadata of the closed parcel.

documentDelete

Deletes a document.

Arguments

  • id: the identifier of the document

Returns

Nothing.

companyList

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.

doctypeList

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.

doctypeInfo

Full information about a doctype.

Arguments

  • doctype: the doctype (defaults to all of them)

Returns

An array of doctype objects.

1.0.1

1 year ago

1.0.0

1 year ago

0.4.8

5 years ago

0.4.7

5 years ago

0.4.6

6 years ago

0.4.5

6 years ago

0.4.4

7 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.7

8 years ago

0.3.6

8 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.10

9 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.23

10 years ago

0.0.22

10 years ago

0.0.21

10 years ago

0.0.20

10 years ago

0.0.19

10 years ago

0.0.18

10 years ago