@ptkl/sdk 0.10.0 → 0.10.1
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/dist/index.cjs.js +279 -18
- package/dist/index.esm.js +279 -18
- package/dist/index.iife.js +279 -18
- package/dist/package.json +1 -1
- package/dist/types/api/integrations/dms.d.ts +55 -15
- package/dist/types/api/ratchet.d.ts +193 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types/integrations.d.ts +59 -1
- package/dist/types/types/ratchet.d.ts +38 -0
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -532,12 +532,210 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
class Ratchet extends PlatformBaseClient {
|
|
535
|
+
/**
|
|
536
|
+
* Get all database connections for the current project
|
|
537
|
+
*
|
|
538
|
+
* @returns List of all configured ratchet connections
|
|
539
|
+
*
|
|
540
|
+
* @example
|
|
541
|
+
* ```typescript
|
|
542
|
+
* const ratchet = new Ratchet();
|
|
543
|
+
* const connections = await ratchet.getConnections();
|
|
544
|
+
* console.log(connections.data); // Array of connections
|
|
545
|
+
* ```
|
|
546
|
+
*/
|
|
547
|
+
async getConnections() {
|
|
548
|
+
return await this.client.get("/v1/ratchet/connection");
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Get a specific database connection by ID
|
|
552
|
+
*
|
|
553
|
+
* @param id - Connection ID
|
|
554
|
+
* @returns Connection details including queries
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```typescript
|
|
558
|
+
* const ratchet = new Ratchet();
|
|
559
|
+
* const connection = await ratchet.getConnection('users_db');
|
|
560
|
+
* console.log(connection.data.queries); // Available queries for this connection
|
|
561
|
+
* ```
|
|
562
|
+
*/
|
|
563
|
+
async getConnection(id) {
|
|
564
|
+
return await this.client.get(`/v1/ratchet/connection/${id}`);
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Create a new database connection
|
|
568
|
+
*
|
|
569
|
+
* Supports multiple database types:
|
|
570
|
+
* - MySQL: Use credentials with host, dbname, user, password
|
|
571
|
+
* - PostgreSQL: Use credentials with host, dbname, user, password
|
|
572
|
+
* - MongoDB: Use DSN connection string
|
|
573
|
+
* - BigQuery: Use service_account_json and project_id
|
|
574
|
+
*
|
|
575
|
+
* @param connection - Connection configuration
|
|
576
|
+
* @returns Created connection details
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```typescript
|
|
580
|
+
* const ratchet = new Ratchet();
|
|
581
|
+
*
|
|
582
|
+
* // MySQL/PostgreSQL connection
|
|
583
|
+
* await ratchet.createConnection({
|
|
584
|
+
* id: 'users_db',
|
|
585
|
+
* type: 'MySQL',
|
|
586
|
+
* credentials: {
|
|
587
|
+
* type: 'Credentials',
|
|
588
|
+
* host: 'localhost',
|
|
589
|
+
* dbname: 'users',
|
|
590
|
+
* user: 'admin',
|
|
591
|
+
* password: 'secret'
|
|
592
|
+
* }
|
|
593
|
+
* });
|
|
594
|
+
*
|
|
595
|
+
* // MongoDB connection
|
|
596
|
+
* await ratchet.createConnection({
|
|
597
|
+
* id: 'mongo_db',
|
|
598
|
+
* type: 'MongoDB',
|
|
599
|
+
* credentials: {
|
|
600
|
+
* type: 'DSN',
|
|
601
|
+
* dsn: 'mongodb://localhost:27017/mydb'
|
|
602
|
+
* }
|
|
603
|
+
* });
|
|
604
|
+
*
|
|
605
|
+
* // BigQuery connection
|
|
606
|
+
* await ratchet.createConnection({
|
|
607
|
+
* id: 'analytics_bq',
|
|
608
|
+
* type: 'BigQuery',
|
|
609
|
+
* credentials: {
|
|
610
|
+
* type: 'ServiceAccount',
|
|
611
|
+
* service_account_json: '{"type":"service_account",...}',
|
|
612
|
+
* project_id: 'my-project-id'
|
|
613
|
+
* }
|
|
614
|
+
* });
|
|
615
|
+
* ```
|
|
616
|
+
*/
|
|
617
|
+
async createConnection(connection) {
|
|
618
|
+
return await this.client.post("/v1/ratchet/connection", connection);
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Update an existing database connection
|
|
622
|
+
*
|
|
623
|
+
* @param connection - Updated connection configuration
|
|
624
|
+
* @returns Success status
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
* ```typescript
|
|
628
|
+
* const ratchet = new Ratchet();
|
|
629
|
+
* await ratchet.updateConnection({
|
|
630
|
+
* id: 'users_db',
|
|
631
|
+
* type: 'postgres',
|
|
632
|
+
* credentials: {
|
|
633
|
+
* type: 'postgres',
|
|
634
|
+
* host: 'localhost',
|
|
635
|
+
* dbname: 'users',
|
|
636
|
+
* user: 'admin',
|
|
637
|
+
* password: 'new_secret'
|
|
638
|
+
* },
|
|
639
|
+
* queries: [
|
|
640
|
+
* { id: 'get_user', expression: 'SELECT * FROM users WHERE id = $1' }
|
|
641
|
+
* ]
|
|
642
|
+
* });
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
async updateConnection(connection) {
|
|
646
|
+
return await this.client.put("/v1/ratchet/connection", connection);
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Delete a database connection
|
|
650
|
+
*
|
|
651
|
+
* @param id - Connection ID to delete
|
|
652
|
+
* @returns Success status
|
|
653
|
+
*
|
|
654
|
+
* @example
|
|
655
|
+
* ```typescript
|
|
656
|
+
* const ratchet = new Ratchet();
|
|
657
|
+
* await ratchet.deleteConnection('users_db');
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
async deleteConnection(id) {
|
|
661
|
+
return await this.client.delete(`/v1/ratchet/connection/${id}`);
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Test a database connection without saving it
|
|
665
|
+
*
|
|
666
|
+
* @param connection - Connection configuration to test
|
|
667
|
+
* @returns Success status if connection is valid
|
|
668
|
+
*
|
|
669
|
+
* @example
|
|
670
|
+
* ```typescript
|
|
671
|
+
* const ratchet = new Ratchet();
|
|
672
|
+
* const isValid = await ratchet.testConnection({
|
|
673
|
+
* id: 'test_db',
|
|
674
|
+
* type: 'postgres',
|
|
675
|
+
* credentials: {
|
|
676
|
+
* type: 'postgres',
|
|
677
|
+
* host: 'localhost',
|
|
678
|
+
* dbname: 'test',
|
|
679
|
+
* user: 'admin',
|
|
680
|
+
* password: 'secret'
|
|
681
|
+
* }
|
|
682
|
+
* });
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
685
|
+
async testConnection(connection) {
|
|
686
|
+
return await this.client.post("/v1/ratchet/test/connection", connection);
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Execute a predefined database query
|
|
690
|
+
*
|
|
691
|
+
* Runs a query that has been previously configured in a ratchet connection.
|
|
692
|
+
* The query is identified by a qualified name in the format: `connectionId.queryId`
|
|
693
|
+
*
|
|
694
|
+
* @param name - Qualified name of the query (format: `connectionId.queryId`)
|
|
695
|
+
* @param params - Array of parameters to pass to the query
|
|
696
|
+
* @returns Query execution results
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```typescript
|
|
700
|
+
* const ratchet = new Ratchet();
|
|
701
|
+
*
|
|
702
|
+
* // Execute a query with parameters
|
|
703
|
+
* const result = await ratchet.query('users_db.get_user_by_id', [123]);
|
|
704
|
+
*
|
|
705
|
+
* // Execute a query without parameters
|
|
706
|
+
* const allUsers = await ratchet.query('users_db.get_all_users', []);
|
|
707
|
+
* ```
|
|
708
|
+
*/
|
|
535
709
|
async query(name, params) {
|
|
536
|
-
return await this.client.post(
|
|
710
|
+
return await this.client.post("/v1/ratchet/query", {
|
|
537
711
|
name: name,
|
|
538
|
-
params: params
|
|
712
|
+
params: params,
|
|
539
713
|
});
|
|
540
714
|
}
|
|
715
|
+
/**
|
|
716
|
+
* Inspect and execute a custom query without saving it
|
|
717
|
+
*
|
|
718
|
+
* This allows you to test queries before saving them to a connection.
|
|
719
|
+
*
|
|
720
|
+
* @param request - Query inspection request with connection name, query, and params
|
|
721
|
+
* @returns Query execution results
|
|
722
|
+
*
|
|
723
|
+
* @example
|
|
724
|
+
* ```typescript
|
|
725
|
+
* const ratchet = new Ratchet();
|
|
726
|
+
* const result = await ratchet.inspectQuery({
|
|
727
|
+
* name: 'users_db.test_query',
|
|
728
|
+
* query: {
|
|
729
|
+
* id: 'test_query',
|
|
730
|
+
* expression: 'SELECT * FROM users WHERE email = $1'
|
|
731
|
+
* },
|
|
732
|
+
* params: ['user@example.com']
|
|
733
|
+
* });
|
|
734
|
+
* ```
|
|
735
|
+
*/
|
|
736
|
+
async inspectQuery(request) {
|
|
737
|
+
return await this.client.post("/v1/ratchet/query/inspect", request);
|
|
738
|
+
}
|
|
541
739
|
}
|
|
542
740
|
|
|
543
741
|
class Sandbox extends PlatformBaseClient {
|
|
@@ -997,6 +1195,23 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
997
1195
|
async libraries() {
|
|
998
1196
|
return await this.requestv1("GET", "media/library/list");
|
|
999
1197
|
}
|
|
1198
|
+
/**
|
|
1199
|
+
* Upload files using multipart form data
|
|
1200
|
+
*
|
|
1201
|
+
* @param payload - Upload configuration with files, directory, and options
|
|
1202
|
+
* @returns Upload response from the server
|
|
1203
|
+
*
|
|
1204
|
+
* @example
|
|
1205
|
+
* ```typescript
|
|
1206
|
+
* const result = await dms.upload({
|
|
1207
|
+
* files: [file1, file2],
|
|
1208
|
+
* uploadDir: '/documents/invoices',
|
|
1209
|
+
* public: true,
|
|
1210
|
+
* replace: true,
|
|
1211
|
+
* metadata: { category: 'finance' }
|
|
1212
|
+
* });
|
|
1213
|
+
* ```
|
|
1214
|
+
*/
|
|
1000
1215
|
async upload(payload) {
|
|
1001
1216
|
let files = payload.files;
|
|
1002
1217
|
let formData = new FormData();
|
|
@@ -1013,9 +1228,12 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1013
1228
|
if (payload.public) {
|
|
1014
1229
|
formData.append('is_public', "true");
|
|
1015
1230
|
}
|
|
1231
|
+
if (payload.replace) {
|
|
1232
|
+
formData.append('replace', "true");
|
|
1233
|
+
}
|
|
1016
1234
|
if (payload.expiresAt)
|
|
1017
1235
|
formData.append('expiresAt', new Date(payload.expiresAt).toISOString());
|
|
1018
|
-
if (Object.keys(payload.metadata).length > 0)
|
|
1236
|
+
if (payload.metadata && Object.keys(payload.metadata).length > 0)
|
|
1019
1237
|
formData.append('metadata', JSON.stringify(payload.metadata));
|
|
1020
1238
|
return await this.request("POST", "media/upload", {
|
|
1021
1239
|
data: formData,
|
|
@@ -1028,6 +1246,28 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1028
1246
|
async delete(data) {
|
|
1029
1247
|
return this.request('POST', 'media/delete', data);
|
|
1030
1248
|
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Upload files using base64-encoded content
|
|
1251
|
+
*
|
|
1252
|
+
* @param data - Upload payload with base64-encoded files
|
|
1253
|
+
* @returns Upload response from the server
|
|
1254
|
+
*
|
|
1255
|
+
* @example
|
|
1256
|
+
* ```typescript
|
|
1257
|
+
* const result = await dms.uploadBase64({
|
|
1258
|
+
* path: '/documents/reports',
|
|
1259
|
+
* is_public: false,
|
|
1260
|
+
* replace: true,
|
|
1261
|
+
* files: [
|
|
1262
|
+
* {
|
|
1263
|
+
* name: 'report.pdf',
|
|
1264
|
+
* content_type: 'application/pdf',
|
|
1265
|
+
* data: 'base64EncodedContent...'
|
|
1266
|
+
* }
|
|
1267
|
+
* ]
|
|
1268
|
+
* });
|
|
1269
|
+
* ```
|
|
1270
|
+
*/
|
|
1031
1271
|
async uploadBase64(data) {
|
|
1032
1272
|
return this.request('POST', `media/upload`, {
|
|
1033
1273
|
data,
|
|
@@ -1036,7 +1276,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1036
1276
|
}
|
|
1037
1277
|
});
|
|
1038
1278
|
}
|
|
1039
|
-
async getMedia(
|
|
1279
|
+
async getMedia(key, encoding) {
|
|
1040
1280
|
return this.request('GET', `media/get/${key}`, {
|
|
1041
1281
|
params: {
|
|
1042
1282
|
encoding
|
|
@@ -1044,7 +1284,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1044
1284
|
responseType: (!encoding) ? 'blob' : null
|
|
1045
1285
|
});
|
|
1046
1286
|
}
|
|
1047
|
-
async download(
|
|
1287
|
+
async download(key) {
|
|
1048
1288
|
return this.request('POST', `media/download`, {
|
|
1049
1289
|
data: {
|
|
1050
1290
|
key
|
|
@@ -1056,7 +1296,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1056
1296
|
return this.request('GET', `media/exif/${key}`);
|
|
1057
1297
|
}
|
|
1058
1298
|
async html2pdf(data) {
|
|
1059
|
-
const { output_pdf = false, input_path, input_html, output_path, output_file_name, output_type, data: templateData } = data;
|
|
1299
|
+
const { output_pdf = false, input_path, input_html, output_path, output_file_name, output_type, data: templateData, replace, } = data;
|
|
1060
1300
|
const type = output_pdf ? 'arraybuffer' : 'json';
|
|
1061
1301
|
const contentType = output_pdf ? 'application/pdf' : 'application/json';
|
|
1062
1302
|
return this.request('POST', `media/pdf/html2pdf`, {
|
|
@@ -1067,7 +1307,27 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1067
1307
|
input_html,
|
|
1068
1308
|
output_file_name,
|
|
1069
1309
|
output_type,
|
|
1070
|
-
data: templateData
|
|
1310
|
+
data: templateData,
|
|
1311
|
+
replace,
|
|
1312
|
+
},
|
|
1313
|
+
headers: {
|
|
1314
|
+
'Content-Type': contentType
|
|
1315
|
+
},
|
|
1316
|
+
responseType: type
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
async pdf2html(data) {
|
|
1320
|
+
const { output_html = false, input_path, input_pdf, output_path, output_file_name, replace, } = data;
|
|
1321
|
+
const type = output_html ? 'arraybuffer' : 'json';
|
|
1322
|
+
const contentType = output_html ? 'text/html' : 'application/json';
|
|
1323
|
+
return this.request('POST', `media/pdf/pdf2html`, {
|
|
1324
|
+
data: {
|
|
1325
|
+
output_html,
|
|
1326
|
+
input_path,
|
|
1327
|
+
output_path,
|
|
1328
|
+
input_pdf,
|
|
1329
|
+
output_file_name,
|
|
1330
|
+
replace,
|
|
1071
1331
|
},
|
|
1072
1332
|
headers: {
|
|
1073
1333
|
'Content-Type': contentType
|
|
@@ -1084,8 +1344,8 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1084
1344
|
async dirs(data) {
|
|
1085
1345
|
return await this.request("POST", `media/library/dirs`, { data });
|
|
1086
1346
|
}
|
|
1087
|
-
async fillPdf(
|
|
1088
|
-
const { input_path, output_path, output_pdf = false, output_type, output_file_name, form_data, forms } = data;
|
|
1347
|
+
async fillPdf(data) {
|
|
1348
|
+
const { input_path, output_path, output_pdf = false, output_type, output_file_name, replace, form_data, forms } = data;
|
|
1089
1349
|
const responseType = output_pdf ? 'arraybuffer' : 'json';
|
|
1090
1350
|
const contentType = output_pdf ? 'application/pdf' : 'application/json';
|
|
1091
1351
|
return this.request('POST', `media/pdf/fill`, {
|
|
@@ -1096,6 +1356,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1096
1356
|
output_type,
|
|
1097
1357
|
output_file_name,
|
|
1098
1358
|
form_data,
|
|
1359
|
+
replace,
|
|
1099
1360
|
forms
|
|
1100
1361
|
},
|
|
1101
1362
|
headers: {
|
|
@@ -1173,7 +1434,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1173
1434
|
* // excelResult.data is a Blob
|
|
1174
1435
|
* ```
|
|
1175
1436
|
*/
|
|
1176
|
-
async convertData(
|
|
1437
|
+
async convertData(data, params) {
|
|
1177
1438
|
const { from, to, sheet_name, include_header, include_footer, header_as_comment, footer_as_comment, separator_rows, field_order, } = params;
|
|
1178
1439
|
const queryParams = { from, to };
|
|
1179
1440
|
// Add optional parameters if provided
|
|
@@ -1240,7 +1501,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1240
1501
|
* // }
|
|
1241
1502
|
* ```
|
|
1242
1503
|
*/
|
|
1243
|
-
async getDataInfo(
|
|
1504
|
+
async getDataInfo(data, params) {
|
|
1244
1505
|
const { format } = params;
|
|
1245
1506
|
return this.request('POST', `media/convert/info`, {
|
|
1246
1507
|
data,
|
|
@@ -1284,7 +1545,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1284
1545
|
* }
|
|
1285
1546
|
* ```
|
|
1286
1547
|
*/
|
|
1287
|
-
async validateData(
|
|
1548
|
+
async validateData(data, params) {
|
|
1288
1549
|
const { format } = params;
|
|
1289
1550
|
return this.request('POST', `media/convert/validate`, {
|
|
1290
1551
|
data,
|
|
@@ -1332,7 +1593,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1332
1593
|
* // Auto-detects header, items, and footer sections
|
|
1333
1594
|
* ```
|
|
1334
1595
|
*/
|
|
1335
|
-
async jsonToCsv(
|
|
1596
|
+
async jsonToCsv(jsonData, options) {
|
|
1336
1597
|
let params = {};
|
|
1337
1598
|
if (options === null || options === void 0 ? void 0 : options.field_order) {
|
|
1338
1599
|
params.field_order = options.field_order.join(',');
|
|
@@ -1391,7 +1652,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1391
1652
|
* link.click();
|
|
1392
1653
|
* ```
|
|
1393
1654
|
*/
|
|
1394
|
-
async jsonToExcel(
|
|
1655
|
+
async jsonToExcel(jsonData, options) {
|
|
1395
1656
|
const params = {};
|
|
1396
1657
|
if (options === null || options === void 0 ? void 0 : options.sheet_name) {
|
|
1397
1658
|
params.sheet_name = options.sheet_name;
|
|
@@ -1430,7 +1691,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1430
1691
|
* // ]
|
|
1431
1692
|
* ```
|
|
1432
1693
|
*/
|
|
1433
|
-
async csvToJson(
|
|
1694
|
+
async csvToJson(csvData) {
|
|
1434
1695
|
return this.request('POST', `media/convert/csv-to-json`, {
|
|
1435
1696
|
data: csvData,
|
|
1436
1697
|
responseType: 'json',
|
|
@@ -1463,7 +1724,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1463
1724
|
* // Use url for download or further processing
|
|
1464
1725
|
* ```
|
|
1465
1726
|
*/
|
|
1466
|
-
async csvToExcel(
|
|
1727
|
+
async csvToExcel(csvData, options) {
|
|
1467
1728
|
const params = {};
|
|
1468
1729
|
if (options === null || options === void 0 ? void 0 : options.sheet_name) {
|
|
1469
1730
|
params.sheet_name = options.sheet_name;
|
|
@@ -1503,7 +1764,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1503
1764
|
* const jsonFromBuffer = await dms.excelToJson(libraryRef, arrayBuffer);
|
|
1504
1765
|
* ```
|
|
1505
1766
|
*/
|
|
1506
|
-
async excelToJson(
|
|
1767
|
+
async excelToJson(excelData, options) {
|
|
1507
1768
|
const params = {};
|
|
1508
1769
|
if (options === null || options === void 0 ? void 0 : options.sheet_name) {
|
|
1509
1770
|
params.sheet_name = options.sheet_name;
|
|
@@ -1547,7 +1808,7 @@ var ProtokolSDK010 = (function (exports, axios) {
|
|
|
1547
1808
|
* link.click();
|
|
1548
1809
|
* ```
|
|
1549
1810
|
*/
|
|
1550
|
-
async excelToCsv(
|
|
1811
|
+
async excelToCsv(excelData, options) {
|
|
1551
1812
|
const params = {};
|
|
1552
1813
|
if (options === null || options === void 0 ? void 0 : options.sheet_name) {
|
|
1553
1814
|
params.sheet_name = options.sheet_name;
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import IntegrationsBaseClient from "../integrationsBaseClient";
|
|
2
2
|
import { AxiosResponse } from "axios";
|
|
3
|
-
import { PDFFillOptions, DataConversionParams, DataValidationParams, DataInfoParams, DataInfo, DataValidationResult, ConversionOptions, HTML2PDFOptions } from "../../types/integrations";
|
|
3
|
+
import { PDFFillOptions, DataConversionParams, DataValidationParams, DataInfoParams, DataInfo, DataValidationResult, ConversionOptions, HTML2PDFOptions, PDF2HTMLOptions, MediaUploadPayload, MediaUploadBase64Payload } from "../../types/integrations";
|
|
4
4
|
/**
|
|
5
5
|
* Document Management System (DMS) API client
|
|
6
6
|
*
|
|
@@ -83,17 +83,57 @@ import { PDFFillOptions, DataConversionParams, DataValidationParams, DataInfoPar
|
|
|
83
83
|
export default class DMS extends IntegrationsBaseClient {
|
|
84
84
|
list(data: any): Promise<AxiosResponse<any, any>>;
|
|
85
85
|
libraries(): Promise<AxiosResponse<any, any>>;
|
|
86
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Upload files using multipart form data
|
|
88
|
+
*
|
|
89
|
+
* @param payload - Upload configuration with files, directory, and options
|
|
90
|
+
* @returns Upload response from the server
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const result = await dms.upload({
|
|
95
|
+
* files: [file1, file2],
|
|
96
|
+
* uploadDir: '/documents/invoices',
|
|
97
|
+
* public: true,
|
|
98
|
+
* replace: true,
|
|
99
|
+
* metadata: { category: 'finance' }
|
|
100
|
+
* });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
upload(payload: MediaUploadPayload): Promise<AxiosResponse<any, any> | undefined>;
|
|
87
104
|
delete(data: any): Promise<AxiosResponse<any, any>>;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Upload files using base64-encoded content
|
|
107
|
+
*
|
|
108
|
+
* @param data - Upload payload with base64-encoded files
|
|
109
|
+
* @returns Upload response from the server
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const result = await dms.uploadBase64({
|
|
114
|
+
* path: '/documents/reports',
|
|
115
|
+
* is_public: false,
|
|
116
|
+
* replace: true,
|
|
117
|
+
* files: [
|
|
118
|
+
* {
|
|
119
|
+
* name: 'report.pdf',
|
|
120
|
+
* content_type: 'application/pdf',
|
|
121
|
+
* data: 'base64EncodedContent...'
|
|
122
|
+
* }
|
|
123
|
+
* ]
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
uploadBase64(data: MediaUploadBase64Payload): Promise<AxiosResponse<any, any>>;
|
|
128
|
+
getMedia(key: string, encoding: string): Promise<AxiosResponse<any, any>>;
|
|
129
|
+
download(key: string): Promise<AxiosResponse<any, any>>;
|
|
91
130
|
getExifData(key: string): Promise<AxiosResponse<any, any>>;
|
|
92
131
|
html2pdf(data: HTML2PDFOptions): Promise<AxiosResponse<any, any>>;
|
|
132
|
+
pdf2html(data: PDF2HTMLOptions): Promise<AxiosResponse<any, any>>;
|
|
93
133
|
createDir(path: string): Promise<AxiosResponse<any, any>>;
|
|
94
134
|
deleteDir(path: string): Promise<AxiosResponse<any, any>>;
|
|
95
135
|
dirs(data: string): Promise<AxiosResponse<any, any>>;
|
|
96
|
-
fillPdf(
|
|
136
|
+
fillPdf(data: PDFFillOptions): Promise<AxiosResponse<any, any>>;
|
|
97
137
|
/**
|
|
98
138
|
* Convert data between different formats (JSON, CSV, Excel)
|
|
99
139
|
*
|
|
@@ -155,7 +195,7 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
155
195
|
* // excelResult.data is a Blob
|
|
156
196
|
* ```
|
|
157
197
|
*/
|
|
158
|
-
convertData(
|
|
198
|
+
convertData(data: any, params: DataConversionParams): Promise<AxiosResponse<any>>;
|
|
159
199
|
/**
|
|
160
200
|
* Get information about data format and structure
|
|
161
201
|
*
|
|
@@ -187,7 +227,7 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
187
227
|
* // }
|
|
188
228
|
* ```
|
|
189
229
|
*/
|
|
190
|
-
getDataInfo(
|
|
230
|
+
getDataInfo(data: any, params: DataInfoParams): Promise<AxiosResponse<DataInfo>>;
|
|
191
231
|
/**
|
|
192
232
|
* Validate data format without performing conversion
|
|
193
233
|
*
|
|
@@ -222,7 +262,7 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
222
262
|
* }
|
|
223
263
|
* ```
|
|
224
264
|
*/
|
|
225
|
-
validateData(
|
|
265
|
+
validateData(data: any, params: DataValidationParams): Promise<AxiosResponse<DataValidationResult>>;
|
|
226
266
|
/**
|
|
227
267
|
* Convert JSON data to CSV format
|
|
228
268
|
*
|
|
@@ -261,7 +301,7 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
261
301
|
* // Auto-detects header, items, and footer sections
|
|
262
302
|
* ```
|
|
263
303
|
*/
|
|
264
|
-
jsonToCsv(
|
|
304
|
+
jsonToCsv(jsonData: any, options?: ConversionOptions): Promise<AxiosResponse<string>>;
|
|
265
305
|
/**
|
|
266
306
|
* Convert JSON data to Excel (.xlsx) format
|
|
267
307
|
*
|
|
@@ -307,7 +347,7 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
307
347
|
* link.click();
|
|
308
348
|
* ```
|
|
309
349
|
*/
|
|
310
|
-
jsonToExcel(
|
|
350
|
+
jsonToExcel(jsonData: any, options?: ConversionOptions): Promise<AxiosResponse<Blob>>;
|
|
311
351
|
/**
|
|
312
352
|
* Convert CSV data to JSON format
|
|
313
353
|
*
|
|
@@ -330,7 +370,7 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
330
370
|
* // ]
|
|
331
371
|
* ```
|
|
332
372
|
*/
|
|
333
|
-
csvToJson(
|
|
373
|
+
csvToJson(csvData: string): Promise<AxiosResponse<any[]>>;
|
|
334
374
|
/**
|
|
335
375
|
* Convert CSV data to Excel (.xlsx) format
|
|
336
376
|
*
|
|
@@ -355,7 +395,7 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
355
395
|
* // Use url for download or further processing
|
|
356
396
|
* ```
|
|
357
397
|
*/
|
|
358
|
-
csvToExcel(
|
|
398
|
+
csvToExcel(csvData: string, options?: ConversionOptions): Promise<AxiosResponse<Blob>>;
|
|
359
399
|
/**
|
|
360
400
|
* Convert Excel (.xlsx) data to JSON format
|
|
361
401
|
*
|
|
@@ -382,7 +422,7 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
382
422
|
* const jsonFromBuffer = await dms.excelToJson(libraryRef, arrayBuffer);
|
|
383
423
|
* ```
|
|
384
424
|
*/
|
|
385
|
-
excelToJson(
|
|
425
|
+
excelToJson(excelData: Blob | ArrayBuffer, options?: ConversionOptions): Promise<AxiosResponse<any[]>>;
|
|
386
426
|
/**
|
|
387
427
|
* Convert Excel (.xlsx) data to CSV format
|
|
388
428
|
*
|
|
@@ -413,7 +453,7 @@ export default class DMS extends IntegrationsBaseClient {
|
|
|
413
453
|
* link.click();
|
|
414
454
|
* ```
|
|
415
455
|
*/
|
|
416
|
-
excelToCsv(
|
|
456
|
+
excelToCsv(excelData: Blob | ArrayBuffer, options?: ConversionOptions): Promise<AxiosResponse<string>>;
|
|
417
457
|
request(method: string, endpoint: string, params?: any): Promise<AxiosResponse<any, any>>;
|
|
418
458
|
requestv1(method: string, endpoint: string, params?: any): Promise<AxiosResponse<any, any>>;
|
|
419
459
|
}
|