@gemina/sdk 0.13.3 → 0.15.0

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.js CHANGED
@@ -1268,6 +1268,110 @@ var ContactApi = class extends BaseAPI {
1268
1268
  }
1269
1269
  };
1270
1270
 
1271
+ // src/generated/models/ModelType.ts
1272
+ var ModelType = {
1273
+ Gemina: "gemina",
1274
+ Google: "google",
1275
+ Openai: "openai",
1276
+ Velox: "velox",
1277
+ Praetorian: "praetorian",
1278
+ Invictus: "invictus"
1279
+ };
1280
+ function instanceOfModelType(value) {
1281
+ for (const key in ModelType) {
1282
+ if (Object.prototype.hasOwnProperty.call(ModelType, key)) {
1283
+ if (ModelType[key] === value) {
1284
+ return true;
1285
+ }
1286
+ }
1287
+ }
1288
+ return false;
1289
+ }
1290
+ function ModelTypeFromJSON(json) {
1291
+ return ModelTypeFromJSONTyped(json, false);
1292
+ }
1293
+ function ModelTypeFromJSONTyped(json, ignoreDiscriminator) {
1294
+ return json;
1295
+ }
1296
+ function ModelTypeToJSON(value) {
1297
+ return value;
1298
+ }
1299
+ function ModelTypeToJSONTyped(value, ignoreDiscriminator) {
1300
+ return value;
1301
+ }
1302
+
1303
+ // src/generated/models/UploadExtractionTypeEnum.ts
1304
+ var UploadExtractionTypeEnum = {
1305
+ Ocr: "ocr",
1306
+ DocumentDetailsHebrew: "document_details_hebrew",
1307
+ DocumentLineItemsHebrew: "document_line_items_hebrew",
1308
+ InvoiceHeaders: "invoice_headers",
1309
+ InvoiceLineItems: "invoice_line_items",
1310
+ CustomTemplate: "custom_template"
1311
+ };
1312
+ function instanceOfUploadExtractionTypeEnum(value) {
1313
+ for (const key in UploadExtractionTypeEnum) {
1314
+ if (Object.prototype.hasOwnProperty.call(UploadExtractionTypeEnum, key)) {
1315
+ if (UploadExtractionTypeEnum[key] === value) {
1316
+ return true;
1317
+ }
1318
+ }
1319
+ }
1320
+ return false;
1321
+ }
1322
+ function UploadExtractionTypeEnumFromJSON(json) {
1323
+ return UploadExtractionTypeEnumFromJSONTyped(json, false);
1324
+ }
1325
+ function UploadExtractionTypeEnumFromJSONTyped(json, ignoreDiscriminator) {
1326
+ return json;
1327
+ }
1328
+ function UploadExtractionTypeEnumToJSON(value) {
1329
+ return value;
1330
+ }
1331
+ function UploadExtractionTypeEnumToJSONTyped(value, ignoreDiscriminator) {
1332
+ return value;
1333
+ }
1334
+
1335
+ // src/generated/models/AddExtractionsInDTO.ts
1336
+ function instanceOfAddExtractionsInDTO(value) {
1337
+ if (!("extractionTypes" in value) || value["extractionTypes"] === void 0) return false;
1338
+ return true;
1339
+ }
1340
+ function AddExtractionsInDTOFromJSON(json) {
1341
+ return AddExtractionsInDTOFromJSONTyped(json, false);
1342
+ }
1343
+ function AddExtractionsInDTOFromJSONTyped(json, ignoreDiscriminator) {
1344
+ if (json == null) {
1345
+ return json;
1346
+ }
1347
+ return {
1348
+ "correction": json["correction"] == null ? void 0 : json["correction"],
1349
+ "evaluation": json["evaluation"] == null ? void 0 : json["evaluation"],
1350
+ "extractionTypes": json["extractionTypes"].map(UploadExtractionTypeEnumFromJSON),
1351
+ "includeCoordinates": json["includeCoordinates"] == null ? void 0 : json["includeCoordinates"],
1352
+ "modelType": json["modelType"] == null ? void 0 : ModelTypeFromJSON(json["modelType"]),
1353
+ "templateId": json["templateId"] == null ? void 0 : json["templateId"],
1354
+ "thinking": json["thinking"] == null ? void 0 : json["thinking"]
1355
+ };
1356
+ }
1357
+ function AddExtractionsInDTOToJSON(json) {
1358
+ return AddExtractionsInDTOToJSONTyped(json, false);
1359
+ }
1360
+ function AddExtractionsInDTOToJSONTyped(value, ignoreDiscriminator = false) {
1361
+ if (value == null) {
1362
+ return value;
1363
+ }
1364
+ return {
1365
+ "correction": value["correction"],
1366
+ "evaluation": value["evaluation"],
1367
+ "extractionTypes": value["extractionTypes"].map(UploadExtractionTypeEnumToJSON),
1368
+ "includeCoordinates": value["includeCoordinates"],
1369
+ "modelType": ModelTypeToJSON(value["modelType"]),
1370
+ "templateId": value["templateId"],
1371
+ "thinking": value["thinking"]
1372
+ };
1373
+ }
1374
+
1271
1375
  // src/generated/models/ResponseStatus.ts
1272
1376
  var ResponseStatus = {
1273
1377
  Pending: "pending",
@@ -1359,16 +1463,16 @@ function DataCenterRegionModelToJSONTyped(value, ignoreDiscriminator) {
1359
1463
  return value;
1360
1464
  }
1361
1465
 
1362
- // src/generated/models/DocumentViewMetaOutDTO.ts
1363
- function instanceOfDocumentViewMetaOutDTO(value) {
1466
+ // src/generated/models/DocumentAddExtractionsMetaOutDTO.ts
1467
+ function instanceOfDocumentAddExtractionsMetaOutDTO(value) {
1364
1468
  if (!("contentPurgedAt" in value) || value["contentPurgedAt"] === void 0) return false;
1365
1469
  if (!("createdAt" in value) || value["createdAt"] === void 0) return false;
1366
1470
  return true;
1367
1471
  }
1368
- function DocumentViewMetaOutDTOFromJSON(json) {
1369
- return DocumentViewMetaOutDTOFromJSONTyped(json, false);
1472
+ function DocumentAddExtractionsMetaOutDTOFromJSON(json) {
1473
+ return DocumentAddExtractionsMetaOutDTOFromJSONTyped(json, false);
1370
1474
  }
1371
- function DocumentViewMetaOutDTOFromJSONTyped(json, ignoreDiscriminator) {
1475
+ function DocumentAddExtractionsMetaOutDTOFromJSONTyped(json, ignoreDiscriminator) {
1372
1476
  if (json == null) {
1373
1477
  return json;
1374
1478
  }
@@ -1376,6 +1480,7 @@ function DocumentViewMetaOutDTOFromJSONTyped(json, ignoreDiscriminator) {
1376
1480
  "apiKeyId": json["apiKeyId"] == null ? void 0 : json["apiKeyId"],
1377
1481
  "contentPurgedAt": json["contentPurgedAt"] == null ? null : new Date(json["contentPurgedAt"]),
1378
1482
  "contentType": json["contentType"] == null ? void 0 : json["contentType"],
1483
+ "correlationId": json["correlationId"] == null ? void 0 : json["correlationId"],
1379
1484
  "createdAt": new Date(json["createdAt"]),
1380
1485
  "documentFileType": json["documentFileType"] == null ? void 0 : DocumentFileTypeModelFromJSON(json["documentFileType"]),
1381
1486
  "documentId": json["documentId"] == null ? void 0 : json["documentId"],
@@ -1384,6 +1489,7 @@ function DocumentViewMetaOutDTOFromJSONTyped(json, ignoreDiscriminator) {
1384
1489
  "fileSize": json["fileSize"] == null ? void 0 : json["fileSize"],
1385
1490
  "filename": json["filename"] == null ? void 0 : json["filename"],
1386
1491
  "imageUrl": json["imageUrl"] == null ? void 0 : json["imageUrl"],
1492
+ "next": json["next"] == null ? void 0 : json["next"],
1387
1493
  "normalizedHeight": json["normalizedHeight"] == null ? void 0 : json["normalizedHeight"],
1388
1494
  "normalizedMegapixels": json["normalizedMegapixels"] == null ? void 0 : json["normalizedMegapixels"],
1389
1495
  "normalizedWidth": json["normalizedWidth"] == null ? void 0 : json["normalizedWidth"],
@@ -1395,10 +1501,10 @@ function DocumentViewMetaOutDTOFromJSONTyped(json, ignoreDiscriminator) {
1395
1501
  "userId": json["userId"] == null ? void 0 : json["userId"]
1396
1502
  };
1397
1503
  }
1398
- function DocumentViewMetaOutDTOToJSON(json) {
1399
- return DocumentViewMetaOutDTOToJSONTyped(json, false);
1504
+ function DocumentAddExtractionsMetaOutDTOToJSON(json) {
1505
+ return DocumentAddExtractionsMetaOutDTOToJSONTyped(json, false);
1400
1506
  }
1401
- function DocumentViewMetaOutDTOToJSONTyped(value, ignoreDiscriminator = false) {
1507
+ function DocumentAddExtractionsMetaOutDTOToJSONTyped(value, ignoreDiscriminator = false) {
1402
1508
  if (value == null) {
1403
1509
  return value;
1404
1510
  }
@@ -1406,6 +1512,7 @@ function DocumentViewMetaOutDTOToJSONTyped(value, ignoreDiscriminator = false) {
1406
1512
  "apiKeyId": value["apiKeyId"],
1407
1513
  "contentPurgedAt": value["contentPurgedAt"] == null ? value["contentPurgedAt"] : value["contentPurgedAt"].toISOString(),
1408
1514
  "contentType": value["contentType"],
1515
+ "correlationId": value["correlationId"],
1409
1516
  "createdAt": value["createdAt"].toISOString(),
1410
1517
  "documentFileType": DocumentFileTypeModelToJSON(value["documentFileType"]),
1411
1518
  "documentId": value["documentId"],
@@ -1414,6 +1521,7 @@ function DocumentViewMetaOutDTOToJSONTyped(value, ignoreDiscriminator = false) {
1414
1521
  "fileSize": value["fileSize"],
1415
1522
  "filename": value["filename"],
1416
1523
  "imageUrl": value["imageUrl"],
1524
+ "next": value["next"],
1417
1525
  "normalizedHeight": value["normalizedHeight"],
1418
1526
  "normalizedMegapixels": value["normalizedMegapixels"],
1419
1527
  "normalizedWidth": value["normalizedWidth"],
@@ -1530,38 +1638,6 @@ function ExtractionTypeModelToJSONTyped(value, ignoreDiscriminator) {
1530
1638
  return value;
1531
1639
  }
1532
1640
 
1533
- // src/generated/models/ModelType.ts
1534
- var ModelType = {
1535
- Gemina: "gemina",
1536
- Google: "google",
1537
- Openai: "openai",
1538
- Velox: "velox",
1539
- Praetorian: "praetorian",
1540
- Invictus: "invictus"
1541
- };
1542
- function instanceOfModelType(value) {
1543
- for (const key in ModelType) {
1544
- if (Object.prototype.hasOwnProperty.call(ModelType, key)) {
1545
- if (ModelType[key] === value) {
1546
- return true;
1547
- }
1548
- }
1549
- }
1550
- return false;
1551
- }
1552
- function ModelTypeFromJSON(json) {
1553
- return ModelTypeFromJSONTyped(json, false);
1554
- }
1555
- function ModelTypeFromJSONTyped(json, ignoreDiscriminator) {
1556
- return json;
1557
- }
1558
- function ModelTypeToJSON(value) {
1559
- return value;
1560
- }
1561
- function ModelTypeToJSONTyped(value, ignoreDiscriminator) {
1562
- return value;
1563
- }
1564
-
1565
1641
  // src/generated/models/ValidationFieldModel.ts
1566
1642
  var ValidationFieldModelTypeEnum = {
1567
1643
  String: "string",
@@ -1850,6 +1926,118 @@ function DocumentDataOutDTOToJSONTyped(value, ignoreDiscriminator = false) {
1850
1926
  };
1851
1927
  }
1852
1928
 
1929
+ // src/generated/models/DocumentAddExtractionsOutDTO.ts
1930
+ function instanceOfDocumentAddExtractionsOutDTO(value) {
1931
+ if (!("data" in value) || value["data"] === void 0) return false;
1932
+ if (!("meta" in value) || value["meta"] === void 0) return false;
1933
+ if (!("pollCorrelationId" in value) || value["pollCorrelationId"] === void 0) return false;
1934
+ if (!("status" in value) || value["status"] === void 0) return false;
1935
+ return true;
1936
+ }
1937
+ function DocumentAddExtractionsOutDTOFromJSON(json) {
1938
+ return DocumentAddExtractionsOutDTOFromJSONTyped(json, false);
1939
+ }
1940
+ function DocumentAddExtractionsOutDTOFromJSONTyped(json, ignoreDiscriminator) {
1941
+ if (json == null) {
1942
+ return json;
1943
+ }
1944
+ return {
1945
+ "createdAt": json["createdAt"] == null ? void 0 : new Date(json["createdAt"]),
1946
+ "createdAtTimestamp": json["createdAtTimestamp"] == null ? void 0 : json["createdAtTimestamp"],
1947
+ "data": DocumentDataOutDTOFromJSON(json["data"]),
1948
+ "errors": json["errors"] == null ? void 0 : json["errors"],
1949
+ "meta": DocumentAddExtractionsMetaOutDTOFromJSON(json["meta"]),
1950
+ "newExtractionIds": json["newExtractionIds"] == null ? void 0 : json["newExtractionIds"],
1951
+ "pollCorrelationId": json["pollCorrelationId"],
1952
+ "status": ResponseStatusFromJSON(json["status"])
1953
+ };
1954
+ }
1955
+ function DocumentAddExtractionsOutDTOToJSON(json) {
1956
+ return DocumentAddExtractionsOutDTOToJSONTyped(json, false);
1957
+ }
1958
+ function DocumentAddExtractionsOutDTOToJSONTyped(value, ignoreDiscriminator = false) {
1959
+ if (value == null) {
1960
+ return value;
1961
+ }
1962
+ return {
1963
+ "createdAt": value["createdAt"] == null ? value["createdAt"] : value["createdAt"].toISOString(),
1964
+ "createdAtTimestamp": value["createdAtTimestamp"],
1965
+ "data": DocumentDataOutDTOToJSON(value["data"]),
1966
+ "errors": value["errors"],
1967
+ "meta": DocumentAddExtractionsMetaOutDTOToJSON(value["meta"]),
1968
+ "newExtractionIds": value["newExtractionIds"],
1969
+ "pollCorrelationId": value["pollCorrelationId"],
1970
+ "status": ResponseStatusToJSON(value["status"])
1971
+ };
1972
+ }
1973
+
1974
+ // src/generated/models/DocumentViewMetaOutDTO.ts
1975
+ function instanceOfDocumentViewMetaOutDTO(value) {
1976
+ if (!("contentPurgedAt" in value) || value["contentPurgedAt"] === void 0) return false;
1977
+ if (!("createdAt" in value) || value["createdAt"] === void 0) return false;
1978
+ return true;
1979
+ }
1980
+ function DocumentViewMetaOutDTOFromJSON(json) {
1981
+ return DocumentViewMetaOutDTOFromJSONTyped(json, false);
1982
+ }
1983
+ function DocumentViewMetaOutDTOFromJSONTyped(json, ignoreDiscriminator) {
1984
+ if (json == null) {
1985
+ return json;
1986
+ }
1987
+ return {
1988
+ "apiKeyId": json["apiKeyId"] == null ? void 0 : json["apiKeyId"],
1989
+ "contentPurgedAt": json["contentPurgedAt"] == null ? null : new Date(json["contentPurgedAt"]),
1990
+ "contentType": json["contentType"] == null ? void 0 : json["contentType"],
1991
+ "createdAt": new Date(json["createdAt"]),
1992
+ "documentFileType": json["documentFileType"] == null ? void 0 : DocumentFileTypeModelFromJSON(json["documentFileType"]),
1993
+ "documentId": json["documentId"] == null ? void 0 : json["documentId"],
1994
+ "endUserId": json["endUserId"] == null ? void 0 : json["endUserId"],
1995
+ "externalId": json["externalId"] == null ? void 0 : json["externalId"],
1996
+ "fileSize": json["fileSize"] == null ? void 0 : json["fileSize"],
1997
+ "filename": json["filename"] == null ? void 0 : json["filename"],
1998
+ "imageUrl": json["imageUrl"] == null ? void 0 : json["imageUrl"],
1999
+ "normalizedHeight": json["normalizedHeight"] == null ? void 0 : json["normalizedHeight"],
2000
+ "normalizedMegapixels": json["normalizedMegapixels"] == null ? void 0 : json["normalizedMegapixels"],
2001
+ "normalizedWidth": json["normalizedWidth"] == null ? void 0 : json["normalizedWidth"],
2002
+ "numberOfPages": json["numberOfPages"] == null ? void 0 : json["numberOfPages"],
2003
+ "originalDocumentUrl": json["originalDocumentUrl"] == null ? void 0 : json["originalDocumentUrl"],
2004
+ "processingStatus": json["processingStatus"] == null ? void 0 : ResponseStatusFromJSON(json["processingStatus"]),
2005
+ "storageLocation": json["storageLocation"] == null ? void 0 : DataCenterRegionModelFromJSON(json["storageLocation"]),
2006
+ "thumbnailUrl": json["thumbnailUrl"] == null ? void 0 : json["thumbnailUrl"],
2007
+ "userId": json["userId"] == null ? void 0 : json["userId"]
2008
+ };
2009
+ }
2010
+ function DocumentViewMetaOutDTOToJSON(json) {
2011
+ return DocumentViewMetaOutDTOToJSONTyped(json, false);
2012
+ }
2013
+ function DocumentViewMetaOutDTOToJSONTyped(value, ignoreDiscriminator = false) {
2014
+ if (value == null) {
2015
+ return value;
2016
+ }
2017
+ return {
2018
+ "apiKeyId": value["apiKeyId"],
2019
+ "contentPurgedAt": value["contentPurgedAt"] == null ? value["contentPurgedAt"] : value["contentPurgedAt"].toISOString(),
2020
+ "contentType": value["contentType"],
2021
+ "createdAt": value["createdAt"].toISOString(),
2022
+ "documentFileType": DocumentFileTypeModelToJSON(value["documentFileType"]),
2023
+ "documentId": value["documentId"],
2024
+ "endUserId": value["endUserId"],
2025
+ "externalId": value["externalId"],
2026
+ "fileSize": value["fileSize"],
2027
+ "filename": value["filename"],
2028
+ "imageUrl": value["imageUrl"],
2029
+ "normalizedHeight": value["normalizedHeight"],
2030
+ "normalizedMegapixels": value["normalizedMegapixels"],
2031
+ "normalizedWidth": value["normalizedWidth"],
2032
+ "numberOfPages": value["numberOfPages"],
2033
+ "originalDocumentUrl": value["originalDocumentUrl"],
2034
+ "processingStatus": ResponseStatusToJSON(value["processingStatus"]),
2035
+ "storageLocation": DataCenterRegionModelToJSON(value["storageLocation"]),
2036
+ "thumbnailUrl": value["thumbnailUrl"],
2037
+ "userId": value["userId"]
2038
+ };
2039
+ }
2040
+
1853
2041
  // src/generated/models/DocumentPrimaryViewOutDTO.ts
1854
2042
  function instanceOfDocumentPrimaryViewOutDTO(value) {
1855
2043
  if (!("data" in value) || value["data"] === void 0) return false;
@@ -3196,38 +3384,6 @@ function NumberOfStoredDocumentsOutDTOToJSONTyped(value, ignoreDiscriminator = f
3196
3384
  };
3197
3385
  }
3198
3386
 
3199
- // src/generated/models/UploadExtractionTypeEnum.ts
3200
- var UploadExtractionTypeEnum = {
3201
- Ocr: "ocr",
3202
- DocumentDetailsHebrew: "document_details_hebrew",
3203
- DocumentLineItemsHebrew: "document_line_items_hebrew",
3204
- InvoiceHeaders: "invoice_headers",
3205
- InvoiceLineItems: "invoice_line_items",
3206
- CustomTemplate: "custom_template"
3207
- };
3208
- function instanceOfUploadExtractionTypeEnum(value) {
3209
- for (const key in UploadExtractionTypeEnum) {
3210
- if (Object.prototype.hasOwnProperty.call(UploadExtractionTypeEnum, key)) {
3211
- if (UploadExtractionTypeEnum[key] === value) {
3212
- return true;
3213
- }
3214
- }
3215
- }
3216
- return false;
3217
- }
3218
- function UploadExtractionTypeEnumFromJSON(json) {
3219
- return UploadExtractionTypeEnumFromJSONTyped(json, false);
3220
- }
3221
- function UploadExtractionTypeEnumFromJSONTyped(json, ignoreDiscriminator) {
3222
- return json;
3223
- }
3224
- function UploadExtractionTypeEnumToJSON(value) {
3225
- return value;
3226
- }
3227
- function UploadExtractionTypeEnumToJSONTyped(value, ignoreDiscriminator) {
3228
- return value;
3229
- }
3230
-
3231
3387
  // src/generated/models/WebDocumentUploadInDTO.ts
3232
3388
  function instanceOfWebDocumentUploadInDTO(value) {
3233
3389
  if (!("externalId" in value) || value["externalId"] === void 0) return false;
@@ -3282,6 +3438,102 @@ function WebDocumentUploadInDTOToJSONTyped(value, ignoreDiscriminator = false) {
3282
3438
 
3283
3439
  // src/generated/apis/DocumentApi.ts
3284
3440
  var DocumentApi = class extends BaseAPI {
3441
+ /**
3442
+ * Creates request options for addDocumentExtractions without sending the request
3443
+ */
3444
+ async addDocumentExtractionsRequestOpts(requestParameters) {
3445
+ if (requestParameters["documentId"] == null) {
3446
+ throw new RequiredError(
3447
+ "documentId",
3448
+ 'Required parameter "documentId" was null or undefined when calling addDocumentExtractions().'
3449
+ );
3450
+ }
3451
+ if (requestParameters["addExtractionsInDTO"] == null) {
3452
+ throw new RequiredError(
3453
+ "addExtractionsInDTO",
3454
+ 'Required parameter "addExtractionsInDTO" was null or undefined when calling addDocumentExtractions().'
3455
+ );
3456
+ }
3457
+ const queryParameters = {};
3458
+ const headerParameters = {};
3459
+ headerParameters["Content-Type"] = "application/json";
3460
+ if (this.configuration && this.configuration.apiKey) {
3461
+ headerParameters["X-API-Key"] = await this.configuration.apiKey("X-API-Key");
3462
+ }
3463
+ let urlPath = `/api/v1/documents/{document_id}/extractions`;
3464
+ urlPath = urlPath.replace("{document_id}", encodeURIComponent(String(requestParameters["documentId"])));
3465
+ return {
3466
+ path: urlPath,
3467
+ method: "POST",
3468
+ headers: headerParameters,
3469
+ query: queryParameters,
3470
+ body: AddExtractionsInDTOToJSON(requestParameters["addExtractionsInDTO"])
3471
+ };
3472
+ }
3473
+ /**
3474
+ * Run additional extraction types on a document that is already stored. No upload: the document\'s stored artifacts are reused and only the extraction step runs. Billed per extraction like an upload. Returns the whole document (all extractions, old and new). When the new extractions are still running the response is HTTP 202 and ``pollCorrelationId`` / ``Location`` point at the existing results endpoint.
3475
+ * Add extraction types to an existing document
3476
+ */
3477
+ async addDocumentExtractionsRaw(requestParameters, initOverrides) {
3478
+ const requestOptions = await this.addDocumentExtractionsRequestOpts(requestParameters);
3479
+ const response = await this.request(requestOptions, initOverrides);
3480
+ return new JSONApiResponse(response, (jsonValue) => DocumentAddExtractionsOutDTOFromJSON(jsonValue));
3481
+ }
3482
+ /**
3483
+ * Run additional extraction types on a document that is already stored. No upload: the document\'s stored artifacts are reused and only the extraction step runs. Billed per extraction like an upload. Returns the whole document (all extractions, old and new). When the new extractions are still running the response is HTTP 202 and ``pollCorrelationId`` / ``Location`` point at the existing results endpoint.
3484
+ * Add extraction types to an existing document
3485
+ */
3486
+ async addDocumentExtractions(requestParameters, initOverrides) {
3487
+ const response = await this.addDocumentExtractionsRaw(requestParameters, initOverrides);
3488
+ return await response.value();
3489
+ }
3490
+ /**
3491
+ * Creates request options for addDocumentExtractionsByUser without sending the request
3492
+ */
3493
+ async addDocumentExtractionsByUserRequestOpts(requestParameters) {
3494
+ if (requestParameters["documentId"] == null) {
3495
+ throw new RequiredError(
3496
+ "documentId",
3497
+ 'Required parameter "documentId" was null or undefined when calling addDocumentExtractionsByUser().'
3498
+ );
3499
+ }
3500
+ if (requestParameters["addExtractionsInDTO"] == null) {
3501
+ throw new RequiredError(
3502
+ "addExtractionsInDTO",
3503
+ 'Required parameter "addExtractionsInDTO" was null or undefined when calling addDocumentExtractionsByUser().'
3504
+ );
3505
+ }
3506
+ const queryParameters = {};
3507
+ const headerParameters = {};
3508
+ headerParameters["Content-Type"] = "application/json";
3509
+ if (this.configuration && this.configuration.accessToken) {
3510
+ headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2PasswordBearer", []);
3511
+ }
3512
+ let urlPath = `/api/v1/documents/{document_id}/extractions/user`;
3513
+ urlPath = urlPath.replace("{document_id}", encodeURIComponent(String(requestParameters["documentId"])));
3514
+ return {
3515
+ path: urlPath,
3516
+ method: "POST",
3517
+ headers: headerParameters,
3518
+ query: queryParameters,
3519
+ body: AddExtractionsInDTOToJSON(requestParameters["addExtractionsInDTO"])
3520
+ };
3521
+ }
3522
+ /**
3523
+ * Add extraction types to an existing document (user credentials)
3524
+ */
3525
+ async addDocumentExtractionsByUserRaw(requestParameters, initOverrides) {
3526
+ const requestOptions = await this.addDocumentExtractionsByUserRequestOpts(requestParameters);
3527
+ const response = await this.request(requestOptions, initOverrides);
3528
+ return new JSONApiResponse(response, (jsonValue) => DocumentAddExtractionsOutDTOFromJSON(jsonValue));
3529
+ }
3530
+ /**
3531
+ * Add extraction types to an existing document (user credentials)
3532
+ */
3533
+ async addDocumentExtractionsByUser(requestParameters, initOverrides) {
3534
+ const response = await this.addDocumentExtractionsByUserRaw(requestParameters, initOverrides);
3535
+ return await response.value();
3536
+ }
3285
3537
  /**
3286
3538
  * Creates request options for createDocumentProcessingRequest without sending the request
3287
3539
  */
@@ -10316,9 +10568,6 @@ var GeminaClient = class _GeminaClient {
10316
10568
  'Unsupported document source: pass a Blob/File or { url: "https://..." }. In Node, convert a Buffer with new Blob([buf]).'
10317
10569
  );
10318
10570
  }
10319
- return this.pollUntilTerminal(submitted, options);
10320
- }
10321
- async pollUntilTerminal(submitted, options) {
10322
10571
  if (isTerminal(submitted.status)) {
10323
10572
  return finalizeTerminal(submitted);
10324
10573
  }
@@ -10328,6 +10577,47 @@ var GeminaClient = class _GeminaClient {
10328
10577
  "Malformed server response: non-terminal submit response is missing meta.correlationId"
10329
10578
  );
10330
10579
  }
10580
+ return this.pollUntilTerminal(correlationId, options, submitted);
10581
+ }
10582
+ /**
10583
+ * Add extraction types to a document Gemina already stores, then poll until
10584
+ * terminal and return the typed result — the add-on twin of
10585
+ * `processDocument` for a document you uploaded earlier (via
10586
+ * `processDocument`, FileTag, or an MCP tool), addressed by its id. No file
10587
+ * is re-uploaded; the stored document is re-extracted with the new
10588
+ * `extractionTypes`. Billing and page limits apply per added type exactly as
10589
+ * on an upload.
10590
+ *
10591
+ * @param documentId The stored document's id (from a prior upload's
10592
+ * `meta.documentId`, a FileTag result, or
10593
+ * `client.documents.getDocument(...)`).
10594
+ * @param extractionTypes Non-empty list of types to add.
10595
+ * @param options Per-extraction options + polling knobs.
10596
+ * @throws GeminaProcessingError on terminal `failed`.
10597
+ * @throws GeminaTimeoutError on the deadline; `.correlationId` resumes polling.
10598
+ * @throws ResponseError if the add-on request itself is rejected —
10599
+ * 404 (unknown document), 409 (type already present), 410 (content purged),
10600
+ * 422 (`custom_template` without `templateId`), 429 (out of credits / over quota). Not retried.
10601
+ */
10602
+ async addExtractionsAndWait(documentId, extractionTypes, options = {}) {
10603
+ if (!Array.isArray(extractionTypes) || extractionTypes.length === 0) {
10604
+ throw new GeminaError("extractionTypes must be a non-empty array");
10605
+ }
10606
+ const submitted = await this.documents.addDocumentExtractions({
10607
+ documentId,
10608
+ addExtractionsInDTO: {
10609
+ extractionTypes,
10610
+ templateId: options.templateId,
10611
+ modelType: options.modelType,
10612
+ thinking: options.thinking,
10613
+ evaluation: options.evaluation,
10614
+ correction: options.correction,
10615
+ includeCoordinates: options.includeCoordinates
10616
+ }
10617
+ });
10618
+ return this.pollUntilTerminal(submitted.pollCorrelationId, options);
10619
+ }
10620
+ async pollUntilTerminal(correlationId, options, initialResult) {
10331
10621
  const timeoutSeconds = options.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS;
10332
10622
  const initialIntervalSeconds = options.initialIntervalSeconds ?? DEFAULT_INITIAL_INTERVAL_SECONDS;
10333
10623
  const maxIntervalSeconds = options.maxIntervalSeconds ?? DEFAULT_MAX_INTERVAL_SECONDS;
@@ -10336,7 +10626,7 @@ var GeminaClient = class _GeminaClient {
10336
10626
  const startedAt = Date.now();
10337
10627
  let sleptSeconds = 0;
10338
10628
  let nominalInterval = Math.min(initialIntervalSeconds, maxIntervalSeconds);
10339
- let lastResult = submitted;
10629
+ let lastResult = initialResult;
10340
10630
  let consecutivePollFailures = 0;
10341
10631
  for (; ; ) {
10342
10632
  const wait = nominalInterval * (JITTER_MIN + JITTER_SPAN * random());
@@ -10399,8 +10689,12 @@ async function asProcessingErrorIfFailedResult(error) {
10399
10689
  }
10400
10690
 
10401
10691
  // src/version.ts
10402
- var VERSION = "0.13.3";
10692
+ var VERSION = "0.15.0";
10403
10693
  export {
10694
+ AddExtractionsInDTOFromJSON,
10695
+ AddExtractionsInDTOFromJSONTyped,
10696
+ AddExtractionsInDTOToJSON,
10697
+ AddExtractionsInDTOToJSONTyped,
10404
10698
  AggregateMetaDTOFromJSON,
10405
10699
  AggregateMetaDTOFromJSONTyped,
10406
10700
  AggregateMetaDTOToJSON,
@@ -10516,6 +10810,14 @@ export {
10516
10810
  DataRetentionPeriodModelToJSON,
10517
10811
  DataRetentionPeriodModelToJSONTyped,
10518
10812
  DefaultConfig,
10813
+ DocumentAddExtractionsMetaOutDTOFromJSON,
10814
+ DocumentAddExtractionsMetaOutDTOFromJSONTyped,
10815
+ DocumentAddExtractionsMetaOutDTOToJSON,
10816
+ DocumentAddExtractionsMetaOutDTOToJSONTyped,
10817
+ DocumentAddExtractionsOutDTOFromJSON,
10818
+ DocumentAddExtractionsOutDTOFromJSONTyped,
10819
+ DocumentAddExtractionsOutDTOToJSON,
10820
+ DocumentAddExtractionsOutDTOToJSONTyped,
10519
10821
  DocumentApi,
10520
10822
  DocumentDataOutDTOFromJSON,
10521
10823
  DocumentDataOutDTOFromJSONTyped,
@@ -11061,6 +11363,7 @@ export {
11061
11363
  WebhookResponseDTOToJSONTyped,
11062
11364
  canConsumeForm,
11063
11365
  exists,
11366
+ instanceOfAddExtractionsInDTO,
11064
11367
  instanceOfAggregateMetaDTO,
11065
11368
  instanceOfAggregateMetricDTO,
11066
11369
  instanceOfAggregateRowDTO,
@@ -11085,6 +11388,8 @@ export {
11085
11388
  instanceOfCreditTransactionType,
11086
11389
  instanceOfDataCenterRegionModel,
11087
11390
  instanceOfDataRetentionPeriodModel,
11391
+ instanceOfDocumentAddExtractionsMetaOutDTO,
11392
+ instanceOfDocumentAddExtractionsOutDTO,
11088
11393
  instanceOfDocumentDataOutDTO,
11089
11394
  instanceOfDocumentFileTypeModel,
11090
11395
  instanceOfDocumentMetaOutDTO,