@docbrasil/api-systemmanager 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/admin/document.js +43 -0
- package/dist/bundle.cjs +43 -0
- package/dist/bundle.mjs +1 -1
- package/package.json +1 -1
package/api/admin/document.js
CHANGED
|
@@ -285,6 +285,49 @@ class AdminDocuments {
|
|
|
285
285
|
return self._returnData(await apiCall);
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
/**
|
|
289
|
+
*
|
|
290
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
291
|
+
* @description Get the content of a document
|
|
292
|
+
* @param {object} params Params to request signed url
|
|
293
|
+
* @param {string} params.docId The unique id of the document
|
|
294
|
+
* @param {string} params.page The page, from 0, or 'all' if all pages (the full content)
|
|
295
|
+
* @param {string} apiKey Api Key as permission to use this functionality
|
|
296
|
+
* @return {Promise<object>} data the document content
|
|
297
|
+
* @return {string} data._id the _id of the document
|
|
298
|
+
* @return {string} data.content all the pages or if asked by page, just one page, the one requested
|
|
299
|
+
* @return {string} data.content.TextOverlay the overlay text if requested
|
|
300
|
+
* @return {string} data.content.ParsedText the page text content
|
|
301
|
+
* @return {number} data.total the total number of pages
|
|
302
|
+
* @public
|
|
303
|
+
* @async
|
|
304
|
+
* @example
|
|
305
|
+
*
|
|
306
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
307
|
+
* const api = new API();
|
|
308
|
+
* const params - {
|
|
309
|
+
* page: '0',
|
|
310
|
+
* docId: '5dadd01dc4af3941d42f8c5c'
|
|
311
|
+
* };
|
|
312
|
+
* const apiKey: '...';
|
|
313
|
+
* await api.admin.document.getContent(params, apiKey);
|
|
314
|
+
*/
|
|
315
|
+
async getContent(params = {}, apiKey) {
|
|
316
|
+
|
|
317
|
+
Joi.assert(params, Joi.object().required());
|
|
318
|
+
Joi.assert(params.content, Joi.string().required());
|
|
319
|
+
Joi.assert(params.docId, Joi.string().required());
|
|
320
|
+
Joi.assert(params.page, Joi.string().required());
|
|
321
|
+
Joi.assert(apiKey, Joi.string().required());
|
|
322
|
+
|
|
323
|
+
const self = this;
|
|
324
|
+
const { page, docId } = params;
|
|
325
|
+
const url = `/api/documents/${docId}/content/${page}?apiKey=${apiKey}`;
|
|
326
|
+
const apiCall = self._client
|
|
327
|
+
.get(url);
|
|
328
|
+
return self._returnData(await apiCall);
|
|
329
|
+
}
|
|
330
|
+
|
|
288
331
|
}
|
|
289
332
|
|
|
290
333
|
export default AdminDocuments;
|
package/dist/bundle.cjs
CHANGED
|
@@ -9024,6 +9024,49 @@ class AdminDocuments {
|
|
|
9024
9024
|
return self._returnData(await apiCall);
|
|
9025
9025
|
}
|
|
9026
9026
|
|
|
9027
|
+
/**
|
|
9028
|
+
*
|
|
9029
|
+
* @author CloudBrasil <abernardo.br@gmail.com>
|
|
9030
|
+
* @description Get the content of a document
|
|
9031
|
+
* @param {object} params Params to request signed url
|
|
9032
|
+
* @param {string} params.docId The unique id of the document
|
|
9033
|
+
* @param {string} params.page The page, from 0, or 'all' if all pages (the full content)
|
|
9034
|
+
* @param {string} apiKey Api Key as permission to use this functionality
|
|
9035
|
+
* @return {Promise<object>} data the document content
|
|
9036
|
+
* @return {string} data._id the _id of the document
|
|
9037
|
+
* @return {string} data.content all the pages or if asked by page, just one page, the one requested
|
|
9038
|
+
* @return {string} data.content.TextOverlay the overlay text if requested
|
|
9039
|
+
* @return {string} data.content.ParsedText the page text content
|
|
9040
|
+
* @return {number} data.total the total number of pages
|
|
9041
|
+
* @public
|
|
9042
|
+
* @async
|
|
9043
|
+
* @example
|
|
9044
|
+
*
|
|
9045
|
+
* const API = require('@docbrasil/api-systemmanager');
|
|
9046
|
+
* const api = new API();
|
|
9047
|
+
* const params - {
|
|
9048
|
+
* page: '0',
|
|
9049
|
+
* docId: '5dadd01dc4af3941d42f8c5c'
|
|
9050
|
+
* };
|
|
9051
|
+
* const apiKey: '...';
|
|
9052
|
+
* await api.admin.document.getContent(params, apiKey);
|
|
9053
|
+
*/
|
|
9054
|
+
async getContent(params = {}, apiKey) {
|
|
9055
|
+
|
|
9056
|
+
Joi__default["default"].assert(params, Joi__default["default"].object().required());
|
|
9057
|
+
Joi__default["default"].assert(params.content, Joi__default["default"].string().required());
|
|
9058
|
+
Joi__default["default"].assert(params.docId, Joi__default["default"].string().required());
|
|
9059
|
+
Joi__default["default"].assert(params.page, Joi__default["default"].string().required());
|
|
9060
|
+
Joi__default["default"].assert(apiKey, Joi__default["default"].string().required());
|
|
9061
|
+
|
|
9062
|
+
const self = this;
|
|
9063
|
+
const { page, docId } = params;
|
|
9064
|
+
const url = `/api/documents/${docId}/content/${page}?apiKey=${apiKey}`;
|
|
9065
|
+
const apiCall = self._client
|
|
9066
|
+
.get(url);
|
|
9067
|
+
return self._returnData(await apiCall);
|
|
9068
|
+
}
|
|
9069
|
+
|
|
9027
9070
|
}
|
|
9028
9071
|
|
|
9029
9072
|
/**
|