mavenagi 1.2.56 → 1.2.57

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 (219) hide show
  1. package/BaseClient.js +2 -2
  2. package/Client.d.ts +3 -0
  3. package/Client.js +21 -16
  4. package/api/resources/analytics/types/ConversationBasicMetric.d.ts +5 -0
  5. package/api/resources/analytics/types/ConversationGroupBy.d.ts +9 -1
  6. package/api/resources/analytics/types/ConversationNumericMetric.d.ts +5 -0
  7. package/api/resources/analytics/types/ConversationTableRequest.d.ts +6 -0
  8. package/api/resources/charters/index.d.ts +1 -0
  9. package/api/resources/charters/index.js +17 -0
  10. package/api/resources/charters/types/CharterChildrenExclusionPolicy.d.ts +17 -0
  11. package/api/resources/charters/types/CharterChildrenExclusionPolicy.js +20 -0
  12. package/api/resources/charters/types/CharterStatus.d.ts +16 -0
  13. package/api/resources/charters/types/CharterStatus.js +19 -0
  14. package/api/resources/charters/types/CharterSummary.d.ts +28 -0
  15. package/api/resources/charters/types/CharterType.d.ts +25 -0
  16. package/api/resources/charters/types/CharterType.js +28 -0
  17. package/api/resources/charters/types/index.d.ts +4 -0
  18. package/api/resources/charters/types/index.js +20 -0
  19. package/api/resources/commons/types/ActionParameter.d.ts +2 -2
  20. package/api/resources/commons/types/BotObjectResponse.d.ts +2 -4
  21. package/api/resources/commons/types/FieldCondition.d.ts +45 -0
  22. package/api/resources/commons/types/FieldCondition.js +3 -0
  23. package/api/resources/commons/types/IntelligentFieldPrecondition.d.ts +1 -1
  24. package/api/resources/commons/types/IntelligentFieldPreconditionResponse.d.ts +1 -1
  25. package/api/resources/commons/types/KeyValueEntryCondition.d.ts +1 -1
  26. package/api/resources/commons/types/TextFormat.d.ts +13 -0
  27. package/api/resources/commons/types/TextFormat.js +3 -0
  28. package/api/resources/commons/types/TextFormatJsonSchema.d.ts +35 -0
  29. package/api/resources/commons/types/TextFormatJsonSchema.js +3 -0
  30. package/api/resources/commons/types/TextFormatText.d.ts +4 -0
  31. package/api/resources/commons/types/TextFormatText.js +3 -0
  32. package/api/resources/commons/types/UniversalCondition.d.ts +3 -3
  33. package/api/resources/commons/types/index.d.ts +4 -1
  34. package/api/resources/commons/types/index.js +4 -1
  35. package/api/resources/conversation/types/AskRequest.d.ts +59 -0
  36. package/api/resources/conversation/types/AskStreamObjectEvent.d.ts +7 -0
  37. package/api/resources/conversation/types/AskStreamObjectEvent.js +3 -0
  38. package/api/resources/conversation/types/ConversationField.d.ts +8 -0
  39. package/api/resources/conversation/types/ConversationField.js +8 -0
  40. package/api/resources/conversation/types/ConversationsSearchRequest.d.ts +5 -0
  41. package/api/resources/conversation/types/NumericConversationField.d.ts +4 -0
  42. package/api/resources/conversation/types/NumericConversationField.js +4 -0
  43. package/api/resources/conversation/types/StreamResponse.d.ts +4 -1
  44. package/api/resources/conversation/types/index.d.ts +1 -0
  45. package/api/resources/conversation/types/index.js +1 -0
  46. package/api/resources/index.d.ts +5 -0
  47. package/api/resources/index.js +6 -1
  48. package/api/resources/intelligentFields/client/Client.d.ts +156 -0
  49. package/api/resources/intelligentFields/client/Client.js +627 -0
  50. package/api/resources/intelligentFields/client/index.d.ts +1 -0
  51. package/api/resources/intelligentFields/client/index.js +17 -0
  52. package/api/resources/intelligentFields/client/requests/IntelligentFieldDeleteRequest.d.ts +12 -0
  53. package/api/resources/intelligentFields/client/requests/IntelligentFieldDeleteRequest.js +3 -0
  54. package/api/resources/intelligentFields/client/requests/IntelligentFieldGetRequest.d.ts +8 -0
  55. package/api/resources/intelligentFields/client/requests/IntelligentFieldGetRequest.js +3 -0
  56. package/api/resources/intelligentFields/client/requests/IntelligentFieldPatchRequest.d.ts +26 -0
  57. package/api/resources/intelligentFields/client/requests/IntelligentFieldPatchRequest.js +3 -0
  58. package/api/resources/intelligentFields/client/requests/index.d.ts +3 -0
  59. package/api/resources/intelligentFields/client/requests/index.js +2 -0
  60. package/api/resources/intelligentFields/exports.d.ts +2 -0
  61. package/api/resources/intelligentFields/exports.js +21 -0
  62. package/api/resources/intelligentFields/index.d.ts +2 -0
  63. package/api/resources/intelligentFields/index.js +18 -0
  64. package/api/resources/intelligentFields/types/EnumOption.d.ts +9 -0
  65. package/api/resources/intelligentFields/types/EnumOption.js +3 -0
  66. package/api/resources/intelligentFields/types/IntelligentFieldBase.d.ts +7 -0
  67. package/api/resources/intelligentFields/types/IntelligentFieldBase.js +3 -0
  68. package/api/resources/intelligentFields/types/IntelligentFieldCore.d.ts +28 -0
  69. package/api/resources/intelligentFields/types/IntelligentFieldCore.js +3 -0
  70. package/api/resources/intelligentFields/types/IntelligentFieldDetailResponse.d.ts +36 -0
  71. package/api/resources/intelligentFields/types/IntelligentFieldDetailResponse.js +3 -0
  72. package/api/resources/intelligentFields/types/IntelligentFieldRequest.d.ts +28 -0
  73. package/api/resources/intelligentFields/types/IntelligentFieldRequest.js +3 -0
  74. package/api/resources/intelligentFields/types/IntelligentFieldResponse.d.ts +41 -0
  75. package/api/resources/intelligentFields/types/IntelligentFieldResponse.js +3 -0
  76. package/api/resources/intelligentFields/types/IntelligentFieldStatus.d.ts +7 -0
  77. package/api/resources/intelligentFields/types/IntelligentFieldStatus.js +10 -0
  78. package/api/resources/intelligentFields/types/IntelligentFieldType.d.ts +9 -0
  79. package/api/resources/intelligentFields/types/IntelligentFieldType.js +12 -0
  80. package/api/resources/intelligentFields/types/IntelligentFieldValueEntityFilter.d.ts +8 -0
  81. package/api/resources/intelligentFields/types/IntelligentFieldValueEntityFilter.js +3 -0
  82. package/api/resources/intelligentFields/types/IntelligentFieldValueFieldFilter.d.ts +10 -0
  83. package/api/resources/intelligentFields/types/IntelligentFieldValueFieldFilter.js +3 -0
  84. package/api/resources/intelligentFields/types/IntelligentFieldValueSearchRequest.d.ts +17 -0
  85. package/api/resources/intelligentFields/types/IntelligentFieldValueSearchRequest.js +3 -0
  86. package/api/resources/intelligentFields/types/IntelligentFieldValueSearchResponse.d.ts +35 -0
  87. package/api/resources/intelligentFields/types/IntelligentFieldValueSearchResponse.js +3 -0
  88. package/api/resources/intelligentFields/types/IntelligentFieldValueSortField.d.ts +5 -0
  89. package/api/resources/intelligentFields/types/IntelligentFieldValueSortField.js +8 -0
  90. package/api/resources/intelligentFields/types/index.d.ts +13 -0
  91. package/api/resources/intelligentFields/types/index.js +29 -0
  92. package/api/resources/knowledge/client/Client.d.ts +33 -0
  93. package/api/resources/knowledge/client/Client.js +117 -0
  94. package/api/resources/knowledge/types/KnowledgeBaseResponse.d.ts +5 -0
  95. package/api/resources/knowledge/types/KnowledgeBaseVersion.d.ts +25 -0
  96. package/api/resources/knowledge/types/KnowledgeBaseVersionProgress.d.ts +29 -0
  97. package/api/resources/knowledge/types/KnowledgeBaseVersionProgress.js +3 -0
  98. package/api/resources/knowledge/types/KnowledgeBaseVersionProgressRequest.d.ts +24 -0
  99. package/api/resources/knowledge/types/KnowledgeBaseVersionProgressRequest.js +3 -0
  100. package/api/resources/knowledge/types/index.d.ts +2 -0
  101. package/api/resources/knowledge/types/index.js +2 -0
  102. package/api/resources/segments/client/Client.js +3 -1
  103. package/api/resources/segments/client/requests/SegmentDeleteRequest.d.ts +12 -0
  104. package/api/resources/segments/types/SegmentPatchRequest.d.ts +8 -0
  105. package/api/resources/segments/types/SegmentRequest.d.ts +8 -0
  106. package/api/resources/segments/types/SegmentSummary.d.ts +14 -0
  107. package/api/resources/segments/types/SegmentSummary.js +3 -0
  108. package/api/resources/segments/types/index.d.ts +1 -0
  109. package/api/resources/segments/types/index.js +1 -0
  110. package/package.json +1 -1
  111. package/reference.md +476 -0
  112. package/serialization/resources/analytics/types/ConversationBasicMetric.d.ts +2 -0
  113. package/serialization/resources/analytics/types/ConversationBasicMetric.js +2 -0
  114. package/serialization/resources/analytics/types/ConversationGroupBy.d.ts +2 -0
  115. package/serialization/resources/analytics/types/ConversationGroupBy.js +2 -0
  116. package/serialization/resources/analytics/types/ConversationNumericMetric.d.ts +2 -0
  117. package/serialization/resources/analytics/types/ConversationNumericMetric.js +2 -0
  118. package/serialization/resources/charters/index.d.ts +1 -0
  119. package/serialization/resources/charters/index.js +17 -0
  120. package/serialization/resources/charters/types/CharterChildrenExclusionPolicy.d.ts +7 -0
  121. package/serialization/resources/charters/types/CharterChildrenExclusionPolicy.js +39 -0
  122. package/serialization/resources/charters/types/CharterStatus.d.ts +7 -0
  123. package/serialization/resources/charters/types/CharterStatus.js +39 -0
  124. package/serialization/resources/charters/types/CharterSummary.d.ts +22 -0
  125. package/serialization/resources/charters/types/CharterSummary.js +54 -0
  126. package/serialization/resources/charters/types/CharterType.d.ts +7 -0
  127. package/serialization/resources/charters/types/CharterType.js +39 -0
  128. package/serialization/resources/charters/types/index.d.ts +4 -0
  129. package/serialization/resources/charters/types/index.js +20 -0
  130. package/serialization/resources/commons/types/BotObjectResponse.d.ts +0 -1
  131. package/serialization/resources/commons/types/BotObjectResponse.js +0 -1
  132. package/serialization/resources/commons/types/{IntelligentFieldCondition.d.ts → FieldCondition.d.ts} +3 -3
  133. package/serialization/resources/commons/types/{IntelligentFieldCondition.js → FieldCondition.js} +2 -2
  134. package/serialization/resources/commons/types/IntelligentFieldPrecondition.d.ts +2 -2
  135. package/serialization/resources/commons/types/IntelligentFieldPrecondition.js +2 -2
  136. package/serialization/resources/commons/types/IntelligentFieldPreconditionResponse.d.ts +2 -2
  137. package/serialization/resources/commons/types/IntelligentFieldPreconditionResponse.js +2 -2
  138. package/serialization/resources/commons/types/KeyValueEntryCondition.d.ts +2 -2
  139. package/serialization/resources/commons/types/KeyValueEntryCondition.js +2 -2
  140. package/serialization/resources/commons/types/TextFormat.d.ts +15 -0
  141. package/serialization/resources/commons/types/TextFormat.js +49 -0
  142. package/serialization/resources/commons/types/TextFormatJsonSchema.d.ts +10 -0
  143. package/serialization/resources/commons/types/TextFormatJsonSchema.js +42 -0
  144. package/serialization/resources/commons/types/TextFormatText.d.ts +7 -0
  145. package/serialization/resources/commons/types/TextFormatText.js +39 -0
  146. package/serialization/resources/commons/types/index.d.ts +4 -1
  147. package/serialization/resources/commons/types/index.js +4 -1
  148. package/serialization/resources/conversation/types/AskRequest.d.ts +2 -0
  149. package/serialization/resources/conversation/types/AskRequest.js +2 -0
  150. package/serialization/resources/conversation/types/AskStreamObjectEvent.d.ts +9 -0
  151. package/serialization/resources/conversation/types/AskStreamObjectEvent.js +40 -0
  152. package/serialization/resources/conversation/types/ConversationField.d.ts +1 -1
  153. package/serialization/resources/conversation/types/ConversationField.js +2 -0
  154. package/serialization/resources/conversation/types/NumericConversationField.d.ts +1 -1
  155. package/serialization/resources/conversation/types/NumericConversationField.js +1 -0
  156. package/serialization/resources/conversation/types/StreamResponse.d.ts +5 -1
  157. package/serialization/resources/conversation/types/StreamResponse.js +2 -0
  158. package/serialization/resources/conversation/types/index.d.ts +1 -0
  159. package/serialization/resources/conversation/types/index.js +1 -0
  160. package/serialization/resources/index.d.ts +5 -0
  161. package/serialization/resources/index.js +6 -1
  162. package/serialization/resources/intelligentFields/client/index.d.ts +1 -0
  163. package/serialization/resources/intelligentFields/client/index.js +17 -0
  164. package/serialization/resources/intelligentFields/client/requests/IntelligentFieldPatchRequest.d.ts +17 -0
  165. package/serialization/resources/intelligentFields/client/requests/IntelligentFieldPatchRequest.js +49 -0
  166. package/serialization/resources/intelligentFields/client/requests/index.d.ts +1 -0
  167. package/serialization/resources/intelligentFields/client/requests/index.js +5 -0
  168. package/serialization/resources/intelligentFields/index.d.ts +2 -0
  169. package/serialization/resources/intelligentFields/index.js +18 -0
  170. package/serialization/resources/intelligentFields/types/EnumOption.d.ts +10 -0
  171. package/serialization/resources/intelligentFields/types/EnumOption.js +42 -0
  172. package/serialization/resources/intelligentFields/types/IntelligentFieldBase.d.ts +13 -0
  173. package/serialization/resources/intelligentFields/types/IntelligentFieldBase.js +47 -0
  174. package/serialization/resources/intelligentFields/types/IntelligentFieldCore.d.ts +15 -0
  175. package/serialization/resources/intelligentFields/types/IntelligentFieldCore.js +47 -0
  176. package/serialization/resources/intelligentFields/types/IntelligentFieldDetailResponse.d.ts +11 -0
  177. package/serialization/resources/intelligentFields/types/IntelligentFieldDetailResponse.js +45 -0
  178. package/serialization/resources/intelligentFields/types/IntelligentFieldRequest.d.ts +11 -0
  179. package/serialization/resources/intelligentFields/types/IntelligentFieldRequest.js +45 -0
  180. package/serialization/resources/intelligentFields/types/IntelligentFieldResponse.d.ts +15 -0
  181. package/serialization/resources/intelligentFields/types/IntelligentFieldResponse.js +49 -0
  182. package/serialization/resources/intelligentFields/types/IntelligentFieldStatus.d.ts +7 -0
  183. package/serialization/resources/intelligentFields/types/IntelligentFieldStatus.js +39 -0
  184. package/serialization/resources/intelligentFields/types/IntelligentFieldType.d.ts +7 -0
  185. package/serialization/resources/intelligentFields/types/IntelligentFieldType.js +39 -0
  186. package/serialization/resources/intelligentFields/types/IntelligentFieldValueEntityFilter.d.ts +10 -0
  187. package/serialization/resources/intelligentFields/types/IntelligentFieldValueEntityFilter.js +42 -0
  188. package/serialization/resources/intelligentFields/types/IntelligentFieldValueFieldFilter.d.ts +12 -0
  189. package/serialization/resources/intelligentFields/types/IntelligentFieldValueFieldFilter.js +44 -0
  190. package/serialization/resources/intelligentFields/types/IntelligentFieldValueSearchRequest.d.ts +20 -0
  191. package/serialization/resources/intelligentFields/types/IntelligentFieldValueSearchRequest.js +54 -0
  192. package/serialization/resources/intelligentFields/types/IntelligentFieldValueSearchResponse.d.ts +11 -0
  193. package/serialization/resources/intelligentFields/types/IntelligentFieldValueSearchResponse.js +45 -0
  194. package/serialization/resources/intelligentFields/types/IntelligentFieldValueSortField.d.ts +7 -0
  195. package/serialization/resources/intelligentFields/types/IntelligentFieldValueSortField.js +39 -0
  196. package/serialization/resources/intelligentFields/types/index.d.ts +13 -0
  197. package/serialization/resources/intelligentFields/types/index.js +29 -0
  198. package/serialization/resources/knowledge/types/KnowledgeBaseResponse.d.ts +2 -0
  199. package/serialization/resources/knowledge/types/KnowledgeBaseResponse.js +2 -0
  200. package/serialization/resources/knowledge/types/KnowledgeBaseVersion.d.ts +2 -0
  201. package/serialization/resources/knowledge/types/KnowledgeBaseVersion.js +2 -0
  202. package/serialization/resources/knowledge/types/KnowledgeBaseVersionProgress.d.ts +11 -0
  203. package/serialization/resources/knowledge/types/KnowledgeBaseVersionProgress.js +43 -0
  204. package/serialization/resources/knowledge/types/KnowledgeBaseVersionProgressRequest.d.ts +13 -0
  205. package/serialization/resources/knowledge/types/KnowledgeBaseVersionProgressRequest.js +45 -0
  206. package/serialization/resources/knowledge/types/index.d.ts +2 -0
  207. package/serialization/resources/knowledge/types/index.js +2 -0
  208. package/serialization/resources/segments/types/SegmentPatchRequest.d.ts +2 -0
  209. package/serialization/resources/segments/types/SegmentPatchRequest.js +2 -0
  210. package/serialization/resources/segments/types/SegmentRequest.d.ts +2 -0
  211. package/serialization/resources/segments/types/SegmentRequest.js +2 -0
  212. package/serialization/resources/segments/types/SegmentSummary.d.ts +14 -0
  213. package/serialization/resources/segments/types/SegmentSummary.js +47 -0
  214. package/serialization/resources/segments/types/index.d.ts +1 -0
  215. package/serialization/resources/segments/types/index.js +1 -0
  216. package/version.d.ts +1 -1
  217. package/version.js +1 -1
  218. package/api/resources/commons/types/IntelligentFieldCondition.d.ts +0 -37
  219. /package/api/resources/{commons/types/IntelligentFieldCondition.js → charters/types/CharterSummary.js} +0 -0
@@ -0,0 +1,627 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.IntelligentFieldsClient = void 0;
47
+ const BaseClient_1 = require("../../../../BaseClient");
48
+ const core = __importStar(require("../../../../core"));
49
+ const headers_1 = require("../../../../core/headers");
50
+ const environments = __importStar(require("../../../../environments"));
51
+ const handleNonStatusCodeError_1 = require("../../../../errors/handleNonStatusCodeError");
52
+ const errors = __importStar(require("../../../../errors/index"));
53
+ const serializers = __importStar(require("../../../../serialization/index"));
54
+ const MavenAGI = __importStar(require("../../../index"));
55
+ class IntelligentFieldsClient {
56
+ constructor(options) {
57
+ this._options = (0, BaseClient_1.normalizeClientOptionsWithAuth)(options);
58
+ }
59
+ /**
60
+ * Create a new intelligent field. Intelligent fields are used to store custom LLM-generated values on entities like conversations or events.
61
+ *
62
+ * @param {MavenAGI.IntelligentFieldRequest} request
63
+ * @param {IntelligentFieldsClient.RequestOptions} requestOptions - Request-specific configuration.
64
+ *
65
+ * @throws {@link MavenAGI.NotFoundError}
66
+ * @throws {@link MavenAGI.BadRequestError}
67
+ * @throws {@link MavenAGI.PayloadTooLargeError}
68
+ * @throws {@link MavenAGI.TooManyRequestsError}
69
+ * @throws {@link MavenAGI.ServerError}
70
+ *
71
+ * @example
72
+ * await client.intelligentFields.createOrUpdate({
73
+ * fieldId: {
74
+ * referenceId: "ticket-priority"
75
+ * },
76
+ * name: "Ticket Priority",
77
+ * description: "The priority of the conversation based on urgency",
78
+ * entityType: "CONVERSATION",
79
+ * validationType: "STRING",
80
+ * enumOptions: [{
81
+ * value: "HIGH",
82
+ * label: "High Priority"
83
+ * }, {
84
+ * value: "MEDIUM",
85
+ * label: "Medium Priority"
86
+ * }, {
87
+ * value: "LOW",
88
+ * label: "Low Priority"
89
+ * }],
90
+ * definition: "The priority of the conversation based on the urgency and importance; draw from the content / messages in the conversation; must be one of HIGH, MEDIUM, or LOW."
91
+ * })
92
+ */
93
+ createOrUpdate(request, requestOptions) {
94
+ return core.HttpResponsePromise.fromPromise(this.__createOrUpdate(request, requestOptions));
95
+ }
96
+ __createOrUpdate(request, requestOptions) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
99
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
100
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
101
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
102
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
103
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
104
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
105
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, "/v1/intelligent-fields"),
106
+ method: "PUT",
107
+ headers: _headers,
108
+ contentType: "application/json",
109
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
110
+ requestType: "json",
111
+ body: serializers.IntelligentFieldRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
112
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
113
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
114
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
115
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
116
+ logging: this._options.logging,
117
+ });
118
+ if (_response.ok) {
119
+ return {
120
+ data: serializers.IntelligentFieldResponse.parseOrThrow(_response.body, {
121
+ unrecognizedObjectKeys: "passthrough",
122
+ allowUnrecognizedUnionMembers: true,
123
+ allowUnrecognizedEnumValues: true,
124
+ breadcrumbsPrefix: ["response"],
125
+ }),
126
+ rawResponse: _response.rawResponse,
127
+ };
128
+ }
129
+ if (_response.error.reason === "status-code") {
130
+ switch (_response.error.statusCode) {
131
+ case 404:
132
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
133
+ unrecognizedObjectKeys: "passthrough",
134
+ allowUnrecognizedUnionMembers: true,
135
+ allowUnrecognizedEnumValues: true,
136
+ breadcrumbsPrefix: ["response"],
137
+ }), _response.rawResponse);
138
+ case 400:
139
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
140
+ unrecognizedObjectKeys: "passthrough",
141
+ allowUnrecognizedUnionMembers: true,
142
+ allowUnrecognizedEnumValues: true,
143
+ breadcrumbsPrefix: ["response"],
144
+ }), _response.rawResponse);
145
+ case 413:
146
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
147
+ unrecognizedObjectKeys: "passthrough",
148
+ allowUnrecognizedUnionMembers: true,
149
+ allowUnrecognizedEnumValues: true,
150
+ breadcrumbsPrefix: ["response"],
151
+ }), _response.rawResponse);
152
+ case 429:
153
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
154
+ unrecognizedObjectKeys: "passthrough",
155
+ allowUnrecognizedUnionMembers: true,
156
+ allowUnrecognizedEnumValues: true,
157
+ breadcrumbsPrefix: ["response"],
158
+ }), _response.rawResponse);
159
+ case 500:
160
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
161
+ unrecognizedObjectKeys: "passthrough",
162
+ allowUnrecognizedUnionMembers: true,
163
+ allowUnrecognizedEnumValues: true,
164
+ breadcrumbsPrefix: ["response"],
165
+ }), _response.rawResponse);
166
+ default:
167
+ throw new errors.MavenAGIError({
168
+ statusCode: _response.error.statusCode,
169
+ body: _response.error.body,
170
+ rawResponse: _response.rawResponse,
171
+ });
172
+ }
173
+ }
174
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/v1/intelligent-fields");
175
+ });
176
+ }
177
+ /**
178
+ * Get an intelligent field by its supplied ID
179
+ *
180
+ * @param {string} fieldReferenceId - The reference ID of the intelligent field to get. All other entity ID fields are inferred from the request.
181
+ * @param {MavenAGI.IntelligentFieldGetRequest} request
182
+ * @param {IntelligentFieldsClient.RequestOptions} requestOptions - Request-specific configuration.
183
+ *
184
+ * @throws {@link MavenAGI.NotFoundError}
185
+ * @throws {@link MavenAGI.BadRequestError}
186
+ * @throws {@link MavenAGI.PayloadTooLargeError}
187
+ * @throws {@link MavenAGI.TooManyRequestsError}
188
+ * @throws {@link MavenAGI.ServerError}
189
+ *
190
+ * @example
191
+ * await client.intelligentFields.get("ticket-priority")
192
+ */
193
+ get(fieldReferenceId, request = {}, requestOptions) {
194
+ return core.HttpResponsePromise.fromPromise(this.__get(fieldReferenceId, request, requestOptions));
195
+ }
196
+ __get(fieldReferenceId_1) {
197
+ return __awaiter(this, arguments, void 0, function* (fieldReferenceId, request = {}, requestOptions) {
198
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
199
+ const { appId } = request;
200
+ const _queryParams = {
201
+ appId,
202
+ };
203
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
204
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
205
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
206
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
207
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
208
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
209
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, `/v1/intelligent-fields/${core.url.encodePathParam(fieldReferenceId)}`),
210
+ method: "GET",
211
+ headers: _headers,
212
+ queryString: core.url
213
+ .queryBuilder()
214
+ .addMany(_queryParams)
215
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
216
+ .build(),
217
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
218
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
219
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
220
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
221
+ logging: this._options.logging,
222
+ });
223
+ if (_response.ok) {
224
+ return {
225
+ data: serializers.IntelligentFieldDetailResponse.parseOrThrow(_response.body, {
226
+ unrecognizedObjectKeys: "passthrough",
227
+ allowUnrecognizedUnionMembers: true,
228
+ allowUnrecognizedEnumValues: true,
229
+ breadcrumbsPrefix: ["response"],
230
+ }),
231
+ rawResponse: _response.rawResponse,
232
+ };
233
+ }
234
+ if (_response.error.reason === "status-code") {
235
+ switch (_response.error.statusCode) {
236
+ case 404:
237
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
238
+ unrecognizedObjectKeys: "passthrough",
239
+ allowUnrecognizedUnionMembers: true,
240
+ allowUnrecognizedEnumValues: true,
241
+ breadcrumbsPrefix: ["response"],
242
+ }), _response.rawResponse);
243
+ case 400:
244
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
245
+ unrecognizedObjectKeys: "passthrough",
246
+ allowUnrecognizedUnionMembers: true,
247
+ allowUnrecognizedEnumValues: true,
248
+ breadcrumbsPrefix: ["response"],
249
+ }), _response.rawResponse);
250
+ case 413:
251
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
252
+ unrecognizedObjectKeys: "passthrough",
253
+ allowUnrecognizedUnionMembers: true,
254
+ allowUnrecognizedEnumValues: true,
255
+ breadcrumbsPrefix: ["response"],
256
+ }), _response.rawResponse);
257
+ case 429:
258
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
259
+ unrecognizedObjectKeys: "passthrough",
260
+ allowUnrecognizedUnionMembers: true,
261
+ allowUnrecognizedEnumValues: true,
262
+ breadcrumbsPrefix: ["response"],
263
+ }), _response.rawResponse);
264
+ case 500:
265
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
266
+ unrecognizedObjectKeys: "passthrough",
267
+ allowUnrecognizedUnionMembers: true,
268
+ allowUnrecognizedEnumValues: true,
269
+ breadcrumbsPrefix: ["response"],
270
+ }), _response.rawResponse);
271
+ default:
272
+ throw new errors.MavenAGIError({
273
+ statusCode: _response.error.statusCode,
274
+ body: _response.error.body,
275
+ rawResponse: _response.rawResponse,
276
+ });
277
+ }
278
+ }
279
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/intelligent-fields/{fieldReferenceId}");
280
+ });
281
+ }
282
+ /**
283
+ * Patch an intelligent field. Can be used to update the definition, status, or other mutable properties.
284
+ *
285
+ * @param {string} fieldReferenceId - The reference ID of the intelligent field to patch.
286
+ * @param {MavenAGI.IntelligentFieldPatchRequest} request
287
+ * @param {IntelligentFieldsClient.RequestOptions} requestOptions - Request-specific configuration.
288
+ *
289
+ * @throws {@link MavenAGI.NotFoundError}
290
+ * @throws {@link MavenAGI.BadRequestError}
291
+ * @throws {@link MavenAGI.PayloadTooLargeError}
292
+ * @throws {@link MavenAGI.TooManyRequestsError}
293
+ * @throws {@link MavenAGI.ServerError}
294
+ *
295
+ * @example
296
+ * await client.intelligentFields.patch("ticket-priority", {
297
+ * definition: "The priority of the conversation based on the urgency and importance; draw from the content / messages in the conversation; must be one of HIGH, MEDIUM, or LOW."
298
+ * })
299
+ *
300
+ * @example
301
+ * await client.intelligentFields.patch("ticket-priority", {
302
+ * status: "INACTIVE"
303
+ * })
304
+ */
305
+ patch(fieldReferenceId, request = {}, requestOptions) {
306
+ return core.HttpResponsePromise.fromPromise(this.__patch(fieldReferenceId, request, requestOptions));
307
+ }
308
+ __patch(fieldReferenceId_1) {
309
+ return __awaiter(this, arguments, void 0, function* (fieldReferenceId, request = {}, requestOptions) {
310
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
311
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
312
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
313
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
314
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
315
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
316
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
317
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, `/v1/intelligent-fields/${core.url.encodePathParam(fieldReferenceId)}`),
318
+ method: "PATCH",
319
+ headers: _headers,
320
+ contentType: "application/merge-patch+json",
321
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
322
+ requestType: "json",
323
+ body: serializers.IntelligentFieldPatchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
324
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
325
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
326
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
327
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
328
+ logging: this._options.logging,
329
+ });
330
+ if (_response.ok) {
331
+ return {
332
+ data: serializers.IntelligentFieldResponse.parseOrThrow(_response.body, {
333
+ unrecognizedObjectKeys: "passthrough",
334
+ allowUnrecognizedUnionMembers: true,
335
+ allowUnrecognizedEnumValues: true,
336
+ breadcrumbsPrefix: ["response"],
337
+ }),
338
+ rawResponse: _response.rawResponse,
339
+ };
340
+ }
341
+ if (_response.error.reason === "status-code") {
342
+ switch (_response.error.statusCode) {
343
+ case 404:
344
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
345
+ unrecognizedObjectKeys: "passthrough",
346
+ allowUnrecognizedUnionMembers: true,
347
+ allowUnrecognizedEnumValues: true,
348
+ breadcrumbsPrefix: ["response"],
349
+ }), _response.rawResponse);
350
+ case 400:
351
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
352
+ unrecognizedObjectKeys: "passthrough",
353
+ allowUnrecognizedUnionMembers: true,
354
+ allowUnrecognizedEnumValues: true,
355
+ breadcrumbsPrefix: ["response"],
356
+ }), _response.rawResponse);
357
+ case 413:
358
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
359
+ unrecognizedObjectKeys: "passthrough",
360
+ allowUnrecognizedUnionMembers: true,
361
+ allowUnrecognizedEnumValues: true,
362
+ breadcrumbsPrefix: ["response"],
363
+ }), _response.rawResponse);
364
+ case 429:
365
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
366
+ unrecognizedObjectKeys: "passthrough",
367
+ allowUnrecognizedUnionMembers: true,
368
+ allowUnrecognizedEnumValues: true,
369
+ breadcrumbsPrefix: ["response"],
370
+ }), _response.rawResponse);
371
+ case 500:
372
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
373
+ unrecognizedObjectKeys: "passthrough",
374
+ allowUnrecognizedUnionMembers: true,
375
+ allowUnrecognizedEnumValues: true,
376
+ breadcrumbsPrefix: ["response"],
377
+ }), _response.rawResponse);
378
+ default:
379
+ throw new errors.MavenAGIError({
380
+ statusCode: _response.error.statusCode,
381
+ body: _response.error.body,
382
+ rawResponse: _response.rawResponse,
383
+ });
384
+ }
385
+ }
386
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v1/intelligent-fields/{fieldReferenceId}");
387
+ });
388
+ }
389
+ /**
390
+ * Soft delete an intelligent field. Only INACTIVE fields can be deleted.
391
+ *
392
+ * Deleted fields are excluded from search results but can still be retrieved by ID.
393
+ * Creating a new field with the same referenceId as a deleted field will overwrite
394
+ * the deleted field and restore it to INACTIVE status.
395
+ *
396
+ * Deleted fields cannot be modified.
397
+ *
398
+ * @param {string} fieldReferenceId - The reference ID of the intelligent field to delete.
399
+ * @param {MavenAGI.IntelligentFieldDeleteRequest} request
400
+ * @param {IntelligentFieldsClient.RequestOptions} requestOptions - Request-specific configuration.
401
+ *
402
+ * @throws {@link MavenAGI.NotFoundError}
403
+ * @throws {@link MavenAGI.BadRequestError}
404
+ * @throws {@link MavenAGI.PayloadTooLargeError}
405
+ * @throws {@link MavenAGI.TooManyRequestsError}
406
+ * @throws {@link MavenAGI.ServerError}
407
+ *
408
+ * @example
409
+ * await client.intelligentFields.delete("ticket-priority")
410
+ */
411
+ delete(fieldReferenceId, request = {}, requestOptions) {
412
+ return core.HttpResponsePromise.fromPromise(this.__delete(fieldReferenceId, request, requestOptions));
413
+ }
414
+ __delete(fieldReferenceId_1) {
415
+ return __awaiter(this, arguments, void 0, function* (fieldReferenceId, request = {}, requestOptions) {
416
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
417
+ const { appId, variantReferenceId, variantAppId } = request;
418
+ const _queryParams = {
419
+ appId,
420
+ variantReferenceId,
421
+ variantAppId,
422
+ };
423
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
424
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
425
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
426
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
427
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
428
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
429
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, `/v1/intelligent-fields/${core.url.encodePathParam(fieldReferenceId)}`),
430
+ method: "DELETE",
431
+ headers: _headers,
432
+ queryString: core.url
433
+ .queryBuilder()
434
+ .addMany(_queryParams)
435
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
436
+ .build(),
437
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
438
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
439
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
440
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
441
+ logging: this._options.logging,
442
+ });
443
+ if (_response.ok) {
444
+ return {
445
+ data: serializers.IntelligentFieldResponse.parseOrThrow(_response.body, {
446
+ unrecognizedObjectKeys: "passthrough",
447
+ allowUnrecognizedUnionMembers: true,
448
+ allowUnrecognizedEnumValues: true,
449
+ breadcrumbsPrefix: ["response"],
450
+ }),
451
+ rawResponse: _response.rawResponse,
452
+ };
453
+ }
454
+ if (_response.error.reason === "status-code") {
455
+ switch (_response.error.statusCode) {
456
+ case 404:
457
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
458
+ unrecognizedObjectKeys: "passthrough",
459
+ allowUnrecognizedUnionMembers: true,
460
+ allowUnrecognizedEnumValues: true,
461
+ breadcrumbsPrefix: ["response"],
462
+ }), _response.rawResponse);
463
+ case 400:
464
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
465
+ unrecognizedObjectKeys: "passthrough",
466
+ allowUnrecognizedUnionMembers: true,
467
+ allowUnrecognizedEnumValues: true,
468
+ breadcrumbsPrefix: ["response"],
469
+ }), _response.rawResponse);
470
+ case 413:
471
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
472
+ unrecognizedObjectKeys: "passthrough",
473
+ allowUnrecognizedUnionMembers: true,
474
+ allowUnrecognizedEnumValues: true,
475
+ breadcrumbsPrefix: ["response"],
476
+ }), _response.rawResponse);
477
+ case 429:
478
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
479
+ unrecognizedObjectKeys: "passthrough",
480
+ allowUnrecognizedUnionMembers: true,
481
+ allowUnrecognizedEnumValues: true,
482
+ breadcrumbsPrefix: ["response"],
483
+ }), _response.rawResponse);
484
+ case 500:
485
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
486
+ unrecognizedObjectKeys: "passthrough",
487
+ allowUnrecognizedUnionMembers: true,
488
+ allowUnrecognizedEnumValues: true,
489
+ breadcrumbsPrefix: ["response"],
490
+ }), _response.rawResponse);
491
+ default:
492
+ throw new errors.MavenAGIError({
493
+ statusCode: _response.error.statusCode,
494
+ body: _response.error.body,
495
+ rawResponse: _response.rawResponse,
496
+ });
497
+ }
498
+ }
499
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/intelligent-fields/{fieldReferenceId}");
500
+ });
501
+ }
502
+ /**
503
+ * Search computed values for intelligent fields across entities. Supports filtering by field properties and target entity.
504
+ *
505
+ * @param {MavenAGI.IntelligentFieldValueSearchRequest} request
506
+ * @param {IntelligentFieldsClient.RequestOptions} requestOptions - Request-specific configuration.
507
+ *
508
+ * @throws {@link MavenAGI.NotFoundError}
509
+ * @throws {@link MavenAGI.BadRequestError}
510
+ * @throws {@link MavenAGI.PayloadTooLargeError}
511
+ * @throws {@link MavenAGI.TooManyRequestsError}
512
+ * @throws {@link MavenAGI.ServerError}
513
+ *
514
+ * @example
515
+ * await client.intelligentFields.searchValues({
516
+ * fieldFilter: {
517
+ * fieldIds: [{
518
+ * referenceId: "ticket-priority",
519
+ * appId: "zendesk",
520
+ * type: "INTELLIGENT_FIELD",
521
+ * organizationId: "acme",
522
+ * agentId: "support"
523
+ * }]
524
+ * },
525
+ * entityFilter: {
526
+ * entityIds: [{
527
+ * referenceId: "conv-123",
528
+ * appId: "zendesk",
529
+ * type: "CONVERSATION",
530
+ * organizationId: "acme",
531
+ * agentId: "support"
532
+ * }]
533
+ * },
534
+ * page: 0,
535
+ * size: 20,
536
+ * sort: "CREATED_AT",
537
+ * sortDesc: true
538
+ * })
539
+ */
540
+ searchValues(request, requestOptions) {
541
+ return core.HttpResponsePromise.fromPromise(this.__searchValues(request, requestOptions));
542
+ }
543
+ __searchValues(request, requestOptions) {
544
+ return __awaiter(this, void 0, void 0, function* () {
545
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
546
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
547
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
548
+ "X-Organization-Id": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationId) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationId,
549
+ "X-Agent-Id": (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.agentId) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.agentId,
550
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
551
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
552
+ url: core.url.join((_h = (_g = (yield core.Supplier.get(this._options.baseUrl))) !== null && _g !== void 0 ? _g : (yield core.Supplier.get(this._options.environment))) !== null && _h !== void 0 ? _h : environments.MavenAGIEnvironment.Production, "/v1/intelligent-fields/values/search"),
553
+ method: "POST",
554
+ headers: _headers,
555
+ contentType: "application/json",
556
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
557
+ requestType: "json",
558
+ body: serializers.IntelligentFieldValueSearchRequest.jsonOrThrow(request, {
559
+ unrecognizedObjectKeys: "strip",
560
+ }),
561
+ timeoutMs: ((_l = (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.timeoutInSeconds) !== null && _l !== void 0 ? _l : 60) * 1000,
562
+ maxRetries: (_m = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _m !== void 0 ? _m : (_o = this._options) === null || _o === void 0 ? void 0 : _o.maxRetries,
563
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
564
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
565
+ logging: this._options.logging,
566
+ });
567
+ if (_response.ok) {
568
+ return {
569
+ data: serializers.IntelligentFieldValueSearchResponse.parseOrThrow(_response.body, {
570
+ unrecognizedObjectKeys: "passthrough",
571
+ allowUnrecognizedUnionMembers: true,
572
+ allowUnrecognizedEnumValues: true,
573
+ breadcrumbsPrefix: ["response"],
574
+ }),
575
+ rawResponse: _response.rawResponse,
576
+ };
577
+ }
578
+ if (_response.error.reason === "status-code") {
579
+ switch (_response.error.statusCode) {
580
+ case 404:
581
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
582
+ unrecognizedObjectKeys: "passthrough",
583
+ allowUnrecognizedUnionMembers: true,
584
+ allowUnrecognizedEnumValues: true,
585
+ breadcrumbsPrefix: ["response"],
586
+ }), _response.rawResponse);
587
+ case 400:
588
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
589
+ unrecognizedObjectKeys: "passthrough",
590
+ allowUnrecognizedUnionMembers: true,
591
+ allowUnrecognizedEnumValues: true,
592
+ breadcrumbsPrefix: ["response"],
593
+ }), _response.rawResponse);
594
+ case 413:
595
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
596
+ unrecognizedObjectKeys: "passthrough",
597
+ allowUnrecognizedUnionMembers: true,
598
+ allowUnrecognizedEnumValues: true,
599
+ breadcrumbsPrefix: ["response"],
600
+ }), _response.rawResponse);
601
+ case 429:
602
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
603
+ unrecognizedObjectKeys: "passthrough",
604
+ allowUnrecognizedUnionMembers: true,
605
+ allowUnrecognizedEnumValues: true,
606
+ breadcrumbsPrefix: ["response"],
607
+ }), _response.rawResponse);
608
+ case 500:
609
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
610
+ unrecognizedObjectKeys: "passthrough",
611
+ allowUnrecognizedUnionMembers: true,
612
+ allowUnrecognizedEnumValues: true,
613
+ breadcrumbsPrefix: ["response"],
614
+ }), _response.rawResponse);
615
+ default:
616
+ throw new errors.MavenAGIError({
617
+ statusCode: _response.error.statusCode,
618
+ body: _response.error.body,
619
+ rawResponse: _response.rawResponse,
620
+ });
621
+ }
622
+ }
623
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/intelligent-fields/values/search");
624
+ });
625
+ }
626
+ }
627
+ exports.IntelligentFieldsClient = IntelligentFieldsClient;
@@ -0,0 +1 @@
1
+ export * from "./requests";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests"), exports);