mavenagi 1.2.58 → 1.2.60

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 (203) hide show
  1. package/BaseClient.js +2 -2
  2. package/Client.d.ts +3 -0
  3. package/Client.js +37 -32
  4. package/api/resources/actions/client/requests/ActionPatchRequest.d.ts +7 -3
  5. package/api/resources/agents/client/requests/AgentPatchRequest.d.ts +7 -3
  6. package/api/resources/agents/types/AgentPrompting.d.ts +7 -3
  7. package/api/resources/analytics/client/Client.d.ts +7 -1
  8. package/api/resources/analytics/client/Client.js +7 -1
  9. package/api/resources/analytics/types/AgentUserRow.d.ts +5 -2
  10. package/api/resources/analytics/types/AgentUserRowIdentifier.d.ts +5 -0
  11. package/api/resources/analytics/types/AgentUserRowIdentifier.js +3 -0
  12. package/api/resources/analytics/types/AgentUserTableResponse.d.ts +7 -0
  13. package/api/resources/analytics/types/ConversationRow.d.ts +5 -2
  14. package/api/resources/analytics/types/ConversationRowIdentifier.d.ts +7 -0
  15. package/api/resources/analytics/types/ConversationRowIdentifier.js +3 -0
  16. package/api/resources/analytics/types/ConversationTableRequest.d.ts +0 -6
  17. package/api/resources/analytics/types/ConversationTableResponse.d.ts +56 -0
  18. package/api/resources/analytics/types/EventRow.d.ts +5 -2
  19. package/api/resources/analytics/types/EventRowIdentifier.d.ts +5 -0
  20. package/api/resources/analytics/types/EventRowIdentifier.js +3 -0
  21. package/api/resources/analytics/types/EventTableResponse.d.ts +14 -0
  22. package/api/resources/analytics/types/FeedbackRow.d.ts +5 -2
  23. package/api/resources/analytics/types/FeedbackRowIdentifier.d.ts +5 -0
  24. package/api/resources/analytics/types/FeedbackRowIdentifier.js +3 -0
  25. package/api/resources/analytics/types/FeedbackTableResponse.d.ts +14 -0
  26. package/api/resources/analytics/types/RowIdentifierBase.d.ts +5 -0
  27. package/api/resources/analytics/types/RowIdentifierBase.js +3 -0
  28. package/api/resources/analytics/types/index.d.ts +5 -0
  29. package/api/resources/analytics/types/index.js +5 -0
  30. package/api/resources/appDirectory/client/Client.d.ts +126 -0
  31. package/api/resources/appDirectory/client/Client.js +640 -0
  32. package/api/resources/appDirectory/client/index.d.ts +1 -0
  33. package/api/resources/appDirectory/client/index.js +17 -0
  34. package/api/resources/appDirectory/client/requests/GetAppSettingUploadUrlRequest.d.ts +11 -0
  35. package/api/resources/appDirectory/client/requests/GetAppSettingUploadUrlRequest.js +3 -0
  36. package/api/resources/appDirectory/client/requests/index.d.ts +1 -0
  37. package/api/resources/appDirectory/client/requests/index.js +2 -0
  38. package/api/resources/appDirectory/exports.d.ts +2 -0
  39. package/api/resources/appDirectory/exports.js +21 -0
  40. package/api/resources/appDirectory/index.d.ts +2 -0
  41. package/api/resources/appDirectory/index.js +18 -0
  42. package/api/resources/appDirectory/types/DirectoryAppSortField.d.ts +19 -0
  43. package/api/resources/appDirectory/types/DirectoryAppSortField.js +22 -0
  44. package/api/resources/appDirectory/types/DirectoryAppsSearchRequest.d.ts +7 -0
  45. package/api/resources/appDirectory/types/DirectoryAppsSearchRequest.js +3 -0
  46. package/api/resources/appDirectory/types/GetDirectoryAppSettingDownloadUrlResponse.d.ts +3 -0
  47. package/api/resources/appDirectory/types/GetDirectoryAppSettingDownloadUrlResponse.js +3 -0
  48. package/api/resources/appDirectory/types/GetDirectoryAppSettingUploadUrlResponse.d.ts +4 -0
  49. package/api/resources/appDirectory/types/GetDirectoryAppSettingUploadUrlResponse.js +3 -0
  50. package/api/resources/appDirectory/types/InstallDirectoryAppRequest.d.ts +44 -0
  51. package/api/resources/appDirectory/types/InstallDirectoryAppRequest.js +3 -0
  52. package/api/resources/appDirectory/types/index.d.ts +5 -0
  53. package/api/resources/appDirectory/types/index.js +21 -0
  54. package/api/resources/charters/types/CharterSummary.d.ts +7 -2
  55. package/api/resources/commons/types/ActionProperties.d.ts +12 -1
  56. package/api/resources/commons/types/ActionResponse.d.ts +3 -3
  57. package/api/resources/commons/types/BotLogicActionExecutedDetail.d.ts +10 -0
  58. package/api/resources/commons/types/BotLogicUserItem.d.ts +2 -0
  59. package/api/resources/commons/types/EventFilter.d.ts +5 -0
  60. package/api/resources/commons/types/EventTriggerType.d.ts +2 -0
  61. package/api/resources/commons/types/EventTriggerType.js +2 -0
  62. package/api/resources/commons/types/KnowledgeContextByEntities.d.ts +11 -0
  63. package/api/resources/commons/types/KnowledgeContextByEntityTypes.d.ts +3 -0
  64. package/api/resources/commons/types/KnowledgeContextFilter.d.ts +6 -1
  65. package/api/resources/commons/types/LlmPersona.d.ts +1 -0
  66. package/api/resources/commons/types/LlmPersona.js +1 -0
  67. package/api/resources/commons/types/NovelUserEvent.d.ts +4 -1
  68. package/api/resources/commons/types/ResponseConfig.d.ts +9 -3
  69. package/api/resources/commons/types/SideEffects.d.ts +10 -0
  70. package/api/resources/commons/types/SideEffects.js +13 -0
  71. package/api/resources/commons/types/SimulationContext.d.ts +3 -3
  72. package/api/resources/commons/types/SystemEventName.d.ts +24 -0
  73. package/api/resources/commons/types/SystemEventName.js +24 -0
  74. package/api/resources/commons/types/UserEvent.d.ts +4 -1
  75. package/api/resources/commons/types/UserEventName.d.ts +84 -0
  76. package/api/resources/commons/types/UserEventName.js +84 -0
  77. package/api/resources/commons/types/UserMessage.d.ts +7 -0
  78. package/api/resources/commons/types/index.d.ts +1 -0
  79. package/api/resources/commons/types/index.js +1 -0
  80. package/api/resources/conversation/client/Client.d.ts +3 -1
  81. package/api/resources/conversation/client/Client.js +3 -1
  82. package/api/resources/conversation/types/ConversationFilter.d.ts +9 -3
  83. package/api/resources/developersCommons/exports.d.ts +1 -0
  84. package/api/resources/developersCommons/exports.js +18 -0
  85. package/api/resources/developersCommons/types/AppInstalled.d.ts +5 -0
  86. package/api/resources/developersCommons/types/AppInstalled.js +8 -0
  87. package/api/resources/developersCommons/types/AppsFilter.d.ts +27 -0
  88. package/api/resources/developersCommons/types/AppsFilter.js +3 -0
  89. package/api/resources/developersCommons/types/AppsResponse.d.ts +15 -0
  90. package/api/resources/developersCommons/types/AppsResponse.js +3 -0
  91. package/api/resources/developersCommons/types/BaseApp.d.ts +32 -0
  92. package/api/resources/developersCommons/types/BaseApp.js +3 -0
  93. package/api/resources/developersCommons/types/BaseDetailApp.d.ts +19 -0
  94. package/api/resources/developersCommons/types/BaseDetailApp.js +3 -0
  95. package/api/resources/developersCommons/types/CountByFilterResult.d.ts +11 -0
  96. package/api/resources/developersCommons/types/CountByFilterResult.js +3 -0
  97. package/api/resources/developersCommons/types/DeveloperOrganization.d.ts +15 -0
  98. package/api/resources/developersCommons/types/DeveloperOrganization.js +3 -0
  99. package/api/resources/developersCommons/types/Link.d.ts +6 -0
  100. package/api/resources/developersCommons/types/MarketplaceApp.d.ts +8 -0
  101. package/api/resources/developersCommons/types/MarketplaceApp.js +3 -0
  102. package/api/resources/developersCommons/types/MarketplaceAppDetail.d.ts +35 -0
  103. package/api/resources/developersCommons/types/MarketplaceAppDetail.js +3 -0
  104. package/api/resources/developersCommons/types/index.d.ts +9 -0
  105. package/api/resources/developersCommons/types/index.js +9 -0
  106. package/api/resources/index.d.ts +3 -0
  107. package/api/resources/index.js +4 -1
  108. package/api/resources/knowledge/client/requests/KnowledgeBasePatchRequest.d.ts +18 -10
  109. package/api/resources/knowledge/types/KnowledgeBaseFilter.d.ts +6 -1
  110. package/api/resources/knowledge/types/KnowledgeBaseProperties.d.ts +5 -1
  111. package/api/resources/knowledge/types/KnowledgeBaseResponse.d.ts +10 -6
  112. package/api/resources/knowledge/types/KnowledgeDocumentRequest.d.ts +14 -1
  113. package/api/resources/segments/client/Client.d.ts +10 -0
  114. package/api/resources/segments/client/Client.js +10 -0
  115. package/api/resources/triggers/types/EventTriggerBase.d.ts +3 -1
  116. package/package.json +1 -1
  117. package/reference.md +426 -2
  118. package/serialization/resources/actions/client/requests/ActionPatchRequest.d.ts +2 -0
  119. package/serialization/resources/actions/client/requests/ActionPatchRequest.js +2 -0
  120. package/serialization/resources/analytics/types/AgentUserRow.d.ts +2 -0
  121. package/serialization/resources/analytics/types/AgentUserRow.js +2 -0
  122. package/serialization/resources/analytics/types/AgentUserRowIdentifier.d.ts +11 -0
  123. package/serialization/resources/analytics/types/AgentUserRowIdentifier.js +45 -0
  124. package/serialization/resources/analytics/types/ConversationRow.d.ts +2 -0
  125. package/serialization/resources/analytics/types/ConversationRow.js +2 -0
  126. package/serialization/resources/analytics/types/ConversationRowIdentifier.d.ts +13 -0
  127. package/serialization/resources/analytics/types/ConversationRowIdentifier.js +47 -0
  128. package/serialization/resources/analytics/types/EventRow.d.ts +2 -0
  129. package/serialization/resources/analytics/types/EventRow.js +2 -0
  130. package/serialization/resources/analytics/types/EventRowIdentifier.d.ts +11 -0
  131. package/serialization/resources/analytics/types/EventRowIdentifier.js +45 -0
  132. package/serialization/resources/analytics/types/FeedbackRow.d.ts +2 -0
  133. package/serialization/resources/analytics/types/FeedbackRow.js +2 -0
  134. package/serialization/resources/analytics/types/FeedbackRowIdentifier.d.ts +11 -0
  135. package/serialization/resources/analytics/types/FeedbackRowIdentifier.js +45 -0
  136. package/serialization/resources/analytics/types/RowIdentifierBase.d.ts +10 -0
  137. package/serialization/resources/analytics/types/RowIdentifierBase.js +42 -0
  138. package/serialization/resources/analytics/types/index.d.ts +5 -0
  139. package/serialization/resources/analytics/types/index.js +5 -0
  140. package/serialization/resources/appDirectory/client/index.d.ts +1 -0
  141. package/serialization/resources/appDirectory/client/index.js +17 -0
  142. package/serialization/resources/appDirectory/client/requests/GetAppSettingUploadUrlRequest.d.ts +10 -0
  143. package/serialization/resources/appDirectory/client/requests/GetAppSettingUploadUrlRequest.js +42 -0
  144. package/serialization/resources/appDirectory/client/requests/index.d.ts +1 -0
  145. package/serialization/resources/appDirectory/client/requests/index.js +5 -0
  146. package/serialization/resources/appDirectory/index.d.ts +2 -0
  147. package/serialization/resources/appDirectory/index.js +18 -0
  148. package/serialization/resources/appDirectory/types/DirectoryAppSortField.d.ts +7 -0
  149. package/serialization/resources/appDirectory/types/DirectoryAppSortField.js +39 -0
  150. package/serialization/resources/appDirectory/types/DirectoryAppsSearchRequest.d.ts +13 -0
  151. package/serialization/resources/appDirectory/types/DirectoryAppsSearchRequest.js +47 -0
  152. package/serialization/resources/appDirectory/types/GetDirectoryAppSettingDownloadUrlResponse.d.ts +9 -0
  153. package/serialization/resources/appDirectory/types/GetDirectoryAppSettingDownloadUrlResponse.js +41 -0
  154. package/serialization/resources/appDirectory/types/GetDirectoryAppSettingUploadUrlResponse.d.ts +10 -0
  155. package/serialization/resources/appDirectory/types/GetDirectoryAppSettingUploadUrlResponse.js +42 -0
  156. package/serialization/resources/appDirectory/types/InstallDirectoryAppRequest.d.ts +9 -0
  157. package/serialization/resources/appDirectory/types/InstallDirectoryAppRequest.js +41 -0
  158. package/serialization/resources/appDirectory/types/index.d.ts +5 -0
  159. package/serialization/resources/appDirectory/types/index.js +21 -0
  160. package/serialization/resources/charters/types/CharterSummary.d.ts +2 -1
  161. package/serialization/resources/charters/types/CharterSummary.js +2 -0
  162. package/serialization/resources/commons/types/ActionProperties.d.ts +2 -0
  163. package/serialization/resources/commons/types/ActionProperties.js +2 -0
  164. package/serialization/resources/commons/types/BotLogicActionExecutedDetail.d.ts +3 -0
  165. package/serialization/resources/commons/types/BotLogicActionExecutedDetail.js +3 -0
  166. package/serialization/resources/commons/types/BotLogicUserItem.d.ts +1 -0
  167. package/serialization/resources/commons/types/BotLogicUserItem.js +1 -0
  168. package/serialization/resources/commons/types/SideEffects.d.ts +7 -0
  169. package/serialization/resources/commons/types/SideEffects.js +39 -0
  170. package/serialization/resources/commons/types/SystemEventName.d.ts +1 -1
  171. package/serialization/resources/commons/types/SystemEventName.js +13 -1
  172. package/serialization/resources/commons/types/UserEventName.d.ts +1 -1
  173. package/serialization/resources/commons/types/UserEventName.js +28 -0
  174. package/serialization/resources/commons/types/UserMessage.d.ts +1 -0
  175. package/serialization/resources/commons/types/UserMessage.js +1 -0
  176. package/serialization/resources/commons/types/index.d.ts +1 -0
  177. package/serialization/resources/commons/types/index.js +1 -0
  178. package/serialization/resources/conversation/types/ConversationFilter.d.ts +2 -0
  179. package/serialization/resources/conversation/types/ConversationFilter.js +2 -0
  180. package/serialization/resources/developersCommons/types/AppInstalled.d.ts +7 -0
  181. package/serialization/resources/developersCommons/types/AppInstalled.js +39 -0
  182. package/serialization/resources/developersCommons/types/AppsFilter.d.ts +18 -0
  183. package/serialization/resources/developersCommons/types/AppsFilter.js +50 -0
  184. package/serialization/resources/developersCommons/types/AppsResponse.d.ts +14 -0
  185. package/serialization/resources/developersCommons/types/AppsResponse.js +48 -0
  186. package/serialization/resources/developersCommons/types/BaseApp.d.ts +23 -0
  187. package/serialization/resources/developersCommons/types/BaseApp.js +55 -0
  188. package/serialization/resources/developersCommons/types/BaseDetailApp.d.ts +15 -0
  189. package/serialization/resources/developersCommons/types/BaseDetailApp.js +50 -0
  190. package/serialization/resources/developersCommons/types/CountByFilterResult.d.ts +12 -0
  191. package/serialization/resources/developersCommons/types/CountByFilterResult.js +44 -0
  192. package/serialization/resources/developersCommons/types/DeveloperOrganization.d.ts +13 -0
  193. package/serialization/resources/developersCommons/types/DeveloperOrganization.js +45 -0
  194. package/serialization/resources/developersCommons/types/MarketplaceApp.d.ts +11 -0
  195. package/serialization/resources/developersCommons/types/MarketplaceApp.js +45 -0
  196. package/serialization/resources/developersCommons/types/MarketplaceAppDetail.d.ts +12 -0
  197. package/serialization/resources/developersCommons/types/MarketplaceAppDetail.js +46 -0
  198. package/serialization/resources/developersCommons/types/index.d.ts +9 -0
  199. package/serialization/resources/developersCommons/types/index.js +9 -0
  200. package/serialization/resources/index.d.ts +3 -0
  201. package/serialization/resources/index.js +4 -1
  202. package/version.d.ts +1 -1
  203. package/version.js +1 -1
@@ -0,0 +1,640 @@
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.AppDirectoryClient = 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 AppDirectoryClient {
56
+ constructor(options) {
57
+ this._options = (0, BaseClient_1.normalizeClientOptionsWithAuth)(options);
58
+ }
59
+ /**
60
+ * Lists apps available to install on the agent, with filtering and pagination.
61
+ *
62
+ * @param {MavenAGI.DirectoryAppsSearchRequest} request
63
+ * @param {AppDirectoryClient.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.appDirectory.search({})
73
+ */
74
+ search(request, requestOptions) {
75
+ return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions));
76
+ }
77
+ __search(request, requestOptions) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
80
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
81
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
82
+ "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,
83
+ "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,
84
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
85
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
86
+ 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/directory/search"),
87
+ method: "POST",
88
+ headers: _headers,
89
+ contentType: "application/json",
90
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
91
+ requestType: "json",
92
+ body: serializers.DirectoryAppsSearchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
93
+ 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,
94
+ 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,
95
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
96
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
97
+ logging: this._options.logging,
98
+ });
99
+ if (_response.ok) {
100
+ return {
101
+ data: serializers.AppsResponse.parseOrThrow(_response.body, {
102
+ unrecognizedObjectKeys: "passthrough",
103
+ allowUnrecognizedUnionMembers: true,
104
+ allowUnrecognizedEnumValues: true,
105
+ breadcrumbsPrefix: ["response"],
106
+ }),
107
+ rawResponse: _response.rawResponse,
108
+ };
109
+ }
110
+ if (_response.error.reason === "status-code") {
111
+ switch (_response.error.statusCode) {
112
+ case 404:
113
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
114
+ unrecognizedObjectKeys: "passthrough",
115
+ allowUnrecognizedUnionMembers: true,
116
+ allowUnrecognizedEnumValues: true,
117
+ breadcrumbsPrefix: ["response"],
118
+ }), _response.rawResponse);
119
+ case 400:
120
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
121
+ unrecognizedObjectKeys: "passthrough",
122
+ allowUnrecognizedUnionMembers: true,
123
+ allowUnrecognizedEnumValues: true,
124
+ breadcrumbsPrefix: ["response"],
125
+ }), _response.rawResponse);
126
+ case 413:
127
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
128
+ unrecognizedObjectKeys: "passthrough",
129
+ allowUnrecognizedUnionMembers: true,
130
+ allowUnrecognizedEnumValues: true,
131
+ breadcrumbsPrefix: ["response"],
132
+ }), _response.rawResponse);
133
+ case 429:
134
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
135
+ unrecognizedObjectKeys: "passthrough",
136
+ allowUnrecognizedUnionMembers: true,
137
+ allowUnrecognizedEnumValues: true,
138
+ breadcrumbsPrefix: ["response"],
139
+ }), _response.rawResponse);
140
+ case 500:
141
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
142
+ unrecognizedObjectKeys: "passthrough",
143
+ allowUnrecognizedUnionMembers: true,
144
+ allowUnrecognizedEnumValues: true,
145
+ breadcrumbsPrefix: ["response"],
146
+ }), _response.rawResponse);
147
+ default:
148
+ throw new errors.MavenAGIError({
149
+ statusCode: _response.error.statusCode,
150
+ body: _response.error.body,
151
+ rawResponse: _response.rawResponse,
152
+ });
153
+ }
154
+ }
155
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/directory/search");
156
+ });
157
+ }
158
+ /**
159
+ * Gets an app and its installation status for the agent.
160
+ *
161
+ * @param {string} appId
162
+ * @param {AppDirectoryClient.RequestOptions} requestOptions - Request-specific configuration.
163
+ *
164
+ * @throws {@link MavenAGI.NotFoundError}
165
+ * @throws {@link MavenAGI.BadRequestError}
166
+ * @throws {@link MavenAGI.PayloadTooLargeError}
167
+ * @throws {@link MavenAGI.TooManyRequestsError}
168
+ * @throws {@link MavenAGI.ServerError}
169
+ *
170
+ * @example
171
+ * await client.appDirectory.get("appId")
172
+ */
173
+ get(appId, requestOptions) {
174
+ return core.HttpResponsePromise.fromPromise(this.__get(appId, requestOptions));
175
+ }
176
+ __get(appId, requestOptions) {
177
+ return __awaiter(this, void 0, void 0, function* () {
178
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
179
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
180
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
181
+ "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,
182
+ "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,
183
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
184
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
185
+ 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/directory/${core.url.encodePathParam(appId)}`),
186
+ method: "GET",
187
+ headers: _headers,
188
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
189
+ 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,
190
+ 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,
191
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
192
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
193
+ logging: this._options.logging,
194
+ });
195
+ if (_response.ok) {
196
+ return {
197
+ data: serializers.MarketplaceAppDetail.parseOrThrow(_response.body, {
198
+ unrecognizedObjectKeys: "passthrough",
199
+ allowUnrecognizedUnionMembers: true,
200
+ allowUnrecognizedEnumValues: true,
201
+ breadcrumbsPrefix: ["response"],
202
+ }),
203
+ rawResponse: _response.rawResponse,
204
+ };
205
+ }
206
+ if (_response.error.reason === "status-code") {
207
+ switch (_response.error.statusCode) {
208
+ case 404:
209
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
210
+ unrecognizedObjectKeys: "passthrough",
211
+ allowUnrecognizedUnionMembers: true,
212
+ allowUnrecognizedEnumValues: true,
213
+ breadcrumbsPrefix: ["response"],
214
+ }), _response.rawResponse);
215
+ case 400:
216
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
217
+ unrecognizedObjectKeys: "passthrough",
218
+ allowUnrecognizedUnionMembers: true,
219
+ allowUnrecognizedEnumValues: true,
220
+ breadcrumbsPrefix: ["response"],
221
+ }), _response.rawResponse);
222
+ case 413:
223
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
224
+ unrecognizedObjectKeys: "passthrough",
225
+ allowUnrecognizedUnionMembers: true,
226
+ allowUnrecognizedEnumValues: true,
227
+ breadcrumbsPrefix: ["response"],
228
+ }), _response.rawResponse);
229
+ case 429:
230
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
231
+ unrecognizedObjectKeys: "passthrough",
232
+ allowUnrecognizedUnionMembers: true,
233
+ allowUnrecognizedEnumValues: true,
234
+ breadcrumbsPrefix: ["response"],
235
+ }), _response.rawResponse);
236
+ case 500:
237
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
238
+ unrecognizedObjectKeys: "passthrough",
239
+ allowUnrecognizedUnionMembers: true,
240
+ allowUnrecognizedEnumValues: true,
241
+ breadcrumbsPrefix: ["response"],
242
+ }), _response.rawResponse);
243
+ default:
244
+ throw new errors.MavenAGIError({
245
+ statusCode: _response.error.statusCode,
246
+ body: _response.error.body,
247
+ rawResponse: _response.rawResponse,
248
+ });
249
+ }
250
+ }
251
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/directory/{appId}");
252
+ });
253
+ }
254
+ /**
255
+ * Installs the app on the agent, or updates settings for an existing installation. Re-runs the postInstall lifecycle hook on each call.
256
+ *
257
+ * @param {string} appId
258
+ * @param {MavenAGI.InstallDirectoryAppRequest} request
259
+ * @param {AppDirectoryClient.RequestOptions} requestOptions - Request-specific configuration.
260
+ *
261
+ * @throws {@link MavenAGI.NotFoundError}
262
+ * @throws {@link MavenAGI.BadRequestError}
263
+ * @throws {@link MavenAGI.PayloadTooLargeError}
264
+ * @throws {@link MavenAGI.TooManyRequestsError}
265
+ * @throws {@link MavenAGI.ServerError}
266
+ *
267
+ * @example
268
+ * await client.appDirectory.install("appId", {
269
+ * settings: {
270
+ * "key": "value"
271
+ * }
272
+ * })
273
+ */
274
+ install(appId, request, requestOptions) {
275
+ return core.HttpResponsePromise.fromPromise(this.__install(appId, request, requestOptions));
276
+ }
277
+ __install(appId, request, requestOptions) {
278
+ return __awaiter(this, void 0, void 0, function* () {
279
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
280
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
281
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
282
+ "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,
283
+ "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,
284
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
285
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
286
+ 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/directory/${core.url.encodePathParam(appId)}/install`),
287
+ method: "POST",
288
+ headers: _headers,
289
+ contentType: "application/json",
290
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
291
+ requestType: "json",
292
+ body: serializers.InstallDirectoryAppRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
293
+ 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,
294
+ 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,
295
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
296
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
297
+ logging: this._options.logging,
298
+ });
299
+ if (_response.ok) {
300
+ return { data: undefined, rawResponse: _response.rawResponse };
301
+ }
302
+ if (_response.error.reason === "status-code") {
303
+ switch (_response.error.statusCode) {
304
+ case 404:
305
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
306
+ unrecognizedObjectKeys: "passthrough",
307
+ allowUnrecognizedUnionMembers: true,
308
+ allowUnrecognizedEnumValues: true,
309
+ breadcrumbsPrefix: ["response"],
310
+ }), _response.rawResponse);
311
+ case 400:
312
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
313
+ unrecognizedObjectKeys: "passthrough",
314
+ allowUnrecognizedUnionMembers: true,
315
+ allowUnrecognizedEnumValues: true,
316
+ breadcrumbsPrefix: ["response"],
317
+ }), _response.rawResponse);
318
+ case 413:
319
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
320
+ unrecognizedObjectKeys: "passthrough",
321
+ allowUnrecognizedUnionMembers: true,
322
+ allowUnrecognizedEnumValues: true,
323
+ breadcrumbsPrefix: ["response"],
324
+ }), _response.rawResponse);
325
+ case 429:
326
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
327
+ unrecognizedObjectKeys: "passthrough",
328
+ allowUnrecognizedUnionMembers: true,
329
+ allowUnrecognizedEnumValues: true,
330
+ breadcrumbsPrefix: ["response"],
331
+ }), _response.rawResponse);
332
+ case 500:
333
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
334
+ unrecognizedObjectKeys: "passthrough",
335
+ allowUnrecognizedUnionMembers: true,
336
+ allowUnrecognizedEnumValues: true,
337
+ breadcrumbsPrefix: ["response"],
338
+ }), _response.rawResponse);
339
+ default:
340
+ throw new errors.MavenAGIError({
341
+ statusCode: _response.error.statusCode,
342
+ body: _response.error.body,
343
+ rawResponse: _response.rawResponse,
344
+ });
345
+ }
346
+ }
347
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/directory/{appId}/install");
348
+ });
349
+ }
350
+ /**
351
+ * Uninstalls the app from the agent.
352
+ *
353
+ * @param {string} appId
354
+ * @param {AppDirectoryClient.RequestOptions} requestOptions - Request-specific configuration.
355
+ *
356
+ * @throws {@link MavenAGI.NotFoundError}
357
+ * @throws {@link MavenAGI.BadRequestError}
358
+ * @throws {@link MavenAGI.PayloadTooLargeError}
359
+ * @throws {@link MavenAGI.TooManyRequestsError}
360
+ * @throws {@link MavenAGI.ServerError}
361
+ *
362
+ * @example
363
+ * await client.appDirectory.uninstall("appId")
364
+ */
365
+ uninstall(appId, requestOptions) {
366
+ return core.HttpResponsePromise.fromPromise(this.__uninstall(appId, requestOptions));
367
+ }
368
+ __uninstall(appId, requestOptions) {
369
+ return __awaiter(this, void 0, void 0, function* () {
370
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
371
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
372
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
373
+ "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,
374
+ "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,
375
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
376
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
377
+ 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/directory/${core.url.encodePathParam(appId)}/install`),
378
+ method: "DELETE",
379
+ headers: _headers,
380
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
381
+ 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,
382
+ 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,
383
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
384
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
385
+ logging: this._options.logging,
386
+ });
387
+ if (_response.ok) {
388
+ return { data: undefined, rawResponse: _response.rawResponse };
389
+ }
390
+ if (_response.error.reason === "status-code") {
391
+ switch (_response.error.statusCode) {
392
+ case 404:
393
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
394
+ unrecognizedObjectKeys: "passthrough",
395
+ allowUnrecognizedUnionMembers: true,
396
+ allowUnrecognizedEnumValues: true,
397
+ breadcrumbsPrefix: ["response"],
398
+ }), _response.rawResponse);
399
+ case 400:
400
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
401
+ unrecognizedObjectKeys: "passthrough",
402
+ allowUnrecognizedUnionMembers: true,
403
+ allowUnrecognizedEnumValues: true,
404
+ breadcrumbsPrefix: ["response"],
405
+ }), _response.rawResponse);
406
+ case 413:
407
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
408
+ unrecognizedObjectKeys: "passthrough",
409
+ allowUnrecognizedUnionMembers: true,
410
+ allowUnrecognizedEnumValues: true,
411
+ breadcrumbsPrefix: ["response"],
412
+ }), _response.rawResponse);
413
+ case 429:
414
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
415
+ unrecognizedObjectKeys: "passthrough",
416
+ allowUnrecognizedUnionMembers: true,
417
+ allowUnrecognizedEnumValues: true,
418
+ breadcrumbsPrefix: ["response"],
419
+ }), _response.rawResponse);
420
+ case 500:
421
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
422
+ unrecognizedObjectKeys: "passthrough",
423
+ allowUnrecognizedUnionMembers: true,
424
+ allowUnrecognizedEnumValues: true,
425
+ breadcrumbsPrefix: ["response"],
426
+ }), _response.rawResponse);
427
+ default:
428
+ throw new errors.MavenAGIError({
429
+ statusCode: _response.error.statusCode,
430
+ body: _response.error.body,
431
+ rawResponse: _response.rawResponse,
432
+ });
433
+ }
434
+ }
435
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/directory/{appId}/install");
436
+ });
437
+ }
438
+ /**
439
+ * Gets a url for downloading a file app setting.
440
+ *
441
+ * @param {string} appId
442
+ * @param {string} settingsKey
443
+ * @param {AppDirectoryClient.RequestOptions} requestOptions - Request-specific configuration.
444
+ *
445
+ * @throws {@link MavenAGI.NotFoundError}
446
+ * @throws {@link MavenAGI.BadRequestError}
447
+ * @throws {@link MavenAGI.PayloadTooLargeError}
448
+ * @throws {@link MavenAGI.TooManyRequestsError}
449
+ * @throws {@link MavenAGI.ServerError}
450
+ *
451
+ * @example
452
+ * await client.appDirectory.getSettingDownloadUrl("appId", "settingsKey")
453
+ */
454
+ getSettingDownloadUrl(appId, settingsKey, requestOptions) {
455
+ return core.HttpResponsePromise.fromPromise(this.__getSettingDownloadUrl(appId, settingsKey, requestOptions));
456
+ }
457
+ __getSettingDownloadUrl(appId, settingsKey, requestOptions) {
458
+ return __awaiter(this, void 0, void 0, function* () {
459
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
460
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
461
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
462
+ "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,
463
+ "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,
464
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
465
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
466
+ 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/directory/${core.url.encodePathParam(appId)}/settings/${core.url.encodePathParam(settingsKey)}`),
467
+ method: "GET",
468
+ headers: _headers,
469
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
470
+ 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,
471
+ 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,
472
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
473
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
474
+ logging: this._options.logging,
475
+ });
476
+ if (_response.ok) {
477
+ return {
478
+ data: serializers.GetDirectoryAppSettingDownloadUrlResponse.parseOrThrow(_response.body, {
479
+ unrecognizedObjectKeys: "passthrough",
480
+ allowUnrecognizedUnionMembers: true,
481
+ allowUnrecognizedEnumValues: true,
482
+ breadcrumbsPrefix: ["response"],
483
+ }),
484
+ rawResponse: _response.rawResponse,
485
+ };
486
+ }
487
+ if (_response.error.reason === "status-code") {
488
+ switch (_response.error.statusCode) {
489
+ case 404:
490
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
491
+ unrecognizedObjectKeys: "passthrough",
492
+ allowUnrecognizedUnionMembers: true,
493
+ allowUnrecognizedEnumValues: true,
494
+ breadcrumbsPrefix: ["response"],
495
+ }), _response.rawResponse);
496
+ case 400:
497
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
498
+ unrecognizedObjectKeys: "passthrough",
499
+ allowUnrecognizedUnionMembers: true,
500
+ allowUnrecognizedEnumValues: true,
501
+ breadcrumbsPrefix: ["response"],
502
+ }), _response.rawResponse);
503
+ case 413:
504
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
505
+ unrecognizedObjectKeys: "passthrough",
506
+ allowUnrecognizedUnionMembers: true,
507
+ allowUnrecognizedEnumValues: true,
508
+ breadcrumbsPrefix: ["response"],
509
+ }), _response.rawResponse);
510
+ case 429:
511
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
512
+ unrecognizedObjectKeys: "passthrough",
513
+ allowUnrecognizedUnionMembers: true,
514
+ allowUnrecognizedEnumValues: true,
515
+ breadcrumbsPrefix: ["response"],
516
+ }), _response.rawResponse);
517
+ case 500:
518
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
519
+ unrecognizedObjectKeys: "passthrough",
520
+ allowUnrecognizedUnionMembers: true,
521
+ allowUnrecognizedEnumValues: true,
522
+ breadcrumbsPrefix: ["response"],
523
+ }), _response.rawResponse);
524
+ default:
525
+ throw new errors.MavenAGIError({
526
+ statusCode: _response.error.statusCode,
527
+ body: _response.error.body,
528
+ rawResponse: _response.rawResponse,
529
+ });
530
+ }
531
+ }
532
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/directory/{appId}/settings/{settingsKey}");
533
+ });
534
+ }
535
+ /**
536
+ * Gets a presigned url for uploading a file app setting before installation.
537
+ *
538
+ * @param {string} appId
539
+ * @param {string} settingsKey
540
+ * @param {MavenAGI.GetAppSettingUploadUrlRequest} request
541
+ * @param {AppDirectoryClient.RequestOptions} requestOptions - Request-specific configuration.
542
+ *
543
+ * @throws {@link MavenAGI.NotFoundError}
544
+ * @throws {@link MavenAGI.BadRequestError}
545
+ * @throws {@link MavenAGI.PayloadTooLargeError}
546
+ * @throws {@link MavenAGI.TooManyRequestsError}
547
+ * @throws {@link MavenAGI.ServerError}
548
+ *
549
+ * @example
550
+ * await client.appDirectory.getSettingUploadUrl("appId", "settingsKey", {
551
+ * contentLength: 1,
552
+ * contentType: "contentType"
553
+ * })
554
+ */
555
+ getSettingUploadUrl(appId, settingsKey, request, requestOptions) {
556
+ return core.HttpResponsePromise.fromPromise(this.__getSettingUploadUrl(appId, settingsKey, request, requestOptions));
557
+ }
558
+ __getSettingUploadUrl(appId, settingsKey, request, requestOptions) {
559
+ return __awaiter(this, void 0, void 0, function* () {
560
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
561
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
562
+ const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
563
+ "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,
564
+ "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,
565
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
566
+ const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
567
+ 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/directory/${core.url.encodePathParam(appId)}/settings/${core.url.encodePathParam(settingsKey)}/upload-url`),
568
+ method: "POST",
569
+ headers: _headers,
570
+ contentType: "application/json",
571
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
572
+ requestType: "json",
573
+ body: serializers.GetAppSettingUploadUrlRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
574
+ 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,
575
+ 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,
576
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
577
+ fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
578
+ logging: this._options.logging,
579
+ });
580
+ if (_response.ok) {
581
+ return {
582
+ data: serializers.GetDirectoryAppSettingUploadUrlResponse.parseOrThrow(_response.body, {
583
+ unrecognizedObjectKeys: "passthrough",
584
+ allowUnrecognizedUnionMembers: true,
585
+ allowUnrecognizedEnumValues: true,
586
+ breadcrumbsPrefix: ["response"],
587
+ }),
588
+ rawResponse: _response.rawResponse,
589
+ };
590
+ }
591
+ if (_response.error.reason === "status-code") {
592
+ switch (_response.error.statusCode) {
593
+ case 404:
594
+ throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
595
+ unrecognizedObjectKeys: "passthrough",
596
+ allowUnrecognizedUnionMembers: true,
597
+ allowUnrecognizedEnumValues: true,
598
+ breadcrumbsPrefix: ["response"],
599
+ }), _response.rawResponse);
600
+ case 400:
601
+ throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
602
+ unrecognizedObjectKeys: "passthrough",
603
+ allowUnrecognizedUnionMembers: true,
604
+ allowUnrecognizedEnumValues: true,
605
+ breadcrumbsPrefix: ["response"],
606
+ }), _response.rawResponse);
607
+ case 413:
608
+ throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
609
+ unrecognizedObjectKeys: "passthrough",
610
+ allowUnrecognizedUnionMembers: true,
611
+ allowUnrecognizedEnumValues: true,
612
+ breadcrumbsPrefix: ["response"],
613
+ }), _response.rawResponse);
614
+ case 429:
615
+ throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
616
+ unrecognizedObjectKeys: "passthrough",
617
+ allowUnrecognizedUnionMembers: true,
618
+ allowUnrecognizedEnumValues: true,
619
+ breadcrumbsPrefix: ["response"],
620
+ }), _response.rawResponse);
621
+ case 500:
622
+ throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
623
+ unrecognizedObjectKeys: "passthrough",
624
+ allowUnrecognizedUnionMembers: true,
625
+ allowUnrecognizedEnumValues: true,
626
+ breadcrumbsPrefix: ["response"],
627
+ }), _response.rawResponse);
628
+ default:
629
+ throw new errors.MavenAGIError({
630
+ statusCode: _response.error.statusCode,
631
+ body: _response.error.body,
632
+ rawResponse: _response.rawResponse,
633
+ });
634
+ }
635
+ }
636
+ return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/directory/{appId}/settings/{settingsKey}/upload-url");
637
+ });
638
+ }
639
+ }
640
+ exports.AppDirectoryClient = AppDirectoryClient;
@@ -0,0 +1 @@
1
+ export * from "./requests";