@aui.io/aui-client 3.1.2 → 3.2.1
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/README.md +226 -143
- package/dist/cjs/ApolloClientWrapper.d.ts +54 -26
- package/dist/cjs/ApolloClientWrapper.js +88 -64
- package/dist/cjs/BaseClient.d.ts +5 -0
- package/dist/cjs/Client.d.ts +4 -1
- package/dist/cjs/Client.js +24 -9
- package/dist/cjs/api/resources/agentVersions/client/Client.d.ts +26 -2
- package/dist/cjs/api/resources/agentVersions/client/Client.js +96 -43
- package/dist/cjs/api/resources/agentVersions/client/requests/AgentVersionPushRequest.d.ts +1 -1
- package/dist/cjs/api/resources/agents/client/Client.d.ts +22 -7
- package/dist/cjs/api/resources/agents/client/Client.js +80 -39
- package/dist/cjs/api/resources/agents/client/requests/{ExternalAgentCreateRequest.d.ts → AgentCreateRequest.d.ts} +1 -1
- package/dist/{esm/api/resources/agents/client/requests/ExternalAgentUpdateRequest.d.mts → cjs/api/resources/agents/client/requests/AgentUpdateRequest.d.ts} +1 -1
- package/dist/cjs/api/resources/agents/client/requests/ListAgentsRequest.d.ts +1 -1
- package/dist/cjs/api/resources/agents/client/requests/index.d.ts +2 -2
- package/dist/cjs/api/resources/auth/client/Client.d.ts +3 -2
- package/dist/cjs/api/resources/auth/client/Client.js +20 -8
- package/dist/cjs/api/resources/channels/client/Client.d.ts +7 -6
- package/dist/cjs/api/resources/channels/client/Client.js +24 -12
- package/dist/cjs/api/resources/channels/client/requests/InitiateThreadRequest.d.ts +3 -10
- package/dist/cjs/api/resources/messaging/client/Client.d.ts +51 -14
- package/dist/cjs/api/resources/messaging/client/Client.js +249 -50
- package/dist/cjs/api/resources/messaging/client/requests/GenerateFollowupSuggestionsRequest.d.ts +9 -0
- package/dist/cjs/api/resources/messaging/client/requests/RerunMessageRequest.d.ts +2 -2
- package/dist/cjs/api/resources/messaging/client/requests/StreamMessageRequest.d.ts +0 -1
- package/dist/cjs/api/resources/messaging/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/projects/client/Client.d.ts +14 -2
- package/dist/cjs/api/resources/projects/client/Client.js +66 -31
- package/dist/cjs/api/resources/session/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/session/client/Client.js +12 -2
- package/dist/cjs/api/resources/threads/client/Client.d.ts +37 -2
- package/dist/cjs/api/resources/threads/client/Client.js +155 -31
- package/dist/cjs/api/resources/threads/client/requests/UpdateThreadRequest.d.ts +8 -0
- package/dist/cjs/api/resources/threads/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/{ExternalAgent.d.ts → Agent.d.ts} +1 -1
- package/dist/cjs/api/types/{ExternalAgentCreateResponse.d.ts → AgentCreateResponse.d.ts} +1 -1
- package/dist/cjs/api/types/{ExternalAgentListFilters.d.ts → AgentListFilters.d.ts} +1 -1
- package/dist/{esm/api/types/ExternalAgentUpdateResponse.d.mts → cjs/api/types/AgentUpdateResponse.d.ts} +1 -1
- package/dist/cjs/api/types/AgentVariables.d.ts +12 -0
- package/dist/cjs/api/types/AgentVersionPullResponse.d.ts +2 -3
- package/dist/cjs/api/types/AgentVersionPushResponse.d.ts +1 -1
- package/dist/cjs/api/types/AgentVersionWelcomeMessageResponse.d.ts +6 -0
- package/dist/cjs/api/types/GenerateFollowupSuggestionsResponse.d.ts +4 -0
- package/dist/cjs/api/types/PageAgent.d.ts +6 -0
- package/dist/cjs/api/types/PageAgentVersion.d.ts +6 -0
- package/dist/cjs/api/types/PageAgentVersion.js +3 -0
- package/dist/cjs/api/types/{ExternalPageLinks.d.ts → PageLinks.d.ts} +1 -1
- package/dist/cjs/api/types/PageLinks.js +3 -0
- package/dist/cjs/api/types/{ExternalPageMeta.d.ts → PageMeta.d.ts} +1 -1
- package/dist/cjs/api/types/PageMeta.js +3 -0
- package/dist/cjs/api/types/PageProject.d.ts +6 -0
- package/dist/cjs/api/types/PageProject.js +3 -0
- package/dist/cjs/api/types/PageThreadListItem.d.ts +6 -0
- package/dist/cjs/api/types/PageThreadListItem.js +3 -0
- package/dist/cjs/api/types/Project.d.ts +1 -1
- package/dist/cjs/api/types/SendMessageRequest.d.ts +7 -5
- package/dist/cjs/api/types/ThreadListFilters.d.ts +2 -5
- package/dist/cjs/api/types/TokenResponse.d.ts +4 -8
- package/dist/cjs/api/types/TraceDecision.d.ts +1 -2
- package/dist/cjs/api/types/VersionStats.d.ts +1 -2
- package/dist/cjs/api/types/index.d.ts +13 -10
- package/dist/cjs/api/types/index.js +13 -10
- package/dist/cjs/core/auth/AuthProvider.d.ts +4 -0
- package/dist/cjs/core/auth/AuthProvider.js +2 -0
- package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
- package/dist/cjs/core/auth/AuthRequest.js +2 -0
- package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
- package/dist/cjs/core/auth/BasicAuth.js +27 -0
- package/dist/cjs/core/auth/BearerToken.d.ts +5 -0
- package/dist/cjs/core/auth/BearerToken.js +15 -0
- package/dist/cjs/core/auth/index.d.ts +4 -0
- package/dist/cjs/core/auth/index.js +7 -0
- package/dist/cjs/core/base64.d.ts +2 -0
- package/dist/cjs/core/base64.js +26 -0
- package/dist/cjs/core/index.d.ts +2 -0
- package/dist/cjs/core/index.js +2 -0
- package/dist/cjs/environments.d.ts +2 -2
- package/dist/cjs/environments.js +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +3 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/ApolloClientWrapper.d.mts +54 -26
- package/dist/esm/ApolloClientWrapper.mjs +85 -62
- package/dist/esm/BaseClient.d.mts +5 -0
- package/dist/esm/Client.d.mts +4 -1
- package/dist/esm/Client.mjs +25 -10
- package/dist/esm/api/resources/agentVersions/client/Client.d.mts +26 -2
- package/dist/esm/api/resources/agentVersions/client/Client.mjs +97 -44
- package/dist/esm/api/resources/agentVersions/client/requests/AgentVersionPushRequest.d.mts +1 -1
- package/dist/esm/api/resources/agents/client/Client.d.mts +22 -7
- package/dist/esm/api/resources/agents/client/Client.mjs +81 -40
- package/dist/esm/api/resources/agents/client/requests/{ExternalAgentCreateRequest.d.mts → AgentCreateRequest.d.mts} +1 -1
- package/dist/{cjs/api/resources/agents/client/requests/ExternalAgentUpdateRequest.d.ts → esm/api/resources/agents/client/requests/AgentUpdateRequest.d.mts} +1 -1
- package/dist/esm/api/resources/agents/client/requests/ListAgentsRequest.d.mts +1 -1
- package/dist/esm/api/resources/agents/client/requests/index.d.mts +2 -2
- package/dist/esm/api/resources/auth/client/Client.d.mts +3 -2
- package/dist/esm/api/resources/auth/client/Client.mjs +21 -9
- package/dist/esm/api/resources/channels/client/Client.d.mts +7 -6
- package/dist/esm/api/resources/channels/client/Client.mjs +25 -13
- package/dist/esm/api/resources/channels/client/requests/InitiateThreadRequest.d.mts +3 -10
- package/dist/esm/api/resources/messaging/client/Client.d.mts +51 -14
- package/dist/esm/api/resources/messaging/client/Client.mjs +249 -50
- package/dist/esm/api/resources/messaging/client/requests/GenerateFollowupSuggestionsRequest.d.mts +9 -0
- package/dist/esm/api/resources/messaging/client/requests/RerunMessageRequest.d.mts +2 -2
- package/dist/esm/api/resources/messaging/client/requests/StreamMessageRequest.d.mts +0 -1
- package/dist/esm/api/resources/messaging/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/projects/client/Client.d.mts +14 -2
- package/dist/esm/api/resources/projects/client/Client.mjs +67 -32
- package/dist/esm/api/resources/session/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/session/client/Client.mjs +12 -2
- package/dist/esm/api/resources/threads/client/Client.d.mts +37 -2
- package/dist/esm/api/resources/threads/client/Client.mjs +156 -32
- package/dist/esm/api/resources/threads/client/requests/UpdateThreadRequest.d.mts +8 -0
- package/dist/esm/api/resources/threads/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/{ExternalAgent.d.mts → Agent.d.mts} +1 -1
- package/dist/esm/api/types/{ExternalAgentCreateResponse.d.mts → AgentCreateResponse.d.mts} +1 -1
- package/dist/esm/api/types/{ExternalAgentListFilters.d.mts → AgentListFilters.d.mts} +1 -1
- package/dist/{cjs/api/types/ExternalAgentUpdateResponse.d.ts → esm/api/types/AgentUpdateResponse.d.mts} +1 -1
- package/dist/esm/api/types/AgentVariables.d.mts +12 -0
- package/dist/esm/api/types/AgentVersionPullResponse.d.mts +2 -3
- package/dist/esm/api/types/AgentVersionPushResponse.d.mts +1 -1
- package/dist/esm/api/types/AgentVersionWelcomeMessageResponse.d.mts +6 -0
- package/dist/esm/api/types/GenerateFollowupSuggestionsResponse.d.mts +4 -0
- package/dist/esm/api/types/PageAgent.d.mts +6 -0
- package/dist/esm/api/types/PageAgentVersion.d.mts +6 -0
- package/dist/esm/api/types/PageAgentVersion.mjs +2 -0
- package/dist/esm/api/types/{ExternalPageLinks.d.mts → PageLinks.d.mts} +1 -1
- package/dist/esm/api/types/PageLinks.mjs +2 -0
- package/dist/esm/api/types/{ExternalPageMeta.d.mts → PageMeta.d.mts} +1 -1
- package/dist/esm/api/types/PageMeta.mjs +2 -0
- package/dist/esm/api/types/PageProject.d.mts +6 -0
- package/dist/esm/api/types/PageProject.mjs +2 -0
- package/dist/esm/api/types/PageThreadListItem.d.mts +6 -0
- package/dist/esm/api/types/PageThreadListItem.mjs +2 -0
- package/dist/esm/api/types/Project.d.mts +1 -1
- package/dist/esm/api/types/SendMessageRequest.d.mts +7 -5
- package/dist/esm/api/types/ThreadListFilters.d.mts +2 -5
- package/dist/esm/api/types/TokenResponse.d.mts +4 -8
- package/dist/esm/api/types/TraceDecision.d.mts +1 -2
- package/dist/esm/api/types/VersionStats.d.mts +1 -2
- package/dist/esm/api/types/index.d.mts +13 -10
- package/dist/esm/api/types/index.mjs +13 -10
- package/dist/esm/core/auth/AuthProvider.d.mts +4 -0
- package/dist/esm/core/auth/AuthProvider.mjs +1 -0
- package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
- package/dist/esm/core/auth/AuthRequest.mjs +1 -0
- package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
- package/dist/esm/core/auth/BasicAuth.mjs +24 -0
- package/dist/esm/core/auth/BearerToken.d.mts +5 -0
- package/dist/esm/core/auth/BearerToken.mjs +12 -0
- package/dist/esm/core/auth/index.d.mts +4 -0
- package/dist/esm/core/auth/index.mjs +2 -0
- package/dist/esm/core/base64.d.mts +2 -0
- package/dist/esm/core/base64.mjs +22 -0
- package/dist/esm/core/index.d.mts +2 -0
- package/dist/esm/core/index.mjs +2 -0
- package/dist/esm/environments.d.mts +2 -2
- package/dist/esm/environments.mjs +2 -2
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +568 -29
- package/dist/cjs/api/types/ExternalPageAgentVersion.d.ts +0 -6
- package/dist/cjs/api/types/ExternalPageExternalAgent.d.ts +0 -6
- package/dist/cjs/api/types/ExternalPageProject.d.ts +0 -6
- package/dist/cjs/api/types/ExternalPageThreadListItem.d.ts +0 -6
- package/dist/esm/api/types/ExternalPageAgentVersion.d.mts +0 -6
- package/dist/esm/api/types/ExternalPageExternalAgent.d.mts +0 -6
- package/dist/esm/api/types/ExternalPageProject.d.mts +0 -6
- package/dist/esm/api/types/ExternalPageThreadListItem.d.mts +0 -6
- /package/dist/cjs/api/resources/agents/client/requests/{ExternalAgentCreateRequest.js → AgentCreateRequest.js} +0 -0
- /package/dist/cjs/api/resources/agents/client/requests/{ExternalAgentUpdateRequest.js → AgentUpdateRequest.js} +0 -0
- /package/dist/cjs/api/{types/ExternalAgent.js → resources/messaging/client/requests/GenerateFollowupSuggestionsRequest.js} +0 -0
- /package/dist/cjs/api/{types/ExternalAgentCreateResponse.js → resources/threads/client/requests/UpdateThreadRequest.js} +0 -0
- /package/dist/cjs/api/types/{ExternalAgentListFilters.js → Agent.js} +0 -0
- /package/dist/cjs/api/types/{ExternalAgentUpdateResponse.js → AgentCreateResponse.js} +0 -0
- /package/dist/cjs/api/types/{ExternalPageAgentVersion.js → AgentListFilters.js} +0 -0
- /package/dist/cjs/api/types/{ExternalPageExternalAgent.js → AgentUpdateResponse.js} +0 -0
- /package/dist/cjs/api/types/{ExternalPageLinks.js → AgentVariables.js} +0 -0
- /package/dist/cjs/api/types/{ExternalPageMeta.js → AgentVersionWelcomeMessageResponse.js} +0 -0
- /package/dist/cjs/api/types/{ExternalPageProject.js → GenerateFollowupSuggestionsResponse.js} +0 -0
- /package/dist/cjs/api/types/{ExternalPageThreadListItem.js → PageAgent.js} +0 -0
- /package/dist/esm/api/resources/agents/client/requests/{ExternalAgentCreateRequest.mjs → AgentCreateRequest.mjs} +0 -0
- /package/dist/esm/api/resources/agents/client/requests/{ExternalAgentUpdateRequest.mjs → AgentUpdateRequest.mjs} +0 -0
- /package/dist/esm/api/{types/ExternalAgent.mjs → resources/messaging/client/requests/GenerateFollowupSuggestionsRequest.mjs} +0 -0
- /package/dist/esm/api/{types/ExternalAgentCreateResponse.mjs → resources/threads/client/requests/UpdateThreadRequest.mjs} +0 -0
- /package/dist/esm/api/types/{ExternalAgentListFilters.mjs → Agent.mjs} +0 -0
- /package/dist/esm/api/types/{ExternalAgentUpdateResponse.mjs → AgentCreateResponse.mjs} +0 -0
- /package/dist/esm/api/types/{ExternalPageAgentVersion.mjs → AgentListFilters.mjs} +0 -0
- /package/dist/esm/api/types/{ExternalPageExternalAgent.mjs → AgentUpdateResponse.mjs} +0 -0
- /package/dist/esm/api/types/{ExternalPageLinks.mjs → AgentVariables.mjs} +0 -0
- /package/dist/esm/api/types/{ExternalPageMeta.mjs → AgentVersionWelcomeMessageResponse.mjs} +0 -0
- /package/dist/esm/api/types/{ExternalPageProject.mjs → GenerateFollowupSuggestionsResponse.mjs} +0 -0
- /package/dist/esm/api/types/{ExternalPageThreadListItem.mjs → PageAgent.mjs} +0 -0
|
@@ -9,7 +9,7 @@ export declare namespace Messaging {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class Messaging {
|
|
11
11
|
protected readonly _options: Messaging.Options;
|
|
12
|
-
constructor(_options
|
|
12
|
+
constructor(_options: Messaging.Options);
|
|
13
13
|
/**
|
|
14
14
|
* Send a message; auto-create the thread when ``thread_id`` is omitted. For a live
|
|
15
15
|
* token stream use ``POST /messages/stream`` (SSE). The resolved thread id is
|
|
@@ -28,7 +28,6 @@ export declare class Messaging {
|
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* await client.messaging.sendMessage({
|
|
31
|
-
* agent_id: "agent_id",
|
|
32
31
|
* text: "text",
|
|
33
32
|
* user_id: "user_id"
|
|
34
33
|
* })
|
|
@@ -36,19 +35,18 @@ export declare class Messaging {
|
|
|
36
35
|
sendMessage(request: Apollo.SendMessageRequest, requestOptions?: Messaging.RequestOptions): core.HttpResponsePromise<Apollo.SendMessageResponse>;
|
|
37
36
|
private __sendMessage;
|
|
38
37
|
/**
|
|
39
|
-
* Send a message and stream
|
|
40
|
-
* thread when ``thread_id`` is omitted —
|
|
41
|
-
*
|
|
42
|
-
* stream with the standard ``Last-Event-ID`` header:
|
|
43
|
-
*
|
|
38
|
+
* Send a message and stream the reply token-by-token over Server-Sent
|
|
39
|
+
* Events. The thread is created automatically when ``thread_id`` is omitted —
|
|
40
|
+
* the resolved id arrives as the first ``thread`` event. Resume a dropped
|
|
41
|
+
* stream with the standard ``Last-Event-ID`` header: missed events replay
|
|
42
|
+
* without running the turn again.
|
|
44
43
|
*/
|
|
45
44
|
streamMessage(request: Apollo.StreamMessageRequest, requestOptions?: Messaging.RequestOptions): core.HttpResponsePromise<core.Stream<Apollo.StreamMessageResponse>>;
|
|
46
45
|
private __streamMessage;
|
|
47
46
|
/**
|
|
48
|
-
* Regenerate ``interaction_id`` on the thread against the live
|
|
49
|
-
* replay ``text`` onto the
|
|
50
|
-
*
|
|
51
|
-
* ``thread_id`` in the response is the clone's id, not the original.
|
|
47
|
+
* Regenerate ``interaction_id`` on the thread against the agent's live
|
|
48
|
+
* version, then replay ``text`` onto the resulting new thread. The response's
|
|
49
|
+
* ``thread_id`` is the new thread's id, not the original.
|
|
52
50
|
*
|
|
53
51
|
* @param {string} threadId
|
|
54
52
|
* @param {Apollo.RerunMessageRequest} request
|
|
@@ -64,7 +62,6 @@ export declare class Messaging {
|
|
|
64
62
|
*
|
|
65
63
|
* @example
|
|
66
64
|
* await client.messaging.rerun("threadId", {
|
|
67
|
-
* agent_id: "agent_id",
|
|
68
65
|
* interaction_id: "interaction_id",
|
|
69
66
|
* text: "text"
|
|
70
67
|
* })
|
|
@@ -72,7 +69,7 @@ export declare class Messaging {
|
|
|
72
69
|
rerun(threadId: string, request: Apollo.RerunMessageRequest, requestOptions?: Messaging.RequestOptions): core.HttpResponsePromise<Apollo.SendMessageResponse>;
|
|
73
70
|
private __rerun;
|
|
74
71
|
/**
|
|
75
|
-
* The thread transcript,
|
|
72
|
+
* The thread's full transcript, in chronological order.
|
|
76
73
|
*
|
|
77
74
|
* @param {string} threadId
|
|
78
75
|
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -110,7 +107,7 @@ export declare class Messaging {
|
|
|
110
107
|
threadTrace(threadId: string, requestOptions?: Messaging.RequestOptions): core.HttpResponsePromise<Apollo.Trace[]>;
|
|
111
108
|
private __threadTrace;
|
|
112
109
|
/**
|
|
113
|
-
*
|
|
110
|
+
* The reasoning trace of a single interaction, resolved by its id.
|
|
114
111
|
*
|
|
115
112
|
* @param {string} interactionId
|
|
116
113
|
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -128,4 +125,44 @@ export declare class Messaging {
|
|
|
128
125
|
*/
|
|
129
126
|
interactionTrace(interactionId: string, requestOptions?: Messaging.RequestOptions): core.HttpResponsePromise<Apollo.Trace>;
|
|
130
127
|
private __interactionTrace;
|
|
128
|
+
/**
|
|
129
|
+
* Generate suggested follow-up prompts from a context you provide —
|
|
130
|
+
* useful for offering the end user quick next questions.
|
|
131
|
+
*
|
|
132
|
+
* @param {Apollo.GenerateFollowupSuggestionsRequest} request
|
|
133
|
+
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
134
|
+
*
|
|
135
|
+
* @throws {@link Apollo.BadRequestError}
|
|
136
|
+
* @throws {@link Apollo.UnauthorizedError}
|
|
137
|
+
* @throws {@link Apollo.ForbiddenError}
|
|
138
|
+
* @throws {@link Apollo.NotFoundError}
|
|
139
|
+
* @throws {@link Apollo.ConflictError}
|
|
140
|
+
* @throws {@link Apollo.UnprocessableEntityError}
|
|
141
|
+
* @throws {@link Apollo.InternalServerError}
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* await client.messaging.generateFollowupSuggestions()
|
|
145
|
+
*/
|
|
146
|
+
generateFollowupSuggestions(request?: Apollo.GenerateFollowupSuggestionsRequest, requestOptions?: Messaging.RequestOptions): core.HttpResponsePromise<Apollo.GenerateFollowupSuggestionsResponse>;
|
|
147
|
+
private __generateFollowupSuggestions;
|
|
148
|
+
/**
|
|
149
|
+
* The welcome message of the agent's live version — what to show before
|
|
150
|
+
* the first user message.
|
|
151
|
+
*
|
|
152
|
+
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
153
|
+
*
|
|
154
|
+
* @throws {@link Apollo.BadRequestError}
|
|
155
|
+
* @throws {@link Apollo.UnauthorizedError}
|
|
156
|
+
* @throws {@link Apollo.ForbiddenError}
|
|
157
|
+
* @throws {@link Apollo.NotFoundError}
|
|
158
|
+
* @throws {@link Apollo.ConflictError}
|
|
159
|
+
* @throws {@link Apollo.UnprocessableEntityError}
|
|
160
|
+
* @throws {@link Apollo.InternalServerError}
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* await client.messaging.getWelcomeMessage()
|
|
164
|
+
*/
|
|
165
|
+
getWelcomeMessage(requestOptions?: Messaging.RequestOptions): core.HttpResponsePromise<Apollo.AgentVersionWelcomeMessageResponse>;
|
|
166
|
+
private __getWelcomeMessage;
|
|
167
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
131
168
|
}
|
|
@@ -50,7 +50,7 @@ const environments = __importStar(require("../../../../environments.js"));
|
|
|
50
50
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
51
51
|
const Apollo = __importStar(require("../../../index.js"));
|
|
52
52
|
class Messaging {
|
|
53
|
-
constructor(_options
|
|
53
|
+
constructor(_options) {
|
|
54
54
|
this._options = _options;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
@@ -71,7 +71,6 @@ class Messaging {
|
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
73
73
|
* await client.messaging.sendMessage({
|
|
74
|
-
* agent_id: "agent_id",
|
|
75
74
|
* text: "text",
|
|
76
75
|
* user_id: "user_id"
|
|
77
76
|
* })
|
|
@@ -81,20 +80,23 @@ class Messaging {
|
|
|
81
80
|
}
|
|
82
81
|
__sendMessage(request, requestOptions) {
|
|
83
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
85
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
83
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
84
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
85
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
86
|
+
"x-organization-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationApiKey,
|
|
87
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
86
88
|
const _response = yield core.fetcher({
|
|
87
|
-
url: core.url.join((
|
|
89
|
+
url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ApolloEnvironment.Gcp).base, "messaging/v1/messages"),
|
|
88
90
|
method: "POST",
|
|
89
91
|
headers: _headers,
|
|
90
92
|
contentType: "application/json",
|
|
91
93
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
92
94
|
requestType: "json",
|
|
93
95
|
body: request,
|
|
94
|
-
timeoutMs: ((
|
|
95
|
-
maxRetries: (
|
|
96
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
97
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
96
98
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
97
|
-
fetchFn: (
|
|
99
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
98
100
|
logging: this._options.logging,
|
|
99
101
|
});
|
|
100
102
|
if (_response.ok) {
|
|
@@ -142,22 +144,26 @@ class Messaging {
|
|
|
142
144
|
});
|
|
143
145
|
}
|
|
144
146
|
/**
|
|
145
|
-
* Send a message and stream
|
|
146
|
-
* thread when ``thread_id`` is omitted —
|
|
147
|
-
*
|
|
148
|
-
* stream with the standard ``Last-Event-ID`` header:
|
|
149
|
-
*
|
|
147
|
+
* Send a message and stream the reply token-by-token over Server-Sent
|
|
148
|
+
* Events. The thread is created automatically when ``thread_id`` is omitted —
|
|
149
|
+
* the resolved id arrives as the first ``thread`` event. Resume a dropped
|
|
150
|
+
* stream with the standard ``Last-Event-ID`` header: missed events replay
|
|
151
|
+
* without running the turn again.
|
|
150
152
|
*/
|
|
151
153
|
streamMessage(request, requestOptions) {
|
|
152
154
|
return core.HttpResponsePromise.fromPromise(this.__streamMessage(request, requestOptions));
|
|
153
155
|
}
|
|
154
156
|
__streamMessage(request, requestOptions) {
|
|
155
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
158
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
157
159
|
const { "Last-Event-ID": lastEventId, body: _body } = request;
|
|
158
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
160
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
161
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
162
|
+
"Last-Event-ID": lastEventId != null ? lastEventId : undefined,
|
|
163
|
+
"x-organization-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationApiKey,
|
|
164
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
159
165
|
const _response = yield core.fetcher({
|
|
160
|
-
url: core.url.join((
|
|
166
|
+
url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ApolloEnvironment.Gcp).base, "messaging/v1/messages/stream"),
|
|
161
167
|
method: "POST",
|
|
162
168
|
headers: _headers,
|
|
163
169
|
contentType: "application/json",
|
|
@@ -165,10 +171,10 @@ class Messaging {
|
|
|
165
171
|
requestType: "json",
|
|
166
172
|
body: _body,
|
|
167
173
|
responseType: "sse",
|
|
168
|
-
timeoutMs: ((
|
|
169
|
-
maxRetries: (
|
|
174
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
175
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
170
176
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
171
|
-
fetchFn: (
|
|
177
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
172
178
|
logging: this._options.logging,
|
|
173
179
|
});
|
|
174
180
|
if (_response.ok) {
|
|
@@ -227,10 +233,9 @@ class Messaging {
|
|
|
227
233
|
});
|
|
228
234
|
}
|
|
229
235
|
/**
|
|
230
|
-
* Regenerate ``interaction_id`` on the thread against the live
|
|
231
|
-
* replay ``text`` onto the
|
|
232
|
-
*
|
|
233
|
-
* ``thread_id`` in the response is the clone's id, not the original.
|
|
236
|
+
* Regenerate ``interaction_id`` on the thread against the agent's live
|
|
237
|
+
* version, then replay ``text`` onto the resulting new thread. The response's
|
|
238
|
+
* ``thread_id`` is the new thread's id, not the original.
|
|
234
239
|
*
|
|
235
240
|
* @param {string} threadId
|
|
236
241
|
* @param {Apollo.RerunMessageRequest} request
|
|
@@ -246,7 +251,6 @@ class Messaging {
|
|
|
246
251
|
*
|
|
247
252
|
* @example
|
|
248
253
|
* await client.messaging.rerun("threadId", {
|
|
249
|
-
* agent_id: "agent_id",
|
|
250
254
|
* interaction_id: "interaction_id",
|
|
251
255
|
* text: "text"
|
|
252
256
|
* })
|
|
@@ -256,20 +260,23 @@ class Messaging {
|
|
|
256
260
|
}
|
|
257
261
|
__rerun(threadId, request, requestOptions) {
|
|
258
262
|
return __awaiter(this, void 0, void 0, function* () {
|
|
259
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
260
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
263
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
264
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
265
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
266
|
+
"x-organization-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationApiKey,
|
|
267
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
261
268
|
const _response = yield core.fetcher({
|
|
262
|
-
url: core.url.join((
|
|
269
|
+
url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ApolloEnvironment.Gcp).base, `messaging/v1/threads/${core.url.encodePathParam(threadId)}/rerun`),
|
|
263
270
|
method: "POST",
|
|
264
271
|
headers: _headers,
|
|
265
272
|
contentType: "application/json",
|
|
266
273
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
267
274
|
requestType: "json",
|
|
268
275
|
body: request,
|
|
269
|
-
timeoutMs: ((
|
|
270
|
-
maxRetries: (
|
|
276
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
277
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
271
278
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
272
|
-
fetchFn: (
|
|
279
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
273
280
|
logging: this._options.logging,
|
|
274
281
|
});
|
|
275
282
|
if (_response.ok) {
|
|
@@ -317,7 +324,7 @@ class Messaging {
|
|
|
317
324
|
});
|
|
318
325
|
}
|
|
319
326
|
/**
|
|
320
|
-
* The thread transcript,
|
|
327
|
+
* The thread's full transcript, in chronological order.
|
|
321
328
|
*
|
|
322
329
|
* @param {string} threadId
|
|
323
330
|
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -338,17 +345,20 @@ class Messaging {
|
|
|
338
345
|
}
|
|
339
346
|
__listMessages(threadId, requestOptions) {
|
|
340
347
|
return __awaiter(this, void 0, void 0, function* () {
|
|
341
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
342
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
348
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
349
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
350
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
351
|
+
"x-organization-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationApiKey,
|
|
352
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
343
353
|
const _response = yield core.fetcher({
|
|
344
|
-
url: core.url.join((
|
|
354
|
+
url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ApolloEnvironment.Gcp).base, `messaging/v1/threads/${core.url.encodePathParam(threadId)}/messages`),
|
|
345
355
|
method: "GET",
|
|
346
356
|
headers: _headers,
|
|
347
357
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
348
|
-
timeoutMs: ((
|
|
349
|
-
maxRetries: (
|
|
358
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
359
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
350
360
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
351
|
-
fetchFn: (
|
|
361
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
352
362
|
logging: this._options.logging,
|
|
353
363
|
});
|
|
354
364
|
if (_response.ok) {
|
|
@@ -417,17 +427,20 @@ class Messaging {
|
|
|
417
427
|
}
|
|
418
428
|
__threadTrace(threadId, requestOptions) {
|
|
419
429
|
return __awaiter(this, void 0, void 0, function* () {
|
|
420
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
421
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
430
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
431
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
432
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
433
|
+
"x-organization-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationApiKey,
|
|
434
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
422
435
|
const _response = yield core.fetcher({
|
|
423
|
-
url: core.url.join((
|
|
436
|
+
url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ApolloEnvironment.Gcp).base, `messaging/v1/threads/${core.url.encodePathParam(threadId)}/trace`),
|
|
424
437
|
method: "GET",
|
|
425
438
|
headers: _headers,
|
|
426
439
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
427
|
-
timeoutMs: ((
|
|
428
|
-
maxRetries: (
|
|
440
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
441
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
429
442
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
430
|
-
fetchFn: (
|
|
443
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
431
444
|
logging: this._options.logging,
|
|
432
445
|
});
|
|
433
446
|
if (_response.ok) {
|
|
@@ -475,7 +488,7 @@ class Messaging {
|
|
|
475
488
|
});
|
|
476
489
|
}
|
|
477
490
|
/**
|
|
478
|
-
*
|
|
491
|
+
* The reasoning trace of a single interaction, resolved by its id.
|
|
479
492
|
*
|
|
480
493
|
* @param {string} interactionId
|
|
481
494
|
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -496,17 +509,20 @@ class Messaging {
|
|
|
496
509
|
}
|
|
497
510
|
__interactionTrace(interactionId, requestOptions) {
|
|
498
511
|
return __awaiter(this, void 0, void 0, function* () {
|
|
499
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
500
|
-
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
512
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
513
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
514
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
515
|
+
"x-organization-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationApiKey,
|
|
516
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
501
517
|
const _response = yield core.fetcher({
|
|
502
|
-
url: core.url.join((
|
|
518
|
+
url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ApolloEnvironment.Gcp).base, `messaging/v1/interactions/${core.url.encodePathParam(interactionId)}/trace`),
|
|
503
519
|
method: "GET",
|
|
504
520
|
headers: _headers,
|
|
505
521
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
506
|
-
timeoutMs: ((
|
|
507
|
-
maxRetries: (
|
|
522
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
523
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
508
524
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
509
|
-
fetchFn: (
|
|
525
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
510
526
|
logging: this._options.logging,
|
|
511
527
|
});
|
|
512
528
|
if (_response.ok) {
|
|
@@ -553,5 +569,188 @@ class Messaging {
|
|
|
553
569
|
}
|
|
554
570
|
});
|
|
555
571
|
}
|
|
572
|
+
/**
|
|
573
|
+
* Generate suggested follow-up prompts from a context you provide —
|
|
574
|
+
* useful for offering the end user quick next questions.
|
|
575
|
+
*
|
|
576
|
+
* @param {Apollo.GenerateFollowupSuggestionsRequest} request
|
|
577
|
+
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
578
|
+
*
|
|
579
|
+
* @throws {@link Apollo.BadRequestError}
|
|
580
|
+
* @throws {@link Apollo.UnauthorizedError}
|
|
581
|
+
* @throws {@link Apollo.ForbiddenError}
|
|
582
|
+
* @throws {@link Apollo.NotFoundError}
|
|
583
|
+
* @throws {@link Apollo.ConflictError}
|
|
584
|
+
* @throws {@link Apollo.UnprocessableEntityError}
|
|
585
|
+
* @throws {@link Apollo.InternalServerError}
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* await client.messaging.generateFollowupSuggestions()
|
|
589
|
+
*/
|
|
590
|
+
generateFollowupSuggestions(request = {}, requestOptions) {
|
|
591
|
+
return core.HttpResponsePromise.fromPromise(this.__generateFollowupSuggestions(request, requestOptions));
|
|
592
|
+
}
|
|
593
|
+
__generateFollowupSuggestions() {
|
|
594
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
595
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
596
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
597
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
598
|
+
"x-organization-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationApiKey,
|
|
599
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
600
|
+
const _response = yield core.fetcher({
|
|
601
|
+
url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ApolloEnvironment.Gcp).base, "messaging/v1/followup-suggestions"),
|
|
602
|
+
method: "POST",
|
|
603
|
+
headers: _headers,
|
|
604
|
+
contentType: "application/json",
|
|
605
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
606
|
+
requestType: "json",
|
|
607
|
+
body: request,
|
|
608
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
609
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
610
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
611
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
612
|
+
logging: this._options.logging,
|
|
613
|
+
});
|
|
614
|
+
if (_response.ok) {
|
|
615
|
+
return {
|
|
616
|
+
data: _response.body,
|
|
617
|
+
rawResponse: _response.rawResponse,
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
if (_response.error.reason === "status-code") {
|
|
621
|
+
switch (_response.error.statusCode) {
|
|
622
|
+
case 400:
|
|
623
|
+
throw new Apollo.BadRequestError(_response.error.body, _response.rawResponse);
|
|
624
|
+
case 401:
|
|
625
|
+
throw new Apollo.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
626
|
+
case 403:
|
|
627
|
+
throw new Apollo.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
628
|
+
case 404:
|
|
629
|
+
throw new Apollo.NotFoundError(_response.error.body, _response.rawResponse);
|
|
630
|
+
case 409:
|
|
631
|
+
throw new Apollo.ConflictError(_response.error.body, _response.rawResponse);
|
|
632
|
+
case 422:
|
|
633
|
+
throw new Apollo.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
634
|
+
case 500:
|
|
635
|
+
throw new Apollo.InternalServerError(_response.error.body, _response.rawResponse);
|
|
636
|
+
default:
|
|
637
|
+
throw new errors.ApolloError({
|
|
638
|
+
statusCode: _response.error.statusCode,
|
|
639
|
+
body: _response.error.body,
|
|
640
|
+
rawResponse: _response.rawResponse,
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
switch (_response.error.reason) {
|
|
645
|
+
case "non-json":
|
|
646
|
+
throw new errors.ApolloError({
|
|
647
|
+
statusCode: _response.error.statusCode,
|
|
648
|
+
body: _response.error.rawBody,
|
|
649
|
+
rawResponse: _response.rawResponse,
|
|
650
|
+
});
|
|
651
|
+
case "timeout":
|
|
652
|
+
throw new errors.ApolloTimeoutError("Timeout exceeded when calling POST /messaging/v1/followup-suggestions.");
|
|
653
|
+
case "unknown":
|
|
654
|
+
throw new errors.ApolloError({
|
|
655
|
+
message: _response.error.errorMessage,
|
|
656
|
+
rawResponse: _response.rawResponse,
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* The welcome message of the agent's live version — what to show before
|
|
663
|
+
* the first user message.
|
|
664
|
+
*
|
|
665
|
+
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
666
|
+
*
|
|
667
|
+
* @throws {@link Apollo.BadRequestError}
|
|
668
|
+
* @throws {@link Apollo.UnauthorizedError}
|
|
669
|
+
* @throws {@link Apollo.ForbiddenError}
|
|
670
|
+
* @throws {@link Apollo.NotFoundError}
|
|
671
|
+
* @throws {@link Apollo.ConflictError}
|
|
672
|
+
* @throws {@link Apollo.UnprocessableEntityError}
|
|
673
|
+
* @throws {@link Apollo.InternalServerError}
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* await client.messaging.getWelcomeMessage()
|
|
677
|
+
*/
|
|
678
|
+
getWelcomeMessage(requestOptions) {
|
|
679
|
+
return core.HttpResponsePromise.fromPromise(this.__getWelcomeMessage(requestOptions));
|
|
680
|
+
}
|
|
681
|
+
__getWelcomeMessage(requestOptions) {
|
|
682
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
683
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
684
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
685
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
686
|
+
"x-organization-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.organizationApiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.organizationApiKey,
|
|
687
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
688
|
+
const _response = yield core.fetcher({
|
|
689
|
+
url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : ((_e = (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ApolloEnvironment.Gcp).base, "messaging/v1/welcome-message"),
|
|
690
|
+
method: "GET",
|
|
691
|
+
headers: _headers,
|
|
692
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
693
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
694
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
695
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
696
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
697
|
+
logging: this._options.logging,
|
|
698
|
+
});
|
|
699
|
+
if (_response.ok) {
|
|
700
|
+
return {
|
|
701
|
+
data: _response.body,
|
|
702
|
+
rawResponse: _response.rawResponse,
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
if (_response.error.reason === "status-code") {
|
|
706
|
+
switch (_response.error.statusCode) {
|
|
707
|
+
case 400:
|
|
708
|
+
throw new Apollo.BadRequestError(_response.error.body, _response.rawResponse);
|
|
709
|
+
case 401:
|
|
710
|
+
throw new Apollo.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
711
|
+
case 403:
|
|
712
|
+
throw new Apollo.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
713
|
+
case 404:
|
|
714
|
+
throw new Apollo.NotFoundError(_response.error.body, _response.rawResponse);
|
|
715
|
+
case 409:
|
|
716
|
+
throw new Apollo.ConflictError(_response.error.body, _response.rawResponse);
|
|
717
|
+
case 422:
|
|
718
|
+
throw new Apollo.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
719
|
+
case 500:
|
|
720
|
+
throw new Apollo.InternalServerError(_response.error.body, _response.rawResponse);
|
|
721
|
+
default:
|
|
722
|
+
throw new errors.ApolloError({
|
|
723
|
+
statusCode: _response.error.statusCode,
|
|
724
|
+
body: _response.error.body,
|
|
725
|
+
rawResponse: _response.rawResponse,
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
switch (_response.error.reason) {
|
|
730
|
+
case "non-json":
|
|
731
|
+
throw new errors.ApolloError({
|
|
732
|
+
statusCode: _response.error.statusCode,
|
|
733
|
+
body: _response.error.rawBody,
|
|
734
|
+
rawResponse: _response.rawResponse,
|
|
735
|
+
});
|
|
736
|
+
case "timeout":
|
|
737
|
+
throw new errors.ApolloTimeoutError("Timeout exceeded when calling GET /messaging/v1/welcome-message.");
|
|
738
|
+
case "unknown":
|
|
739
|
+
throw new errors.ApolloError({
|
|
740
|
+
message: _response.error.errorMessage,
|
|
741
|
+
rawResponse: _response.rawResponse,
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
_getAuthorizationHeader() {
|
|
747
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
748
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
749
|
+
if (bearer != null) {
|
|
750
|
+
return `Bearer ${bearer}`;
|
|
751
|
+
}
|
|
752
|
+
return undefined;
|
|
753
|
+
});
|
|
754
|
+
}
|
|
556
755
|
}
|
|
557
756
|
exports.Messaging = Messaging;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @example
|
|
3
3
|
* {
|
|
4
|
-
* agent_id: "agent_id",
|
|
5
4
|
* interaction_id: "interaction_id",
|
|
6
5
|
* text: "text"
|
|
7
6
|
* }
|
|
8
7
|
*/
|
|
9
8
|
export interface RerunMessageRequest {
|
|
10
|
-
agent_id: string;
|
|
11
9
|
interaction_id: string;
|
|
12
10
|
text: string;
|
|
11
|
+
/** End user to attribute the rerun to; omitted, the thread's original user is kept. */
|
|
12
|
+
user_id?: string;
|
|
13
13
|
/** Signed image URL on the replayed message. */
|
|
14
14
|
image_url?: string;
|
|
15
15
|
version_id?: string;
|