mavenagi 0.0.0-alpha.11 → 0.0.0-alpha.12
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/Client.d.ts +9 -0
- package/README.md +41 -4
- package/api/resources/actions/client/Client.d.ts +9 -0
- package/api/resources/actions/client/Client.js +18 -15
- package/api/resources/commons/types/EntityType.d.ts +2 -1
- package/api/resources/commons/types/EntityType.js +1 -0
- package/api/resources/commons/types/FeedbackBase.d.ts +10 -0
- package/api/resources/commons/types/index.d.ts +1 -1
- package/api/resources/commons/types/index.js +1 -1
- package/api/resources/conversation/client/Client.d.ts +18 -3
- package/api/resources/conversation/client/Client.js +71 -58
- package/api/resources/conversation/types/FeedbackRequest.d.ts +8 -1
- package/api/resources/knowledge/client/Client.d.ts +9 -0
- package/api/resources/knowledge/client/Client.js +44 -37
- package/api/resources/triggers/client/Client.d.ts +9 -0
- package/api/resources/triggers/client/Client.js +18 -15
- package/api/resources/users/client/Client.d.ts +9 -0
- package/api/resources/users/client/Client.js +13 -11
- package/core/fetcher/Fetcher.d.ts +4 -1
- package/core/fetcher/Fetcher.js +18 -159
- package/core/fetcher/createRequestUrl.d.ts +1 -0
- package/core/fetcher/createRequestUrl.js +6 -0
- package/core/fetcher/getFetchFn.d.ts +4 -0
- package/core/fetcher/getFetchFn.js +32 -0
- package/core/fetcher/getRequestBody.d.ts +7 -0
- package/core/fetcher/getRequestBody.js +19 -0
- package/core/fetcher/getResponseBody.d.ts +1 -0
- package/core/fetcher/getResponseBody.js +48 -0
- package/core/fetcher/makeRequest.d.ts +1 -0
- package/core/fetcher/makeRequest.js +38 -0
- package/core/fetcher/requestWithRetries.d.ts +1 -0
- package/core/fetcher/requestWithRetries.js +28 -0
- package/core/fetcher/signals.d.ts +12 -0
- package/core/fetcher/signals.js +32 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +222 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +104 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +204 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +17 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +23 -0
- package/core/runtime/runtime.d.ts +1 -0
- package/core/runtime/runtime.js +1 -0
- package/core/schemas/Schema.d.ts +7 -4
- package/core/schemas/builders/lazy/lazy.d.ts +2 -2
- package/core/schemas/builders/lazy/lazy.js +8 -19
- package/core/schemas/builders/lazy/lazyObject.js +1 -10
- package/core/schemas/builders/list/list.js +31 -44
- package/core/schemas/builders/object/object.js +90 -111
- package/core/schemas/builders/object/types.d.ts +2 -2
- package/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
- package/core/schemas/builders/record/record.js +49 -60
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
- package/core/schemas/builders/set/set.js +6 -15
- package/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
- package/core/schemas/builders/union/union.js +51 -62
- package/core/schemas/utils/maybeSkipValidation.js +3 -12
- package/dist/Client.d.ts +9 -0
- package/dist/api/resources/actions/client/Client.d.ts +9 -0
- package/dist/api/resources/actions/client/Client.js +18 -15
- package/dist/api/resources/commons/types/EntityType.d.ts +2 -1
- package/dist/api/resources/commons/types/EntityType.js +1 -0
- package/dist/api/resources/commons/types/FeedbackBase.d.ts +10 -0
- package/dist/api/resources/commons/types/index.d.ts +1 -1
- package/dist/api/resources/commons/types/index.js +1 -1
- package/dist/api/resources/conversation/client/Client.d.ts +18 -3
- package/dist/api/resources/conversation/client/Client.js +71 -58
- package/dist/api/resources/conversation/types/FeedbackRequest.d.ts +8 -1
- package/dist/api/resources/knowledge/client/Client.d.ts +9 -0
- package/dist/api/resources/knowledge/client/Client.js +44 -37
- package/dist/api/resources/triggers/client/Client.d.ts +9 -0
- package/dist/api/resources/triggers/client/Client.js +18 -15
- package/dist/api/resources/users/client/Client.d.ts +9 -0
- package/dist/api/resources/users/client/Client.js +13 -11
- package/dist/core/fetcher/Fetcher.d.ts +4 -1
- package/dist/core/fetcher/Fetcher.js +18 -159
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +6 -0
- package/dist/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/core/fetcher/getFetchFn.js +32 -0
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +19 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +48 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +38 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +28 -0
- package/dist/core/fetcher/signals.d.ts +12 -0
- package/dist/core/fetcher/signals.js +32 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +222 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +104 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +204 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +17 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +23 -0
- package/dist/core/runtime/runtime.d.ts +1 -0
- package/dist/core/runtime/runtime.js +1 -0
- package/dist/core/schemas/Schema.d.ts +7 -4
- package/dist/core/schemas/builders/lazy/lazy.d.ts +2 -2
- package/dist/core/schemas/builders/lazy/lazy.js +8 -19
- package/dist/core/schemas/builders/lazy/lazyObject.js +1 -10
- package/dist/core/schemas/builders/list/list.js +31 -44
- package/dist/core/schemas/builders/object/object.js +90 -111
- package/dist/core/schemas/builders/object/types.d.ts +2 -2
- package/dist/core/schemas/builders/object-like/getObjectLikeUtils.js +3 -12
- package/dist/core/schemas/builders/record/record.js +49 -60
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +2 -2
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +18 -21
- package/dist/core/schemas/builders/set/set.js +6 -15
- package/dist/core/schemas/builders/undiscriminated-union/undiscriminatedUnion.js +21 -32
- package/dist/core/schemas/builders/union/union.js +51 -62
- package/dist/core/schemas/utils/maybeSkipValidation.js +3 -12
- package/dist/serialization/resources/commons/types/EntityType.d.ts +1 -1
- package/dist/serialization/resources/commons/types/EntityType.js +1 -0
- package/{serialization/resources/commons/types/Feedback.d.ts → dist/serialization/resources/commons/types/FeedbackBase.d.ts} +2 -5
- package/{serialization/resources/commons/types/Feedback.js → dist/serialization/resources/commons/types/FeedbackBase.js} +1 -4
- package/dist/serialization/resources/commons/types/index.d.ts +1 -1
- package/dist/serialization/resources/commons/types/index.js +1 -1
- package/dist/serialization/resources/conversation/types/FeedbackRequest.d.ts +7 -2
- package/dist/serialization/resources/conversation/types/FeedbackRequest.js +10 -2
- package/package.json +7 -2
- package/reference.md +1723 -0
- package/serialization/resources/commons/types/EntityType.d.ts +1 -1
- package/serialization/resources/commons/types/EntityType.js +1 -0
- package/{dist/serialization/resources/commons/types/Feedback.d.ts → serialization/resources/commons/types/FeedbackBase.d.ts} +2 -5
- package/{dist/serialization/resources/commons/types/Feedback.js → serialization/resources/commons/types/FeedbackBase.js} +1 -4
- package/serialization/resources/commons/types/index.d.ts +1 -1
- package/serialization/resources/commons/types/index.js +1 -1
- package/serialization/resources/conversation/types/FeedbackRequest.d.ts +7 -2
- package/serialization/resources/conversation/types/FeedbackRequest.js +10 -2
- package/api/resources/commons/types/Feedback.d.ts +0 -16
- package/dist/api/resources/commons/types/Feedback.d.ts +0 -16
- /package/api/resources/commons/types/{Feedback.js → FeedbackBase.js} +0 -0
- /package/dist/api/resources/commons/types/{Feedback.js → FeedbackBase.js} +0 -0
package/Client.d.ts
CHANGED
|
@@ -13,14 +13,23 @@ export declare namespace MavenAGIClient {
|
|
|
13
13
|
environment?: core.Supplier<environments.MavenAGIEnvironment | string>;
|
|
14
14
|
appId?: core.Supplier<string | undefined>;
|
|
15
15
|
appSecret?: core.Supplier<string | undefined>;
|
|
16
|
+
/** Override the X-Organization-Id header */
|
|
16
17
|
organizationId: core.Supplier<string>;
|
|
18
|
+
/** Override the X-Agent-Id header */
|
|
17
19
|
agentId: core.Supplier<string>;
|
|
18
20
|
fetcher?: core.FetchFunction;
|
|
19
21
|
}
|
|
20
22
|
interface RequestOptions {
|
|
23
|
+
/** The maximum time to wait for a response in seconds. */
|
|
21
24
|
timeoutInSeconds?: number;
|
|
25
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
22
26
|
maxRetries?: number;
|
|
27
|
+
/** A hook to abort the request. */
|
|
23
28
|
abortSignal?: AbortSignal;
|
|
29
|
+
/** Override the X-Organization-Id header */
|
|
30
|
+
organizationId?: string;
|
|
31
|
+
/** Override the X-Agent-Id header */
|
|
32
|
+
agentId?: string;
|
|
24
33
|
}
|
|
25
34
|
}
|
|
26
35
|
export declare class MavenAGIClient {
|
package/README.md
CHANGED
|
@@ -16,7 +16,6 @@ npm i -s mavenagi
|
|
|
16
16
|
Instantiate and use the client with the following:
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
|
-
import * as environments from "../src/environments";
|
|
20
19
|
import { MavenAGIClient, MavenAGI } from "mavenagi";
|
|
21
20
|
|
|
22
21
|
const client = new MavenAGIClient({
|
|
@@ -48,7 +47,7 @@ will be thrown.
|
|
|
48
47
|
import { MavenAGIError } from "mavenagi";
|
|
49
48
|
|
|
50
49
|
try {
|
|
51
|
-
await client.initialize(...);
|
|
50
|
+
await client.conversation.initialize(...);
|
|
52
51
|
} catch (err) {
|
|
53
52
|
if (err instanceof MavenAGIError) {
|
|
54
53
|
console.log(err.statusCode);
|
|
@@ -113,7 +112,7 @@ A request is deemed retriable when any of the following HTTP status codes is ret
|
|
|
113
112
|
Use the `maxRetries` request option to configure this behavior.
|
|
114
113
|
|
|
115
114
|
```typescript
|
|
116
|
-
const response = await client.initialize(..., {
|
|
115
|
+
const response = await client.conversation.initialize(..., {
|
|
117
116
|
maxRetries: 0 // override maxRetries at the request level
|
|
118
117
|
});
|
|
119
118
|
```
|
|
@@ -123,11 +122,49 @@ const response = await client.initialize(..., {
|
|
|
123
122
|
The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
|
|
124
123
|
|
|
125
124
|
```typescript
|
|
126
|
-
const response = await client.initialize(..., {
|
|
125
|
+
const response = await client.conversation.initialize(..., {
|
|
127
126
|
timeoutInSeconds: 30 // override timeout to 30s
|
|
128
127
|
});
|
|
129
128
|
```
|
|
130
129
|
|
|
130
|
+
### Aborting Requests
|
|
131
|
+
|
|
132
|
+
The SDK allows users to abort requests at any point by passing in an abort signal.
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
const controller = new AbortController();
|
|
136
|
+
const response = await client.conversation.initialize(..., {
|
|
137
|
+
abortSignal: controller.signal
|
|
138
|
+
});
|
|
139
|
+
controller.abort(); // aborts the request
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Runtime Compatibility
|
|
143
|
+
|
|
144
|
+
The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following
|
|
145
|
+
runtimes:
|
|
146
|
+
|
|
147
|
+
- Node.js 18+
|
|
148
|
+
- Vercel
|
|
149
|
+
- Cloudflare Workers
|
|
150
|
+
- Deno v1.25+
|
|
151
|
+
- Bun 1.0+
|
|
152
|
+
- React Native
|
|
153
|
+
|
|
154
|
+
### Customizing Fetch Client
|
|
155
|
+
|
|
156
|
+
The SDK provides a way for your to customize the underlying HTTP client / Fetch function. If you're running in an
|
|
157
|
+
unsupported environment, this provides a way for you to break glass and ensure the SDK works.
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import { MavenAGIClient } from "mavenagi";
|
|
161
|
+
|
|
162
|
+
const client = new MavenAGIClient({
|
|
163
|
+
...
|
|
164
|
+
fetcher: // provide your implementation here
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
131
168
|
## Contributing
|
|
132
169
|
|
|
133
170
|
While we value open-source contributions to this SDK, this library is generated programmatically.
|
|
@@ -9,14 +9,23 @@ export declare namespace Actions {
|
|
|
9
9
|
environment?: core.Supplier<environments.MavenAGIEnvironment | string>;
|
|
10
10
|
appId?: core.Supplier<string | undefined>;
|
|
11
11
|
appSecret?: core.Supplier<string | undefined>;
|
|
12
|
+
/** Override the X-Organization-Id header */
|
|
12
13
|
organizationId: core.Supplier<string>;
|
|
14
|
+
/** Override the X-Agent-Id header */
|
|
13
15
|
agentId: core.Supplier<string>;
|
|
14
16
|
fetcher?: core.FetchFunction;
|
|
15
17
|
}
|
|
16
18
|
interface RequestOptions {
|
|
19
|
+
/** The maximum time to wait for a response in seconds. */
|
|
17
20
|
timeoutInSeconds?: number;
|
|
21
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
18
22
|
maxRetries?: number;
|
|
23
|
+
/** A hook to abort the request. */
|
|
19
24
|
abortSignal?: AbortSignal;
|
|
25
|
+
/** Override the X-Organization-Id header */
|
|
26
|
+
organizationId?: string;
|
|
27
|
+
/** Override the X-Agent-Id header */
|
|
28
|
+
agentId?: string;
|
|
20
29
|
}
|
|
21
30
|
}
|
|
22
31
|
export declare class Actions {
|
|
@@ -56,18 +56,19 @@ export class Actions {
|
|
|
56
56
|
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
57
57
|
"X-Fern-Language": "JavaScript",
|
|
58
58
|
"X-Fern-SDK-Name": "mavenagi",
|
|
59
|
-
"X-Fern-SDK-Version": "0.0.0-alpha.
|
|
59
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.12",
|
|
60
60
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
61
61
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
62
62
|
},
|
|
63
63
|
contentType: "application/json",
|
|
64
|
-
|
|
64
|
+
requestType: "json",
|
|
65
|
+
body: serializers.ActionRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
65
66
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
66
67
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
67
68
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
68
69
|
});
|
|
69
70
|
if (_response.ok) {
|
|
70
|
-
return
|
|
71
|
+
return serializers.ActionResponse.parseOrThrow(_response.body, {
|
|
71
72
|
unrecognizedObjectKeys: "passthrough",
|
|
72
73
|
allowUnrecognizedUnionMembers: true,
|
|
73
74
|
allowUnrecognizedEnumValues: true,
|
|
@@ -77,21 +78,21 @@ export class Actions {
|
|
|
77
78
|
if (_response.error.reason === "status-code") {
|
|
78
79
|
switch (_response.error.statusCode) {
|
|
79
80
|
case 404:
|
|
80
|
-
throw new MavenAGI.NotFoundError(
|
|
81
|
+
throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
81
82
|
unrecognizedObjectKeys: "passthrough",
|
|
82
83
|
allowUnrecognizedUnionMembers: true,
|
|
83
84
|
allowUnrecognizedEnumValues: true,
|
|
84
85
|
breadcrumbsPrefix: ["response"],
|
|
85
86
|
}));
|
|
86
87
|
case 400:
|
|
87
|
-
throw new MavenAGI.BadRequestError(
|
|
88
|
+
throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
88
89
|
unrecognizedObjectKeys: "passthrough",
|
|
89
90
|
allowUnrecognizedUnionMembers: true,
|
|
90
91
|
allowUnrecognizedEnumValues: true,
|
|
91
92
|
breadcrumbsPrefix: ["response"],
|
|
92
93
|
}));
|
|
93
94
|
case 500:
|
|
94
|
-
throw new MavenAGI.ServerError(
|
|
95
|
+
throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
95
96
|
unrecognizedObjectKeys: "passthrough",
|
|
96
97
|
allowUnrecognizedUnionMembers: true,
|
|
97
98
|
allowUnrecognizedEnumValues: true,
|
|
@@ -144,17 +145,18 @@ export class Actions {
|
|
|
144
145
|
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
145
146
|
"X-Fern-Language": "JavaScript",
|
|
146
147
|
"X-Fern-SDK-Name": "mavenagi",
|
|
147
|
-
"X-Fern-SDK-Version": "0.0.0-alpha.
|
|
148
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.12",
|
|
148
149
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
149
150
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
150
151
|
},
|
|
151
152
|
contentType: "application/json",
|
|
153
|
+
requestType: "json",
|
|
152
154
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
153
155
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
154
156
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
155
157
|
});
|
|
156
158
|
if (_response.ok) {
|
|
157
|
-
return
|
|
159
|
+
return serializers.ActionResponse.parseOrThrow(_response.body, {
|
|
158
160
|
unrecognizedObjectKeys: "passthrough",
|
|
159
161
|
allowUnrecognizedUnionMembers: true,
|
|
160
162
|
allowUnrecognizedEnumValues: true,
|
|
@@ -164,21 +166,21 @@ export class Actions {
|
|
|
164
166
|
if (_response.error.reason === "status-code") {
|
|
165
167
|
switch (_response.error.statusCode) {
|
|
166
168
|
case 404:
|
|
167
|
-
throw new MavenAGI.NotFoundError(
|
|
169
|
+
throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
168
170
|
unrecognizedObjectKeys: "passthrough",
|
|
169
171
|
allowUnrecognizedUnionMembers: true,
|
|
170
172
|
allowUnrecognizedEnumValues: true,
|
|
171
173
|
breadcrumbsPrefix: ["response"],
|
|
172
174
|
}));
|
|
173
175
|
case 400:
|
|
174
|
-
throw new MavenAGI.BadRequestError(
|
|
176
|
+
throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
175
177
|
unrecognizedObjectKeys: "passthrough",
|
|
176
178
|
allowUnrecognizedUnionMembers: true,
|
|
177
179
|
allowUnrecognizedEnumValues: true,
|
|
178
180
|
breadcrumbsPrefix: ["response"],
|
|
179
181
|
}));
|
|
180
182
|
case 500:
|
|
181
|
-
throw new MavenAGI.ServerError(
|
|
183
|
+
throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
182
184
|
unrecognizedObjectKeys: "passthrough",
|
|
183
185
|
allowUnrecognizedUnionMembers: true,
|
|
184
186
|
allowUnrecognizedEnumValues: true,
|
|
@@ -231,11 +233,12 @@ export class Actions {
|
|
|
231
233
|
"X-Agent-Id": yield core.Supplier.get(this._options.agentId),
|
|
232
234
|
"X-Fern-Language": "JavaScript",
|
|
233
235
|
"X-Fern-SDK-Name": "mavenagi",
|
|
234
|
-
"X-Fern-SDK-Version": "0.0.0-alpha.
|
|
236
|
+
"X-Fern-SDK-Version": "0.0.0-alpha.12",
|
|
235
237
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
236
238
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
237
239
|
},
|
|
238
240
|
contentType: "application/json",
|
|
241
|
+
requestType: "json",
|
|
239
242
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
240
243
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
241
244
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -246,21 +249,21 @@ export class Actions {
|
|
|
246
249
|
if (_response.error.reason === "status-code") {
|
|
247
250
|
switch (_response.error.statusCode) {
|
|
248
251
|
case 404:
|
|
249
|
-
throw new MavenAGI.NotFoundError(
|
|
252
|
+
throw new MavenAGI.NotFoundError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
250
253
|
unrecognizedObjectKeys: "passthrough",
|
|
251
254
|
allowUnrecognizedUnionMembers: true,
|
|
252
255
|
allowUnrecognizedEnumValues: true,
|
|
253
256
|
breadcrumbsPrefix: ["response"],
|
|
254
257
|
}));
|
|
255
258
|
case 400:
|
|
256
|
-
throw new MavenAGI.BadRequestError(
|
|
259
|
+
throw new MavenAGI.BadRequestError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
257
260
|
unrecognizedObjectKeys: "passthrough",
|
|
258
261
|
allowUnrecognizedUnionMembers: true,
|
|
259
262
|
allowUnrecognizedEnumValues: true,
|
|
260
263
|
breadcrumbsPrefix: ["response"],
|
|
261
264
|
}));
|
|
262
265
|
case 500:
|
|
263
|
-
throw new MavenAGI.ServerError(
|
|
266
|
+
throw new MavenAGI.ServerError(serializers.ErrorMessage.parseOrThrow(_response.error.body, {
|
|
264
267
|
unrecognizedObjectKeys: "passthrough",
|
|
265
268
|
allowUnrecognizedUnionMembers: true,
|
|
266
269
|
allowUnrecognizedEnumValues: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
export declare type EntityType = "CONVERSATION" | "CONVERSATION_MESSAGE" | "KNOWLEDGE_BASE" | "KNOWLEDGE_DOCUMENT" | "ACTION" | "USER" | "USER_EVENT" | "EVENT_TRIGGER" | "USER_PROFILE";
|
|
4
|
+
export declare type EntityType = "CONVERSATION" | "CONVERSATION_MESSAGE" | "KNOWLEDGE_BASE" | "KNOWLEDGE_DOCUMENT" | "ACTION" | "USER" | "USER_EVENT" | "EVENT_TRIGGER" | "USER_PROFILE" | "FEEDBACK";
|
|
5
5
|
export declare const EntityType: {
|
|
6
6
|
readonly Conversation: "CONVERSATION";
|
|
7
7
|
readonly ConversationMessage: "CONVERSATION_MESSAGE";
|
|
@@ -12,4 +12,5 @@ export declare const EntityType: {
|
|
|
12
12
|
readonly UserEvent: "USER_EVENT";
|
|
13
13
|
readonly EventTrigger: "EVENT_TRIGGER";
|
|
14
14
|
readonly UserProfile: "USER_PROFILE";
|
|
15
|
+
readonly Feedback: "FEEDBACK";
|
|
15
16
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as MavenAGI from "../../../index";
|
|
5
|
+
export interface FeedbackBase {
|
|
6
|
+
/** The type of feedback */
|
|
7
|
+
type: MavenAGI.FeedbackType;
|
|
8
|
+
/** The feedback text */
|
|
9
|
+
text?: string;
|
|
10
|
+
}
|
|
@@ -3,8 +3,8 @@ export * from "./EntityType";
|
|
|
3
3
|
export * from "./EntityIdBase";
|
|
4
4
|
export * from "./EntityId";
|
|
5
5
|
export * from "./User";
|
|
6
|
+
export * from "./FeedbackBase";
|
|
6
7
|
export * from "./FeedbackType";
|
|
7
|
-
export * from "./Feedback";
|
|
8
8
|
export * from "./AppUserIdentification";
|
|
9
9
|
export * from "./AppUserIdentifier";
|
|
10
10
|
export * from "./AppUserIdentifyingPropertyType";
|
|
@@ -3,8 +3,8 @@ export * from "./EntityType";
|
|
|
3
3
|
export * from "./EntityIdBase";
|
|
4
4
|
export * from "./EntityId";
|
|
5
5
|
export * from "./User";
|
|
6
|
+
export * from "./FeedbackBase";
|
|
6
7
|
export * from "./FeedbackType";
|
|
7
|
-
export * from "./Feedback";
|
|
8
8
|
export * from "./AppUserIdentification";
|
|
9
9
|
export * from "./AppUserIdentifier";
|
|
10
10
|
export * from "./AppUserIdentifyingPropertyType";
|
|
@@ -9,14 +9,23 @@ export declare namespace Conversation {
|
|
|
9
9
|
environment?: core.Supplier<environments.MavenAGIEnvironment | string>;
|
|
10
10
|
appId?: core.Supplier<string | undefined>;
|
|
11
11
|
appSecret?: core.Supplier<string | undefined>;
|
|
12
|
+
/** Override the X-Organization-Id header */
|
|
12
13
|
organizationId: core.Supplier<string>;
|
|
14
|
+
/** Override the X-Agent-Id header */
|
|
13
15
|
agentId: core.Supplier<string>;
|
|
14
16
|
fetcher?: core.FetchFunction;
|
|
15
17
|
}
|
|
16
18
|
interface RequestOptions {
|
|
19
|
+
/** The maximum time to wait for a response in seconds. */
|
|
17
20
|
timeoutInSeconds?: number;
|
|
21
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
18
22
|
maxRetries?: number;
|
|
23
|
+
/** A hook to abort the request. */
|
|
19
24
|
abortSignal?: AbortSignal;
|
|
25
|
+
/** Override the X-Organization-Id header */
|
|
26
|
+
organizationId?: string;
|
|
27
|
+
/** Override the X-Agent-Id header */
|
|
28
|
+
agentId?: string;
|
|
20
29
|
}
|
|
21
30
|
}
|
|
22
31
|
export declare class Conversation {
|
|
@@ -140,9 +149,15 @@ export declare class Conversation {
|
|
|
140
149
|
*
|
|
141
150
|
* @example
|
|
142
151
|
* await client.conversation.createFeedback({
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
152
|
+
* feedbackId: {
|
|
153
|
+
* referenceId: "string"
|
|
154
|
+
* },
|
|
155
|
+
* conversationId: {
|
|
156
|
+
* referenceId: "string"
|
|
157
|
+
* },
|
|
158
|
+
* conversationMessageId: {
|
|
159
|
+
* referenceId: "string"
|
|
160
|
+
* },
|
|
146
161
|
* type: MavenAGI.FeedbackType.ThumbsUp,
|
|
147
162
|
* text: "string"
|
|
148
163
|
* })
|