@pairsystems/goodmem-client 1.0.6 → 1.0.8

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.
Files changed (46) hide show
  1. package/README.md +28 -2
  2. package/dist/api/EmbeddersApi.js +8 -8
  3. package/dist/api/LLMsApi.js +8 -8
  4. package/dist/api/MemoriesApi.js +36 -34
  5. package/dist/api/OCRApi.js +85 -0
  6. package/dist/api/PingApi.js +133 -0
  7. package/dist/api/RerankersApi.js +10 -10
  8. package/dist/api/SpacesApi.js +14 -14
  9. package/dist/index.js +175 -0
  10. package/dist/model/BatchMemoryCreationRequest.js +0 -8
  11. package/dist/model/BatchMemoryDeletionRequest.js +0 -8
  12. package/dist/model/BatchMemoryRetrievalRequest.js +0 -8
  13. package/dist/model/BoundingBox.js +143 -0
  14. package/dist/model/DocumentTimings.js +154 -0
  15. package/dist/model/EmbedderCreationRequest.js +0 -8
  16. package/dist/model/EmbedderResponse.js +14 -0
  17. package/dist/model/ImageInfo.js +132 -0
  18. package/dist/model/LLMCreationRequest.js +3 -11
  19. package/dist/model/LLMResponse.js +16 -2
  20. package/dist/model/LLMUpdateRequest.js +1 -9
  21. package/dist/model/MemoryCreationRequest.js +13 -8
  22. package/dist/model/OcrCategory.js +118 -0
  23. package/dist/model/OcrCell.js +154 -0
  24. package/dist/model/OcrDocumentRequest.js +159 -0
  25. package/dist/model/OcrDocumentResponse.js +170 -0
  26. package/dist/model/OcrInputFormat.js +78 -0
  27. package/dist/model/OcrLayout.js +132 -0
  28. package/dist/model/OcrPage.js +173 -0
  29. package/dist/model/OcrPageResult.js +138 -0
  30. package/dist/model/PageTimings.js +143 -0
  31. package/dist/model/PingEndpointInfo.js +170 -0
  32. package/dist/model/PingEvent.js +120 -0
  33. package/dist/model/PingNotice.js +140 -0
  34. package/dist/model/PingOnceRequest.js +163 -0
  35. package/dist/model/PingPayloadType.js +68 -0
  36. package/dist/model/PingResult.js +221 -0
  37. package/dist/model/PingStreamRequest.js +210 -0
  38. package/dist/model/PingSummary.js +269 -0
  39. package/dist/model/PingTargetType.js +68 -0
  40. package/dist/model/PingTiming.js +143 -0
  41. package/dist/model/RerankerCreationRequest.js +1 -9
  42. package/dist/model/RerankerResponse.js +14 -0
  43. package/dist/model/RpcStatus.js +123 -0
  44. package/dist/model/SpaceCreationRequest.js +7 -5
  45. package/dist/model/SpaceEmbedderConfig.js +5 -7
  46. package/package.json +1 -1
@@ -69,9 +69,6 @@ var MemoryCreationRequest = /*#__PURE__*/function () {
69
69
  value: function constructFromObject(data, obj) {
70
70
  if (data) {
71
71
  obj = obj || new MemoryCreationRequest();
72
- if (data.hasOwnProperty('validate')) {
73
- obj['validate'] = _ApiClient["default"].convertToType(data['validate'], Object);
74
- }
75
72
  if (data.hasOwnProperty('memoryId')) {
76
73
  obj['memoryId'] = _ApiClient["default"].convertToType(data['memoryId'], 'String');
77
74
  }
@@ -96,6 +93,9 @@ var MemoryCreationRequest = /*#__PURE__*/function () {
96
93
  if (data.hasOwnProperty('chunkingConfig')) {
97
94
  obj['chunkingConfig'] = _ChunkingConfiguration["default"].constructFromObject(data['chunkingConfig']);
98
95
  }
96
+ if (data.hasOwnProperty('fileField')) {
97
+ obj['fileField'] = _ApiClient["default"].convertToType(data['fileField'], 'String');
98
+ }
99
99
  }
100
100
  return obj;
101
101
  }
@@ -152,17 +152,16 @@ var MemoryCreationRequest = /*#__PURE__*/function () {
152
152
  // data not null
153
153
  _ChunkingConfiguration["default"].validateJSON(data['chunkingConfig']);
154
154
  }
155
+ // ensure the json data is a string
156
+ if (data['fileField'] && !(typeof data['fileField'] === 'string' || data['fileField'] instanceof String)) {
157
+ throw new Error("Expected the field `fileField` to be a primitive type in the JSON string but got " + data['fileField']);
158
+ }
155
159
  return true;
156
160
  }
157
161
  }]);
158
162
  }();
159
163
  MemoryCreationRequest.RequiredProperties = ["spaceId", "contentType"];
160
164
 
161
- /**
162
- * @member {Object} validate
163
- */
164
- MemoryCreationRequest.prototype['validate'] = undefined;
165
-
166
165
  /**
167
166
  * Optional client-provided UUID for the memory. If omitted, the server generates one. Returns ALREADY_EXISTS if the ID is already in use.
168
167
  * @member {String} memoryId
@@ -209,4 +208,10 @@ MemoryCreationRequest.prototype['metadata'] = undefined;
209
208
  * @member {module:model/ChunkingConfiguration} chunkingConfig
210
209
  */
211
210
  MemoryCreationRequest.prototype['chunkingConfig'] = undefined;
211
+
212
+ /**
213
+ * Optional multipart file field name to bind binary content; required when multiple files are uploaded in a batch multipart request.
214
+ * @member {String} fileField
215
+ */
216
+ MemoryCreationRequest.prototype['fileField'] = undefined;
212
217
  var _default = exports["default"] = MemoryCreationRequest;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
11
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
12
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
13
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
15
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
16
+ *
17
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
18
+ *
19
+ * The version of the OpenAPI document:
20
+ *
21
+ *
22
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
23
+ * https://openapi-generator.tech
24
+ * Do not edit the class manually.
25
+ *
26
+ */
27
+ /**
28
+ * Enum class OcrCategory.
29
+ * @enum {}
30
+ * @readonly
31
+ */
32
+ var OcrCategory = exports["default"] = /*#__PURE__*/function () {
33
+ function OcrCategory() {
34
+ _classCallCheck(this, OcrCategory);
35
+ /**
36
+ * value: "UNSPECIFIED"
37
+ * @const
38
+ */
39
+ _defineProperty(this, "UNSPECIFIED", "UNSPECIFIED");
40
+ /**
41
+ * value: "CAPTION"
42
+ * @const
43
+ */
44
+ _defineProperty(this, "CAPTION", "CAPTION");
45
+ /**
46
+ * value: "FOOTNOTE"
47
+ * @const
48
+ */
49
+ _defineProperty(this, "FOOTNOTE", "FOOTNOTE");
50
+ /**
51
+ * value: "FORMULA"
52
+ * @const
53
+ */
54
+ _defineProperty(this, "FORMULA", "FORMULA");
55
+ /**
56
+ * value: "LIST_ITEM"
57
+ * @const
58
+ */
59
+ _defineProperty(this, "LIST_ITEM", "LIST_ITEM");
60
+ /**
61
+ * value: "PAGE_FOOTER"
62
+ * @const
63
+ */
64
+ _defineProperty(this, "PAGE_FOOTER", "PAGE_FOOTER");
65
+ /**
66
+ * value: "PAGE_HEADER"
67
+ * @const
68
+ */
69
+ _defineProperty(this, "PAGE_HEADER", "PAGE_HEADER");
70
+ /**
71
+ * value: "PICTURE"
72
+ * @const
73
+ */
74
+ _defineProperty(this, "PICTURE", "PICTURE");
75
+ /**
76
+ * value: "SECTION_HEADER"
77
+ * @const
78
+ */
79
+ _defineProperty(this, "SECTION_HEADER", "SECTION_HEADER");
80
+ /**
81
+ * value: "TABLE"
82
+ * @const
83
+ */
84
+ _defineProperty(this, "TABLE", "TABLE");
85
+ /**
86
+ * value: "TEXT"
87
+ * @const
88
+ */
89
+ _defineProperty(this, "TEXT", "TEXT");
90
+ /**
91
+ * value: "TITLE"
92
+ * @const
93
+ */
94
+ _defineProperty(this, "TITLE", "TITLE");
95
+ /**
96
+ * value: "OTHER"
97
+ * @const
98
+ */
99
+ _defineProperty(this, "OTHER", "OTHER");
100
+ /**
101
+ * value: "UNKNOWN"
102
+ * @const
103
+ */
104
+ _defineProperty(this, "UNKNOWN", "UNKNOWN");
105
+ }
106
+ return _createClass(OcrCategory, null, [{
107
+ key: "constructFromObject",
108
+ value:
109
+ /**
110
+ * Returns a <code>OcrCategory</code> enum value from a Javascript object name.
111
+ * @param {Object} data The plain JavaScript object containing the name of the enum value.
112
+ * @return {module:model/OcrCategory} The enum <code>OcrCategory</code> value.
113
+ */
114
+ function constructFromObject(object) {
115
+ return object;
116
+ }
117
+ }]);
118
+ }();
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ var _BoundingBox = _interopRequireDefault(require("./BoundingBox"));
9
+ var _OcrCategory = _interopRequireDefault(require("./OcrCategory"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
12
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
13
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
14
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
16
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
17
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
20
+ *
21
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
22
+ *
23
+ * The version of the OpenAPI document:
24
+ *
25
+ *
26
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
27
+ * https://openapi-generator.tech
28
+ * Do not edit the class manually.
29
+ *
30
+ */
31
+ /**
32
+ * The OcrCell model module.
33
+ * @module model/OcrCell
34
+ * @version 1.0.0
35
+ */
36
+ var OcrCell = /*#__PURE__*/function () {
37
+ /**
38
+ * Constructs a new <code>OcrCell</code>.
39
+ * Single OCR layout element.
40
+ * @alias module:model/OcrCell
41
+ * @param categoryLabel {String} Raw category label emitted by OCR
42
+ * @param category {module:model/OcrCategory}
43
+ * @param text {String} OCR text content
44
+ */
45
+ function OcrCell(categoryLabel, category, text) {
46
+ _classCallCheck(this, OcrCell);
47
+ OcrCell.initialize(this, categoryLabel, category, text);
48
+ }
49
+
50
+ /**
51
+ * Initializes the fields of this object.
52
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
53
+ * Only for internal use.
54
+ */
55
+ return _createClass(OcrCell, null, [{
56
+ key: "initialize",
57
+ value: function initialize(obj, categoryLabel, category, text) {
58
+ obj['categoryLabel'] = categoryLabel;
59
+ obj['category'] = category;
60
+ obj['text'] = text;
61
+ }
62
+
63
+ /**
64
+ * Constructs a <code>OcrCell</code> from a plain JavaScript object, optionally creating a new instance.
65
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
66
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
67
+ * @param {module:model/OcrCell} obj Optional instance to populate.
68
+ * @return {module:model/OcrCell} The populated <code>OcrCell</code> instance.
69
+ */
70
+ }, {
71
+ key: "constructFromObject",
72
+ value: function constructFromObject(data, obj) {
73
+ if (data) {
74
+ obj = obj || new OcrCell();
75
+ if (data.hasOwnProperty('bbox')) {
76
+ obj['bbox'] = _BoundingBox["default"].constructFromObject(data['bbox']);
77
+ }
78
+ if (data.hasOwnProperty('categoryLabel')) {
79
+ obj['categoryLabel'] = _ApiClient["default"].convertToType(data['categoryLabel'], 'String');
80
+ }
81
+ if (data.hasOwnProperty('category')) {
82
+ obj['category'] = _OcrCategory["default"].constructFromObject(data['category']);
83
+ }
84
+ if (data.hasOwnProperty('text')) {
85
+ obj['text'] = _ApiClient["default"].convertToType(data['text'], 'String');
86
+ }
87
+ }
88
+ return obj;
89
+ }
90
+
91
+ /**
92
+ * Validates the JSON data with respect to <code>OcrCell</code>.
93
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
94
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>OcrCell</code>.
95
+ */
96
+ }, {
97
+ key: "validateJSON",
98
+ value: function validateJSON(data) {
99
+ // check to make sure all required properties are present in the JSON string
100
+ var _iterator = _createForOfIteratorHelper(OcrCell.RequiredProperties),
101
+ _step;
102
+ try {
103
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
104
+ var property = _step.value;
105
+ if (!data.hasOwnProperty(property)) {
106
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
107
+ }
108
+ }
109
+ // validate the optional field `bbox`
110
+ } catch (err) {
111
+ _iterator.e(err);
112
+ } finally {
113
+ _iterator.f();
114
+ }
115
+ if (data['bbox']) {
116
+ // data not null
117
+ _BoundingBox["default"].validateJSON(data['bbox']);
118
+ }
119
+ // ensure the json data is a string
120
+ if (data['categoryLabel'] && !(typeof data['categoryLabel'] === 'string' || data['categoryLabel'] instanceof String)) {
121
+ throw new Error("Expected the field `categoryLabel` to be a primitive type in the JSON string but got " + data['categoryLabel']);
122
+ }
123
+ // ensure the json data is a string
124
+ if (data['text'] && !(typeof data['text'] === 'string' || data['text'] instanceof String)) {
125
+ throw new Error("Expected the field `text` to be a primitive type in the JSON string but got " + data['text']);
126
+ }
127
+ return true;
128
+ }
129
+ }]);
130
+ }();
131
+ OcrCell.RequiredProperties = ["categoryLabel", "category", "text"];
132
+
133
+ /**
134
+ * @member {module:model/BoundingBox} bbox
135
+ */
136
+ OcrCell.prototype['bbox'] = undefined;
137
+
138
+ /**
139
+ * Raw category label emitted by OCR
140
+ * @member {String} categoryLabel
141
+ */
142
+ OcrCell.prototype['categoryLabel'] = undefined;
143
+
144
+ /**
145
+ * @member {module:model/OcrCategory} category
146
+ */
147
+ OcrCell.prototype['category'] = undefined;
148
+
149
+ /**
150
+ * OCR text content
151
+ * @member {String} text
152
+ */
153
+ OcrCell.prototype['text'] = undefined;
154
+ var _default = exports["default"] = OcrCell;
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ var _OcrInputFormat = _interopRequireDefault(require("./OcrInputFormat"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
11
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
12
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
13
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
14
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
15
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
16
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
19
+ *
20
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
21
+ *
22
+ * The version of the OpenAPI document:
23
+ *
24
+ *
25
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
26
+ * https://openapi-generator.tech
27
+ * Do not edit the class manually.
28
+ *
29
+ */
30
+ /**
31
+ * The OcrDocumentRequest model module.
32
+ * @module model/OcrDocumentRequest
33
+ * @version 1.0.0
34
+ */
35
+ var OcrDocumentRequest = /*#__PURE__*/function () {
36
+ /**
37
+ * Constructs a new <code>OcrDocumentRequest</code>.
38
+ * Request body for OCR document processing.
39
+ * @alias module:model/OcrDocumentRequest
40
+ * @param content {String} Base64-encoded document bytes
41
+ */
42
+ function OcrDocumentRequest(content) {
43
+ _classCallCheck(this, OcrDocumentRequest);
44
+ OcrDocumentRequest.initialize(this, content);
45
+ }
46
+
47
+ /**
48
+ * Initializes the fields of this object.
49
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
50
+ * Only for internal use.
51
+ */
52
+ return _createClass(OcrDocumentRequest, null, [{
53
+ key: "initialize",
54
+ value: function initialize(obj, content) {
55
+ obj['content'] = content;
56
+ }
57
+
58
+ /**
59
+ * Constructs a <code>OcrDocumentRequest</code> from a plain JavaScript object, optionally creating a new instance.
60
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
61
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
62
+ * @param {module:model/OcrDocumentRequest} obj Optional instance to populate.
63
+ * @return {module:model/OcrDocumentRequest} The populated <code>OcrDocumentRequest</code> instance.
64
+ */
65
+ }, {
66
+ key: "constructFromObject",
67
+ value: function constructFromObject(data, obj) {
68
+ if (data) {
69
+ obj = obj || new OcrDocumentRequest();
70
+ if (data.hasOwnProperty('content')) {
71
+ obj['content'] = _ApiClient["default"].convertToType(data['content'], 'String');
72
+ }
73
+ if (data.hasOwnProperty('format')) {
74
+ obj['format'] = _OcrInputFormat["default"].constructFromObject(data['format']);
75
+ }
76
+ if (data.hasOwnProperty('includeRawJson')) {
77
+ obj['includeRawJson'] = _ApiClient["default"].convertToType(data['includeRawJson'], 'Boolean');
78
+ }
79
+ if (data.hasOwnProperty('includeMarkdown')) {
80
+ obj['includeMarkdown'] = _ApiClient["default"].convertToType(data['includeMarkdown'], 'Boolean');
81
+ }
82
+ if (data.hasOwnProperty('startPage')) {
83
+ obj['startPage'] = _ApiClient["default"].convertToType(data['startPage'], 'Number');
84
+ }
85
+ if (data.hasOwnProperty('endPage')) {
86
+ obj['endPage'] = _ApiClient["default"].convertToType(data['endPage'], 'Number');
87
+ }
88
+ }
89
+ return obj;
90
+ }
91
+
92
+ /**
93
+ * Validates the JSON data with respect to <code>OcrDocumentRequest</code>.
94
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
95
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>OcrDocumentRequest</code>.
96
+ */
97
+ }, {
98
+ key: "validateJSON",
99
+ value: function validateJSON(data) {
100
+ // check to make sure all required properties are present in the JSON string
101
+ var _iterator = _createForOfIteratorHelper(OcrDocumentRequest.RequiredProperties),
102
+ _step;
103
+ try {
104
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
105
+ var property = _step.value;
106
+ if (!data.hasOwnProperty(property)) {
107
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
108
+ }
109
+ }
110
+ // ensure the json data is a string
111
+ } catch (err) {
112
+ _iterator.e(err);
113
+ } finally {
114
+ _iterator.f();
115
+ }
116
+ if (data['content'] && !(typeof data['content'] === 'string' || data['content'] instanceof String)) {
117
+ throw new Error("Expected the field `content` to be a primitive type in the JSON string but got " + data['content']);
118
+ }
119
+ return true;
120
+ }
121
+ }]);
122
+ }();
123
+ OcrDocumentRequest.RequiredProperties = ["content"];
124
+
125
+ /**
126
+ * Base64-encoded document bytes
127
+ * @member {String} content
128
+ */
129
+ OcrDocumentRequest.prototype['content'] = undefined;
130
+
131
+ /**
132
+ * @member {module:model/OcrInputFormat} format
133
+ */
134
+ OcrDocumentRequest.prototype['format'] = undefined;
135
+
136
+ /**
137
+ * Include raw OCR JSON payload in the response
138
+ * @member {Boolean} includeRawJson
139
+ */
140
+ OcrDocumentRequest.prototype['includeRawJson'] = undefined;
141
+
142
+ /**
143
+ * Include markdown rendering in the response
144
+ * @member {Boolean} includeMarkdown
145
+ */
146
+ OcrDocumentRequest.prototype['includeMarkdown'] = undefined;
147
+
148
+ /**
149
+ * 0-based inclusive start page
150
+ * @member {Number} startPage
151
+ */
152
+ OcrDocumentRequest.prototype['startPage'] = undefined;
153
+
154
+ /**
155
+ * 0-based inclusive end page
156
+ * @member {Number} endPage
157
+ */
158
+ OcrDocumentRequest.prototype['endPage'] = undefined;
159
+ var _default = exports["default"] = OcrDocumentRequest;
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _ApiClient = _interopRequireDefault(require("../ApiClient"));
8
+ var _DocumentTimings = _interopRequireDefault(require("./DocumentTimings"));
9
+ var _OcrInputFormat = _interopRequireDefault(require("./OcrInputFormat"));
10
+ var _OcrPageResult = _interopRequireDefault(require("./OcrPageResult"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
12
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
13
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
14
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
17
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
18
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
20
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
21
+ *
22
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
23
+ *
24
+ * The version of the OpenAPI document:
25
+ *
26
+ *
27
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
28
+ * https://openapi-generator.tech
29
+ * Do not edit the class manually.
30
+ *
31
+ */
32
+ /**
33
+ * The OcrDocumentResponse model module.
34
+ * @module model/OcrDocumentResponse
35
+ * @version 1.0.0
36
+ */
37
+ var OcrDocumentResponse = /*#__PURE__*/function () {
38
+ /**
39
+ * Constructs a new <code>OcrDocumentResponse</code>.
40
+ * Response containing page-ordered OCR results.
41
+ * @alias module:model/OcrDocumentResponse
42
+ * @param detectedFormat {module:model/OcrInputFormat}
43
+ * @param pageCount {Number} Number of pages processed after applying the range
44
+ * @param pages {Array.<module:model/OcrPageResult>} Ordered per-page OCR results
45
+ * @param timings {module:model/DocumentTimings}
46
+ */
47
+ function OcrDocumentResponse(detectedFormat, pageCount, pages, timings) {
48
+ _classCallCheck(this, OcrDocumentResponse);
49
+ OcrDocumentResponse.initialize(this, detectedFormat, pageCount, pages, timings);
50
+ }
51
+
52
+ /**
53
+ * Initializes the fields of this object.
54
+ * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
55
+ * Only for internal use.
56
+ */
57
+ return _createClass(OcrDocumentResponse, null, [{
58
+ key: "initialize",
59
+ value: function initialize(obj, detectedFormat, pageCount, pages, timings) {
60
+ obj['detectedFormat'] = detectedFormat;
61
+ obj['pageCount'] = pageCount;
62
+ obj['pages'] = pages;
63
+ obj['timings'] = timings;
64
+ }
65
+
66
+ /**
67
+ * Constructs a <code>OcrDocumentResponse</code> from a plain JavaScript object, optionally creating a new instance.
68
+ * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
69
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
70
+ * @param {module:model/OcrDocumentResponse} obj Optional instance to populate.
71
+ * @return {module:model/OcrDocumentResponse} The populated <code>OcrDocumentResponse</code> instance.
72
+ */
73
+ }, {
74
+ key: "constructFromObject",
75
+ value: function constructFromObject(data, obj) {
76
+ if (data) {
77
+ obj = obj || new OcrDocumentResponse();
78
+ if (data.hasOwnProperty('detectedFormat')) {
79
+ obj['detectedFormat'] = _OcrInputFormat["default"].constructFromObject(data['detectedFormat']);
80
+ }
81
+ if (data.hasOwnProperty('pageCount')) {
82
+ obj['pageCount'] = _ApiClient["default"].convertToType(data['pageCount'], 'Number');
83
+ }
84
+ if (data.hasOwnProperty('pages')) {
85
+ obj['pages'] = _ApiClient["default"].convertToType(data['pages'], [_OcrPageResult["default"]]);
86
+ }
87
+ if (data.hasOwnProperty('timings')) {
88
+ obj['timings'] = _DocumentTimings["default"].constructFromObject(data['timings']);
89
+ }
90
+ }
91
+ return obj;
92
+ }
93
+
94
+ /**
95
+ * Validates the JSON data with respect to <code>OcrDocumentResponse</code>.
96
+ * @param {Object} data The plain JavaScript object bearing properties of interest.
97
+ * @return {boolean} to indicate whether the JSON data is valid with respect to <code>OcrDocumentResponse</code>.
98
+ */
99
+ }, {
100
+ key: "validateJSON",
101
+ value: function validateJSON(data) {
102
+ // check to make sure all required properties are present in the JSON string
103
+ var _iterator = _createForOfIteratorHelper(OcrDocumentResponse.RequiredProperties),
104
+ _step;
105
+ try {
106
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
107
+ var property = _step.value;
108
+ if (!data.hasOwnProperty(property)) {
109
+ throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data));
110
+ }
111
+ }
112
+ } catch (err) {
113
+ _iterator.e(err);
114
+ } finally {
115
+ _iterator.f();
116
+ }
117
+ if (data['pages']) {
118
+ // data not null
119
+ // ensure the json data is an array
120
+ if (!Array.isArray(data['pages'])) {
121
+ throw new Error("Expected the field `pages` to be an array in the JSON data but got " + data['pages']);
122
+ }
123
+ // validate the optional field `pages` (array)
124
+ var _iterator2 = _createForOfIteratorHelper(data['pages']),
125
+ _step2;
126
+ try {
127
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
128
+ var item = _step2.value;
129
+ _OcrPageResult["default"].validateJSON(item);
130
+ }
131
+ } catch (err) {
132
+ _iterator2.e(err);
133
+ } finally {
134
+ _iterator2.f();
135
+ }
136
+ ;
137
+ }
138
+ // validate the optional field `timings`
139
+ if (data['timings']) {
140
+ // data not null
141
+ _DocumentTimings["default"].validateJSON(data['timings']);
142
+ }
143
+ return true;
144
+ }
145
+ }]);
146
+ }();
147
+ OcrDocumentResponse.RequiredProperties = ["detectedFormat", "pageCount", "pages", "timings"];
148
+
149
+ /**
150
+ * @member {module:model/OcrInputFormat} detectedFormat
151
+ */
152
+ OcrDocumentResponse.prototype['detectedFormat'] = undefined;
153
+
154
+ /**
155
+ * Number of pages processed after applying the range
156
+ * @member {Number} pageCount
157
+ */
158
+ OcrDocumentResponse.prototype['pageCount'] = undefined;
159
+
160
+ /**
161
+ * Ordered per-page OCR results
162
+ * @member {Array.<module:model/OcrPageResult>} pages
163
+ */
164
+ OcrDocumentResponse.prototype['pages'] = undefined;
165
+
166
+ /**
167
+ * @member {module:model/DocumentTimings} timings
168
+ */
169
+ OcrDocumentResponse.prototype['timings'] = undefined;
170
+ var _default = exports["default"] = OcrDocumentResponse;