mavenagi 1.2.61 → 1.2.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BaseClient.js +2 -2
- package/Client.d.ts +6 -0
- package/Client.js +40 -30
- package/api/resources/actions/client/Client.d.ts +16 -0
- package/api/resources/actions/client/Client.js +16 -0
- package/api/resources/capabilities/client/Client.d.ts +118 -0
- package/api/resources/capabilities/client/Client.js +521 -0
- package/api/resources/capabilities/client/index.d.ts +1 -0
- package/api/resources/capabilities/client/index.js +17 -0
- package/api/resources/capabilities/client/requests/CapabilitiesSearchRequest.d.ts +36 -0
- package/api/resources/capabilities/client/requests/CapabilitiesSearchRequest.js +3 -0
- package/api/resources/capabilities/client/requests/DeleteCapabilityByTypeRequest.d.ts +18 -0
- package/api/resources/capabilities/client/requests/DeleteCapabilityByTypeRequest.js +3 -0
- package/api/resources/capabilities/client/requests/GetCapabilityByTypeRequest.d.ts +22 -0
- package/api/resources/capabilities/client/requests/GetCapabilityByTypeRequest.js +3 -0
- package/api/resources/capabilities/client/requests/PatchCapabilityByTypeRequest.d.ts +24 -0
- package/api/resources/capabilities/client/requests/PatchCapabilityByTypeRequest.js +3 -0
- package/api/resources/capabilities/client/requests/index.d.ts +4 -0
- package/api/resources/capabilities/client/requests/index.js +2 -0
- package/api/resources/capabilities/exports.d.ts +2 -0
- package/api/resources/capabilities/exports.js +21 -0
- package/api/resources/capabilities/index.d.ts +2 -0
- package/api/resources/capabilities/index.js +18 -0
- package/api/resources/capabilities/types/CapabilitiesSearchResponse.d.ts +43 -0
- package/api/resources/capabilities/types/CapabilitiesSearchResponse.js +3 -0
- package/api/resources/capabilities/types/CapabilityResponse.d.ts +23 -0
- package/api/resources/capabilities/types/CapabilityResponse.js +3 -0
- package/api/resources/capabilities/types/CapabilitySortField.d.ts +7 -0
- package/api/resources/capabilities/types/CapabilitySortField.js +10 -0
- package/api/resources/capabilities/types/CapabilitySummary.d.ts +28 -0
- package/api/resources/capabilities/types/CapabilitySummary.js +3 -0
- package/api/resources/capabilities/types/index.d.ts +4 -0
- package/api/resources/capabilities/types/index.js +20 -0
- package/api/resources/charters/types/CharterSearchFilter.d.ts +12 -9
- package/api/resources/commons/types/ActionResponse.d.ts +11 -2
- package/api/resources/commons/types/BaseConversationResponse.d.ts +6 -0
- package/api/resources/commons/types/CapabilityBase.d.ts +23 -0
- package/api/resources/commons/types/CapabilityBase.js +3 -0
- package/api/resources/{intelligentFields/types/IntelligentFieldStatus.d.ts → commons/types/CapabilityStatus.d.ts} +6 -3
- package/api/resources/{intelligentFields/types/IntelligentFieldStatus.js → commons/types/CapabilityStatus.js} +6 -3
- package/api/resources/commons/types/CapabilityType.d.ts +8 -0
- package/api/resources/commons/types/CapabilityType.js +11 -0
- package/api/resources/commons/types/EntityType.d.ts +5 -1
- package/api/resources/commons/types/EntityType.js +5 -1
- package/api/resources/commons/types/ErrorMessage.d.ts +3 -0
- package/api/resources/commons/types/ErrorReason.d.ts +31 -0
- package/api/resources/commons/types/ErrorReason.js +34 -0
- package/api/resources/commons/types/index.d.ts +4 -0
- package/api/resources/commons/types/index.js +4 -0
- package/api/resources/conversation/client/Client.d.ts +1 -0
- package/api/resources/conversation/client/Client.js +1 -0
- package/api/resources/conversationKickoffs/client/Client.d.ts +45 -0
- package/api/resources/conversationKickoffs/client/Client.js +175 -0
- package/api/resources/conversationKickoffs/client/index.d.ts +1 -0
- package/api/resources/conversationKickoffs/client/index.js +17 -0
- package/api/resources/conversationKickoffs/client/requests/CreateConversationKickoffRequest.d.ts +22 -0
- package/api/resources/conversationKickoffs/client/requests/CreateConversationKickoffRequest.js +3 -0
- package/api/resources/conversationKickoffs/client/requests/index.d.ts +1 -0
- package/api/resources/conversationKickoffs/client/requests/index.js +2 -0
- package/api/resources/conversationKickoffs/exports.d.ts +2 -0
- package/api/resources/conversationKickoffs/exports.js +21 -0
- package/api/resources/conversationKickoffs/index.d.ts +2 -0
- package/api/resources/conversationKickoffs/index.js +18 -0
- package/api/resources/conversationKickoffs/types/ConversationKickoff.d.ts +27 -0
- package/api/resources/conversationKickoffs/types/ConversationKickoff.js +3 -0
- package/api/resources/conversationKickoffs/types/index.d.ts +1 -0
- package/api/resources/conversationKickoffs/types/index.js +17 -0
- package/api/resources/index.d.ts +6 -0
- package/api/resources/index.js +7 -1
- package/api/resources/intelligentFields/client/Client.d.ts +13 -1
- package/api/resources/intelligentFields/client/Client.js +13 -1
- package/api/resources/intelligentFields/client/requests/IntelligentFieldDeleteRequest.d.ts +1 -1
- package/api/resources/intelligentFields/client/requests/IntelligentFieldGetRequest.d.ts +1 -1
- package/api/resources/intelligentFields/client/requests/IntelligentFieldPatchRequest.d.ts +2 -2
- package/api/resources/intelligentFields/types/EnumOption.d.ts +5 -0
- package/api/resources/intelligentFields/types/IntelligentFieldCore.d.ts +0 -4
- package/api/resources/intelligentFields/types/IntelligentFieldDetailResponse.d.ts +1 -1
- package/api/resources/intelligentFields/types/IntelligentFieldRequest.d.ts +6 -1
- package/api/resources/intelligentFields/types/IntelligentFieldResponse.d.ts +2 -8
- package/api/resources/intelligentFields/types/index.d.ts +0 -1
- package/api/resources/intelligentFields/types/index.js +0 -1
- package/api/resources/knowledge/client/Client.d.ts +3 -0
- package/api/resources/knowledge/client/Client.js +3 -0
- package/api/resources/triggers/client/Client.d.ts +21 -0
- package/api/resources/triggers/client/Client.js +21 -0
- package/api/resources/triggers/types/EventTriggerBase.d.ts +0 -4
- package/api/resources/triggers/types/EventTriggerRequest.d.ts +4 -0
- package/api/resources/triggers/types/EventTriggerResponse.d.ts +11 -3
- package/package.json +1 -1
- package/reference.md +461 -1
- package/serialization/resources/capabilities/client/index.d.ts +1 -0
- package/serialization/resources/capabilities/client/index.js +17 -0
- package/serialization/resources/capabilities/client/requests/CapabilitiesSearchRequest.d.ts +21 -0
- package/serialization/resources/capabilities/client/requests/CapabilitiesSearchRequest.js +55 -0
- package/serialization/resources/capabilities/client/requests/PatchCapabilityByTypeRequest.d.ts +10 -0
- package/serialization/resources/capabilities/client/requests/PatchCapabilityByTypeRequest.js +42 -0
- package/serialization/resources/capabilities/client/requests/index.d.ts +2 -0
- package/serialization/resources/capabilities/client/requests/index.js +7 -0
- package/serialization/resources/capabilities/index.d.ts +2 -0
- package/serialization/resources/capabilities/index.js +18 -0
- package/serialization/resources/capabilities/types/CapabilitiesSearchResponse.d.ts +11 -0
- package/serialization/resources/capabilities/types/CapabilitiesSearchResponse.js +45 -0
- package/serialization/resources/capabilities/types/CapabilityResponse.d.ts +23 -0
- package/serialization/resources/capabilities/types/CapabilityResponse.js +53 -0
- package/serialization/resources/capabilities/types/CapabilitySortField.d.ts +7 -0
- package/serialization/resources/{intelligentFields/types/IntelligentFieldStatus.js → capabilities/types/CapabilitySortField.js} +2 -2
- package/serialization/resources/capabilities/types/CapabilitySummary.d.ts +13 -0
- package/serialization/resources/capabilities/types/CapabilitySummary.js +47 -0
- package/serialization/resources/capabilities/types/index.d.ts +4 -0
- package/serialization/resources/capabilities/types/index.js +20 -0
- package/serialization/resources/charters/types/CharterSearchFilter.d.ts +1 -0
- package/serialization/resources/charters/types/CharterSearchFilter.js +1 -0
- package/serialization/resources/commons/types/ActionResponse.d.ts +3 -2
- package/serialization/resources/commons/types/ActionResponse.js +4 -2
- package/serialization/resources/commons/types/BaseConversationResponse.d.ts +1 -0
- package/serialization/resources/commons/types/BaseConversationResponse.js +1 -0
- package/serialization/resources/commons/types/CapabilityBase.d.ts +14 -0
- package/serialization/resources/commons/types/CapabilityBase.js +46 -0
- package/serialization/resources/{intelligentFields/types/IntelligentFieldStatus.d.ts → commons/types/CapabilityStatus.d.ts} +2 -2
- package/serialization/resources/commons/types/CapabilityStatus.js +39 -0
- package/serialization/resources/commons/types/CapabilityType.d.ts +7 -0
- package/serialization/resources/commons/types/CapabilityType.js +39 -0
- package/serialization/resources/commons/types/EntityType.d.ts +1 -1
- package/serialization/resources/commons/types/EntityType.js +1 -1
- package/serialization/resources/commons/types/ErrorMessage.d.ts +2 -0
- package/serialization/resources/commons/types/ErrorMessage.js +2 -0
- package/serialization/resources/commons/types/ErrorReason.d.ts +7 -0
- package/serialization/resources/commons/types/ErrorReason.js +49 -0
- package/serialization/resources/commons/types/index.d.ts +4 -0
- package/serialization/resources/commons/types/index.js +4 -0
- package/serialization/resources/conversationKickoffs/client/index.d.ts +1 -0
- package/serialization/resources/conversationKickoffs/client/index.js +17 -0
- package/serialization/resources/conversationKickoffs/client/requests/CreateConversationKickoffRequest.d.ts +12 -0
- package/serialization/resources/conversationKickoffs/client/requests/CreateConversationKickoffRequest.js +44 -0
- package/serialization/resources/conversationKickoffs/client/requests/index.d.ts +1 -0
- package/serialization/resources/conversationKickoffs/client/requests/index.js +5 -0
- package/serialization/resources/conversationKickoffs/index.d.ts +2 -0
- package/serialization/resources/conversationKickoffs/index.js +18 -0
- package/serialization/resources/conversationKickoffs/types/ConversationKickoff.d.ts +11 -0
- package/serialization/resources/conversationKickoffs/types/ConversationKickoff.js +45 -0
- package/serialization/resources/conversationKickoffs/types/index.d.ts +1 -0
- package/serialization/resources/conversationKickoffs/types/index.js +17 -0
- package/serialization/resources/index.d.ts +6 -0
- package/serialization/resources/index.js +7 -1
- package/serialization/resources/intelligentFields/client/requests/IntelligentFieldPatchRequest.d.ts +2 -2
- package/serialization/resources/intelligentFields/client/requests/IntelligentFieldPatchRequest.js +2 -2
- package/serialization/resources/intelligentFields/types/EnumOption.d.ts +1 -0
- package/serialization/resources/intelligentFields/types/EnumOption.js +1 -0
- package/serialization/resources/intelligentFields/types/IntelligentFieldCore.d.ts +0 -2
- package/serialization/resources/intelligentFields/types/IntelligentFieldCore.js +0 -2
- package/serialization/resources/intelligentFields/types/IntelligentFieldRequest.d.ts +2 -0
- package/serialization/resources/intelligentFields/types/IntelligentFieldRequest.js +2 -0
- package/serialization/resources/intelligentFields/types/IntelligentFieldResponse.d.ts +2 -5
- package/serialization/resources/intelligentFields/types/IntelligentFieldResponse.js +3 -5
- package/serialization/resources/intelligentFields/types/index.d.ts +0 -1
- package/serialization/resources/intelligentFields/types/index.js +0 -1
- package/serialization/resources/triggers/types/EventTriggerBase.d.ts +0 -2
- package/serialization/resources/triggers/types/EventTriggerBase.js +0 -2
- package/serialization/resources/triggers/types/EventTriggerRequest.d.ts +2 -0
- package/serialization/resources/triggers/types/EventTriggerRequest.js +2 -0
- package/serialization/resources/triggers/types/EventTriggerResponse.d.ts +2 -1
- package/serialization/resources/triggers/types/EventTriggerResponse.js +3 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -0,0 +1,521 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
46
|
+
var t = {};
|
|
47
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
+
t[p] = s[p];
|
|
49
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
+
t[p[i]] = s[p[i]];
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.CapabilitiesClient = void 0;
|
|
58
|
+
const BaseClient_1 = require("../../../../BaseClient");
|
|
59
|
+
const core = __importStar(require("../../../../core"));
|
|
60
|
+
const headers_1 = require("../../../../core/headers");
|
|
61
|
+
const requestBody_1 = require("../../../../core/requestBody");
|
|
62
|
+
const environments = __importStar(require("../../../../environments"));
|
|
63
|
+
const handleNonStatusCodeError_1 = require("../../../../errors/handleNonStatusCodeError");
|
|
64
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
65
|
+
const serializers = __importStar(require("../../../../serialization/index"));
|
|
66
|
+
const MavenAGI = __importStar(require("../../../index"));
|
|
67
|
+
class CapabilitiesClient {
|
|
68
|
+
constructor(options) {
|
|
69
|
+
this._options = (0, BaseClient_1.normalizeClientOptionsWithAuth)(options);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Fetch one of an agent's capabilities by its type and reference ID.
|
|
73
|
+
*
|
|
74
|
+
* The response carries the same fields the capability's own API returns, so an Action read
|
|
75
|
+
* here and an Action read from the Actions API are the same object. Intelligent Fields are the
|
|
76
|
+
* one exception: their own API also returns the charters referencing the field, which this
|
|
77
|
+
* endpoint leaves out.
|
|
78
|
+
*
|
|
79
|
+
* @param {MavenAGI.CapabilityType} capabilityType - Which kind of capability to fetch.
|
|
80
|
+
* @param {string} referenceId - The capability's reference ID, unique within its type and app.
|
|
81
|
+
* @param {MavenAGI.GetCapabilityByTypeRequest} request
|
|
82
|
+
* @param {CapabilitiesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
83
|
+
*
|
|
84
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
85
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
86
|
+
* @throws {@link MavenAGI.PayloadTooLargeError}
|
|
87
|
+
* @throws {@link MavenAGI.TooManyRequestsError}
|
|
88
|
+
* @throws {@link MavenAGI.ServerError}
|
|
89
|
+
* @throws {@link errors.MavenAGIError}
|
|
90
|
+
* @throws {@link errors.MavenAGITimeoutError}
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* await client.capabilities.getCapability("ACTION", "referenceId")
|
|
94
|
+
*/
|
|
95
|
+
getCapability(capabilityType, referenceId, request = {}, requestOptions) {
|
|
96
|
+
return core.HttpResponsePromise.fromPromise(this.__getCapability(capabilityType, referenceId, request, requestOptions));
|
|
97
|
+
}
|
|
98
|
+
__getCapability(capabilityType_1, referenceId_1) {
|
|
99
|
+
return __awaiter(this, arguments, void 0, function* (capabilityType, referenceId, request = {}, requestOptions) {
|
|
100
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
101
|
+
const { appId, variantReferenceId, variantAppId } = request;
|
|
102
|
+
const _queryParams = {
|
|
103
|
+
appId,
|
|
104
|
+
variantReferenceId,
|
|
105
|
+
variantAppId,
|
|
106
|
+
};
|
|
107
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
108
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
109
|
+
"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,
|
|
110
|
+
"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,
|
|
111
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
112
|
+
const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
|
|
113
|
+
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/capabilities/${core.url.encodePathParam(serializers.CapabilityType.jsonOrThrow(capabilityType))}/${core.url.encodePathParam(referenceId)}`),
|
|
114
|
+
method: "GET",
|
|
115
|
+
headers: _headers,
|
|
116
|
+
queryString: core.url
|
|
117
|
+
.queryBuilder()
|
|
118
|
+
.addMany(_queryParams)
|
|
119
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
120
|
+
.build(),
|
|
121
|
+
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,
|
|
122
|
+
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,
|
|
123
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
124
|
+
fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
|
|
125
|
+
logging: this._options.logging,
|
|
126
|
+
});
|
|
127
|
+
if (_response.ok) {
|
|
128
|
+
return {
|
|
129
|
+
data: serializers.CapabilityResponse.parseOrThrow(_response.body, {
|
|
130
|
+
unrecognizedObjectKeys: "passthrough",
|
|
131
|
+
allowUnrecognizedUnionMembers: true,
|
|
132
|
+
allowUnrecognizedEnumValues: true,
|
|
133
|
+
breadcrumbsPrefix: ["response"],
|
|
134
|
+
}),
|
|
135
|
+
rawResponse: _response.rawResponse,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (_response.error.reason === "status-code") {
|
|
139
|
+
switch (_response.error.statusCode) {
|
|
140
|
+
case 404:
|
|
141
|
+
throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
142
|
+
unrecognizedObjectKeys: "passthrough",
|
|
143
|
+
allowUnrecognizedUnionMembers: true,
|
|
144
|
+
allowUnrecognizedEnumValues: true,
|
|
145
|
+
breadcrumbsPrefix: ["response"],
|
|
146
|
+
}), _response.rawResponse);
|
|
147
|
+
case 400:
|
|
148
|
+
throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
149
|
+
unrecognizedObjectKeys: "passthrough",
|
|
150
|
+
allowUnrecognizedUnionMembers: true,
|
|
151
|
+
allowUnrecognizedEnumValues: true,
|
|
152
|
+
breadcrumbsPrefix: ["response"],
|
|
153
|
+
}), _response.rawResponse);
|
|
154
|
+
case 413:
|
|
155
|
+
throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
156
|
+
unrecognizedObjectKeys: "passthrough",
|
|
157
|
+
allowUnrecognizedUnionMembers: true,
|
|
158
|
+
allowUnrecognizedEnumValues: true,
|
|
159
|
+
breadcrumbsPrefix: ["response"],
|
|
160
|
+
}), _response.rawResponse);
|
|
161
|
+
case 429:
|
|
162
|
+
throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
163
|
+
unrecognizedObjectKeys: "passthrough",
|
|
164
|
+
allowUnrecognizedUnionMembers: true,
|
|
165
|
+
allowUnrecognizedEnumValues: true,
|
|
166
|
+
breadcrumbsPrefix: ["response"],
|
|
167
|
+
}), _response.rawResponse);
|
|
168
|
+
case 500:
|
|
169
|
+
throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
170
|
+
unrecognizedObjectKeys: "passthrough",
|
|
171
|
+
allowUnrecognizedUnionMembers: true,
|
|
172
|
+
allowUnrecognizedEnumValues: true,
|
|
173
|
+
breadcrumbsPrefix: ["response"],
|
|
174
|
+
}), _response.rawResponse);
|
|
175
|
+
default:
|
|
176
|
+
throw new errors.MavenAGIError({
|
|
177
|
+
statusCode: _response.error.statusCode,
|
|
178
|
+
body: _response.error.body,
|
|
179
|
+
rawResponse: _response.rawResponse,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/capabilities/{capabilityType}/{referenceId}");
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Set whether the agent uses a capability, whatever kind it is. This is the publish and
|
|
188
|
+
* unpublish operation, and it works the same way for every capability type.
|
|
189
|
+
*
|
|
190
|
+
* Everything else about a capability -- its name, its description, and any settings
|
|
191
|
+
* particular to its kind -- is changed through that capability's own API.
|
|
192
|
+
*
|
|
193
|
+
* @param {MavenAGI.CapabilityType} capabilityType - Which kind of capability to update.
|
|
194
|
+
* @param {string} referenceId - The capability's reference ID, unique within its type and app.
|
|
195
|
+
* @param {MavenAGI.PatchCapabilityByTypeRequest} request
|
|
196
|
+
* @param {CapabilitiesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
197
|
+
*
|
|
198
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
199
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
200
|
+
* @throws {@link MavenAGI.PayloadTooLargeError}
|
|
201
|
+
* @throws {@link MavenAGI.TooManyRequestsError}
|
|
202
|
+
* @throws {@link MavenAGI.ServerError}
|
|
203
|
+
* @throws {@link errors.MavenAGIError}
|
|
204
|
+
* @throws {@link errors.MavenAGITimeoutError}
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* await client.capabilities.patchCapability("ACTION", "referenceId")
|
|
208
|
+
*/
|
|
209
|
+
patchCapability(capabilityType, referenceId, request = {}, requestOptions) {
|
|
210
|
+
return core.HttpResponsePromise.fromPromise(this.__patchCapability(capabilityType, referenceId, request, requestOptions));
|
|
211
|
+
}
|
|
212
|
+
__patchCapability(capabilityType_1, referenceId_1) {
|
|
213
|
+
return __awaiter(this, arguments, void 0, function* (capabilityType, referenceId, request = {}, requestOptions) {
|
|
214
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
215
|
+
const { appId, variantReferenceId, variantAppId } = request, _body = __rest(request, ["appId", "variantReferenceId", "variantAppId"]);
|
|
216
|
+
const _queryParams = {
|
|
217
|
+
appId,
|
|
218
|
+
variantReferenceId,
|
|
219
|
+
variantAppId,
|
|
220
|
+
};
|
|
221
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
222
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
223
|
+
"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,
|
|
224
|
+
"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,
|
|
225
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
226
|
+
const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
|
|
227
|
+
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/capabilities/${core.url.encodePathParam(serializers.CapabilityType.jsonOrThrow(capabilityType))}/${core.url.encodePathParam(referenceId)}`),
|
|
228
|
+
method: "PATCH",
|
|
229
|
+
headers: _headers,
|
|
230
|
+
contentType: "application/merge-patch+json",
|
|
231
|
+
queryString: core.url
|
|
232
|
+
.queryBuilder()
|
|
233
|
+
.addMany(_queryParams)
|
|
234
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
235
|
+
.build(),
|
|
236
|
+
requestType: "json",
|
|
237
|
+
body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.PatchCapabilityByTypeRequest.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
238
|
+
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,
|
|
239
|
+
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,
|
|
240
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
241
|
+
fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
|
|
242
|
+
logging: this._options.logging,
|
|
243
|
+
});
|
|
244
|
+
if (_response.ok) {
|
|
245
|
+
return {
|
|
246
|
+
data: serializers.CapabilityResponse.parseOrThrow(_response.body, {
|
|
247
|
+
unrecognizedObjectKeys: "passthrough",
|
|
248
|
+
allowUnrecognizedUnionMembers: true,
|
|
249
|
+
allowUnrecognizedEnumValues: true,
|
|
250
|
+
breadcrumbsPrefix: ["response"],
|
|
251
|
+
}),
|
|
252
|
+
rawResponse: _response.rawResponse,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
if (_response.error.reason === "status-code") {
|
|
256
|
+
switch (_response.error.statusCode) {
|
|
257
|
+
case 404:
|
|
258
|
+
throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
259
|
+
unrecognizedObjectKeys: "passthrough",
|
|
260
|
+
allowUnrecognizedUnionMembers: true,
|
|
261
|
+
allowUnrecognizedEnumValues: true,
|
|
262
|
+
breadcrumbsPrefix: ["response"],
|
|
263
|
+
}), _response.rawResponse);
|
|
264
|
+
case 400:
|
|
265
|
+
throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
266
|
+
unrecognizedObjectKeys: "passthrough",
|
|
267
|
+
allowUnrecognizedUnionMembers: true,
|
|
268
|
+
allowUnrecognizedEnumValues: true,
|
|
269
|
+
breadcrumbsPrefix: ["response"],
|
|
270
|
+
}), _response.rawResponse);
|
|
271
|
+
case 413:
|
|
272
|
+
throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
273
|
+
unrecognizedObjectKeys: "passthrough",
|
|
274
|
+
allowUnrecognizedUnionMembers: true,
|
|
275
|
+
allowUnrecognizedEnumValues: true,
|
|
276
|
+
breadcrumbsPrefix: ["response"],
|
|
277
|
+
}), _response.rawResponse);
|
|
278
|
+
case 429:
|
|
279
|
+
throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
280
|
+
unrecognizedObjectKeys: "passthrough",
|
|
281
|
+
allowUnrecognizedUnionMembers: true,
|
|
282
|
+
allowUnrecognizedEnumValues: true,
|
|
283
|
+
breadcrumbsPrefix: ["response"],
|
|
284
|
+
}), _response.rawResponse);
|
|
285
|
+
case 500:
|
|
286
|
+
throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
287
|
+
unrecognizedObjectKeys: "passthrough",
|
|
288
|
+
allowUnrecognizedUnionMembers: true,
|
|
289
|
+
allowUnrecognizedEnumValues: true,
|
|
290
|
+
breadcrumbsPrefix: ["response"],
|
|
291
|
+
}), _response.rawResponse);
|
|
292
|
+
default:
|
|
293
|
+
throw new errors.MavenAGIError({
|
|
294
|
+
statusCode: _response.error.statusCode,
|
|
295
|
+
body: _response.error.body,
|
|
296
|
+
rawResponse: _response.rawResponse,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/v1/capabilities/{capabilityType}/{referenceId}");
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Delete one of an agent's capabilities. The agent stops using it, and it stops being
|
|
305
|
+
* addressable: a later get, patch or delete of the same capability is a 404, and it no longer
|
|
306
|
+
* appears in search.
|
|
307
|
+
*
|
|
308
|
+
* With `variantReferenceId`, an intelligent field's delete is staged in that variant instead,
|
|
309
|
+
* and takes effect when the variant is committed. Until then the agent keeps using the field,
|
|
310
|
+
* and only a later patch or delete through the same variant is a 404.
|
|
311
|
+
*
|
|
312
|
+
* @param {MavenAGI.CapabilityType} capabilityType - Which kind of capability to delete.
|
|
313
|
+
* @param {string} referenceId - The capability's reference ID, unique within its type and app.
|
|
314
|
+
* @param {MavenAGI.DeleteCapabilityByTypeRequest} request
|
|
315
|
+
* @param {CapabilitiesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
316
|
+
*
|
|
317
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
318
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
319
|
+
* @throws {@link MavenAGI.PayloadTooLargeError}
|
|
320
|
+
* @throws {@link MavenAGI.TooManyRequestsError}
|
|
321
|
+
* @throws {@link MavenAGI.ServerError}
|
|
322
|
+
* @throws {@link errors.MavenAGIError}
|
|
323
|
+
* @throws {@link errors.MavenAGITimeoutError}
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* await client.capabilities.deleteCapability("ACTION", "referenceId")
|
|
327
|
+
*/
|
|
328
|
+
deleteCapability(capabilityType, referenceId, request = {}, requestOptions) {
|
|
329
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteCapability(capabilityType, referenceId, request, requestOptions));
|
|
330
|
+
}
|
|
331
|
+
__deleteCapability(capabilityType_1, referenceId_1) {
|
|
332
|
+
return __awaiter(this, arguments, void 0, function* (capabilityType, referenceId, request = {}, requestOptions) {
|
|
333
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
334
|
+
const { appId, variantReferenceId, variantAppId } = request;
|
|
335
|
+
const _queryParams = {
|
|
336
|
+
appId,
|
|
337
|
+
variantReferenceId,
|
|
338
|
+
variantAppId,
|
|
339
|
+
};
|
|
340
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
341
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
342
|
+
"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,
|
|
343
|
+
"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,
|
|
344
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
345
|
+
const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
|
|
346
|
+
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/capabilities/${core.url.encodePathParam(serializers.CapabilityType.jsonOrThrow(capabilityType))}/${core.url.encodePathParam(referenceId)}`),
|
|
347
|
+
method: "DELETE",
|
|
348
|
+
headers: _headers,
|
|
349
|
+
queryString: core.url
|
|
350
|
+
.queryBuilder()
|
|
351
|
+
.addMany(_queryParams)
|
|
352
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
353
|
+
.build(),
|
|
354
|
+
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,
|
|
355
|
+
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,
|
|
356
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
357
|
+
fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
|
|
358
|
+
logging: this._options.logging,
|
|
359
|
+
});
|
|
360
|
+
if (_response.ok) {
|
|
361
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
362
|
+
}
|
|
363
|
+
if (_response.error.reason === "status-code") {
|
|
364
|
+
switch (_response.error.statusCode) {
|
|
365
|
+
case 404:
|
|
366
|
+
throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
367
|
+
unrecognizedObjectKeys: "passthrough",
|
|
368
|
+
allowUnrecognizedUnionMembers: true,
|
|
369
|
+
allowUnrecognizedEnumValues: true,
|
|
370
|
+
breadcrumbsPrefix: ["response"],
|
|
371
|
+
}), _response.rawResponse);
|
|
372
|
+
case 400:
|
|
373
|
+
throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
374
|
+
unrecognizedObjectKeys: "passthrough",
|
|
375
|
+
allowUnrecognizedUnionMembers: true,
|
|
376
|
+
allowUnrecognizedEnumValues: true,
|
|
377
|
+
breadcrumbsPrefix: ["response"],
|
|
378
|
+
}), _response.rawResponse);
|
|
379
|
+
case 413:
|
|
380
|
+
throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
381
|
+
unrecognizedObjectKeys: "passthrough",
|
|
382
|
+
allowUnrecognizedUnionMembers: true,
|
|
383
|
+
allowUnrecognizedEnumValues: true,
|
|
384
|
+
breadcrumbsPrefix: ["response"],
|
|
385
|
+
}), _response.rawResponse);
|
|
386
|
+
case 429:
|
|
387
|
+
throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
388
|
+
unrecognizedObjectKeys: "passthrough",
|
|
389
|
+
allowUnrecognizedUnionMembers: true,
|
|
390
|
+
allowUnrecognizedEnumValues: true,
|
|
391
|
+
breadcrumbsPrefix: ["response"],
|
|
392
|
+
}), _response.rawResponse);
|
|
393
|
+
case 500:
|
|
394
|
+
throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
395
|
+
unrecognizedObjectKeys: "passthrough",
|
|
396
|
+
allowUnrecognizedUnionMembers: true,
|
|
397
|
+
allowUnrecognizedEnumValues: true,
|
|
398
|
+
breadcrumbsPrefix: ["response"],
|
|
399
|
+
}), _response.rawResponse);
|
|
400
|
+
default:
|
|
401
|
+
throw new errors.MavenAGIError({
|
|
402
|
+
statusCode: _response.error.statusCode,
|
|
403
|
+
body: _response.error.body,
|
|
404
|
+
rawResponse: _response.rawResponse,
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v1/capabilities/{capabilityType}/{referenceId}");
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Search an agent's capabilities of every kind at once, newest first by default.
|
|
413
|
+
*
|
|
414
|
+
* Returns the fields every capability shares. Fetch one by its type and reference ID for the
|
|
415
|
+
* settings particular to its kind.
|
|
416
|
+
*
|
|
417
|
+
* Sorting by `NAME` or `TYPE` instead orders ascending unless `sortDesc` says otherwise;
|
|
418
|
+
* `sortDesc` overrides the default either way.
|
|
419
|
+
*
|
|
420
|
+
* Deleted capabilities are never returned.
|
|
421
|
+
*
|
|
422
|
+
* @param {MavenAGI.CapabilitiesSearchRequest} request
|
|
423
|
+
* @param {CapabilitiesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
424
|
+
*
|
|
425
|
+
* @throws {@link MavenAGI.NotFoundError}
|
|
426
|
+
* @throws {@link MavenAGI.BadRequestError}
|
|
427
|
+
* @throws {@link MavenAGI.PayloadTooLargeError}
|
|
428
|
+
* @throws {@link MavenAGI.TooManyRequestsError}
|
|
429
|
+
* @throws {@link MavenAGI.ServerError}
|
|
430
|
+
* @throws {@link errors.MavenAGIError}
|
|
431
|
+
* @throws {@link errors.MavenAGITimeoutError}
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* await client.capabilities.searchCapabilities()
|
|
435
|
+
*/
|
|
436
|
+
searchCapabilities(request = {}, requestOptions) {
|
|
437
|
+
return core.HttpResponsePromise.fromPromise(this.__searchCapabilities(request, requestOptions));
|
|
438
|
+
}
|
|
439
|
+
__searchCapabilities() {
|
|
440
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
441
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
442
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
443
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
444
|
+
"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,
|
|
445
|
+
"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,
|
|
446
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
447
|
+
const _response = yield ((_f = this._options.fetcher) !== null && _f !== void 0 ? _f : core.fetcher)({
|
|
448
|
+
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/capabilities/search"),
|
|
449
|
+
method: "POST",
|
|
450
|
+
headers: _headers,
|
|
451
|
+
contentType: "application/json",
|
|
452
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
453
|
+
requestType: "json",
|
|
454
|
+
body: (0, requestBody_1.mergeAdditionalBodyParameters)(serializers.CapabilitiesSearchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
455
|
+
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,
|
|
456
|
+
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,
|
|
457
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
458
|
+
fetchFn: (_p = this._options) === null || _p === void 0 ? void 0 : _p.fetch,
|
|
459
|
+
logging: this._options.logging,
|
|
460
|
+
});
|
|
461
|
+
if (_response.ok) {
|
|
462
|
+
return {
|
|
463
|
+
data: serializers.CapabilitiesSearchResponse.parseOrThrow(_response.body, {
|
|
464
|
+
unrecognizedObjectKeys: "passthrough",
|
|
465
|
+
allowUnrecognizedUnionMembers: true,
|
|
466
|
+
allowUnrecognizedEnumValues: true,
|
|
467
|
+
breadcrumbsPrefix: ["response"],
|
|
468
|
+
}),
|
|
469
|
+
rawResponse: _response.rawResponse,
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
if (_response.error.reason === "status-code") {
|
|
473
|
+
switch (_response.error.statusCode) {
|
|
474
|
+
case 404:
|
|
475
|
+
throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
476
|
+
unrecognizedObjectKeys: "passthrough",
|
|
477
|
+
allowUnrecognizedUnionMembers: true,
|
|
478
|
+
allowUnrecognizedEnumValues: true,
|
|
479
|
+
breadcrumbsPrefix: ["response"],
|
|
480
|
+
}), _response.rawResponse);
|
|
481
|
+
case 400:
|
|
482
|
+
throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
483
|
+
unrecognizedObjectKeys: "passthrough",
|
|
484
|
+
allowUnrecognizedUnionMembers: true,
|
|
485
|
+
allowUnrecognizedEnumValues: true,
|
|
486
|
+
breadcrumbsPrefix: ["response"],
|
|
487
|
+
}), _response.rawResponse);
|
|
488
|
+
case 413:
|
|
489
|
+
throw new MavenAGI.PayloadTooLargeError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
490
|
+
unrecognizedObjectKeys: "passthrough",
|
|
491
|
+
allowUnrecognizedUnionMembers: true,
|
|
492
|
+
allowUnrecognizedEnumValues: true,
|
|
493
|
+
breadcrumbsPrefix: ["response"],
|
|
494
|
+
}), _response.rawResponse);
|
|
495
|
+
case 429:
|
|
496
|
+
throw new MavenAGI.TooManyRequestsError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
497
|
+
unrecognizedObjectKeys: "passthrough",
|
|
498
|
+
allowUnrecognizedUnionMembers: true,
|
|
499
|
+
allowUnrecognizedEnumValues: true,
|
|
500
|
+
breadcrumbsPrefix: ["response"],
|
|
501
|
+
}), _response.rawResponse);
|
|
502
|
+
case 500:
|
|
503
|
+
throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
504
|
+
unrecognizedObjectKeys: "passthrough",
|
|
505
|
+
allowUnrecognizedUnionMembers: true,
|
|
506
|
+
allowUnrecognizedEnumValues: true,
|
|
507
|
+
breadcrumbsPrefix: ["response"],
|
|
508
|
+
}), _response.rawResponse);
|
|
509
|
+
default:
|
|
510
|
+
throw new errors.MavenAGIError({
|
|
511
|
+
statusCode: _response.error.statusCode,
|
|
512
|
+
body: _response.error.body,
|
|
513
|
+
rawResponse: _response.rawResponse,
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/capabilities/search");
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
exports.CapabilitiesClient = CapabilitiesClient;
|
|
@@ -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);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type * as MavenAGI from "../../../../index";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface CapabilitiesSearchRequest extends MavenAGI.BaseCappedPaginatedRequest {
|
|
7
|
+
/** Only return capabilities of these kinds. Omit for every kind. */
|
|
8
|
+
capabilityTypes?: MavenAGI.CapabilityType[];
|
|
9
|
+
/**
|
|
10
|
+
* Only return capabilities the agent does or does not use. Deleted capabilities are
|
|
11
|
+
* never searchable, so `DELETED` is rejected here rather than matching nothing.
|
|
12
|
+
*/
|
|
13
|
+
statuses?: MavenAGI.CapabilityStatus[];
|
|
14
|
+
/** Only return capabilities owned by these apps. */
|
|
15
|
+
appIds?: string[];
|
|
16
|
+
/** Only return capabilities whose name matches this text. */
|
|
17
|
+
name?: string;
|
|
18
|
+
/** Only return capabilities whose description matches this text. */
|
|
19
|
+
description?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Only return capabilities that do or do not require user interaction. Only Actions
|
|
22
|
+
* can require it, so filtering on true returns Actions alone.
|
|
23
|
+
*/
|
|
24
|
+
userInteractionRequired?: boolean;
|
|
25
|
+
/** The field to sort by. Defaults to when the capability was created. */
|
|
26
|
+
sortId?: MavenAGI.CapabilitySortField;
|
|
27
|
+
/**
|
|
28
|
+
* The agent variant to read intelligent field versions through. Required on an agent
|
|
29
|
+
* with versioned intelligent fields unless `capabilityTypes` excludes them; a
|
|
30
|
+
* request that omits it there is rejected with reason `VARIANT_REQUIRED`. Otherwise,
|
|
31
|
+
* if omitted, the agent's only variant is used.
|
|
32
|
+
*/
|
|
33
|
+
variantReferenceId?: string;
|
|
34
|
+
/** The app that owns the agent variant. Defaults to the calling app. */
|
|
35
|
+
variantAppId?: string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {}
|
|
4
|
+
*/
|
|
5
|
+
export interface DeleteCapabilityByTypeRequest {
|
|
6
|
+
/** The app that owns the capability. Defaults to the calling app. */
|
|
7
|
+
appId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The agent variant to stage an intelligent field's delete in, by reference ID.
|
|
10
|
+
* Required for an intelligent field on an agent with versioned intelligent fields; a
|
|
11
|
+
* request that omits it there is rejected with reason `VARIANT_REQUIRED`.
|
|
12
|
+
* The other capability types aren't versioned and are the same in every variant,
|
|
13
|
+
* though a named variant must still exist.
|
|
14
|
+
*/
|
|
15
|
+
variantReferenceId?: string;
|
|
16
|
+
/** The app that owns the agent variant. Defaults to the calling app. */
|
|
17
|
+
variantAppId?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {}
|
|
4
|
+
*/
|
|
5
|
+
export interface GetCapabilityByTypeRequest {
|
|
6
|
+
/**
|
|
7
|
+
* The app that owns the capability. Defaults to the calling app, which is what an app
|
|
8
|
+
* managing its own capabilities wants.
|
|
9
|
+
*/
|
|
10
|
+
appId?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The agent variant to read an intelligent field through, by reference ID.
|
|
13
|
+
* Required for an intelligent field on an agent with versioned intelligent fields; a
|
|
14
|
+
* request that omits it there is rejected with reason `VARIANT_REQUIRED`. Otherwise,
|
|
15
|
+
* if omitted, the agent's only variant is used.
|
|
16
|
+
* The other capability types aren't versioned and are the same in every variant,
|
|
17
|
+
* though a named variant must still exist.
|
|
18
|
+
*/
|
|
19
|
+
variantReferenceId?: string;
|
|
20
|
+
/** The app that owns the agent variant. Defaults to the calling app. */
|
|
21
|
+
variantAppId?: string;
|
|
22
|
+
}
|