@aui.io/aui-client 3.1.2 → 3.2.0
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 +196 -69
- package/dist/cjs/ApolloClientWrapper.d.ts +52 -24
- package/dist/cjs/ApolloClientWrapper.js +86 -58
- 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 +52 -24
- package/dist/esm/ApolloClientWrapper.mjs +83 -56
- 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
|
}
|
|
@@ -14,7 +14,7 @@ import * as environments from "../../../../environments.mjs";
|
|
|
14
14
|
import * as errors from "../../../../errors/index.mjs";
|
|
15
15
|
import * as Apollo from "../../../index.mjs";
|
|
16
16
|
export class Messaging {
|
|
17
|
-
constructor(_options
|
|
17
|
+
constructor(_options) {
|
|
18
18
|
this._options = _options;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
@@ -35,7 +35,6 @@ export class Messaging {
|
|
|
35
35
|
*
|
|
36
36
|
* @example
|
|
37
37
|
* await client.messaging.sendMessage({
|
|
38
|
-
* agent_id: "agent_id",
|
|
39
38
|
* text: "text",
|
|
40
39
|
* user_id: "user_id"
|
|
41
40
|
* })
|
|
@@ -45,20 +44,23 @@ export class Messaging {
|
|
|
45
44
|
}
|
|
46
45
|
__sendMessage(request, requestOptions) {
|
|
47
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
49
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
47
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
48
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
49
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
50
|
+
"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,
|
|
51
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
50
52
|
const _response = yield core.fetcher({
|
|
51
|
-
url: core.url.join((
|
|
53
|
+
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"),
|
|
52
54
|
method: "POST",
|
|
53
55
|
headers: _headers,
|
|
54
56
|
contentType: "application/json",
|
|
55
57
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
56
58
|
requestType: "json",
|
|
57
59
|
body: request,
|
|
58
|
-
timeoutMs: ((
|
|
59
|
-
maxRetries: (
|
|
60
|
+
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,
|
|
61
|
+
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,
|
|
60
62
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
61
|
-
fetchFn: (
|
|
63
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
62
64
|
logging: this._options.logging,
|
|
63
65
|
});
|
|
64
66
|
if (_response.ok) {
|
|
@@ -106,22 +108,26 @@ export class Messaging {
|
|
|
106
108
|
});
|
|
107
109
|
}
|
|
108
110
|
/**
|
|
109
|
-
* Send a message and stream
|
|
110
|
-
* thread when ``thread_id`` is omitted —
|
|
111
|
-
*
|
|
112
|
-
* stream with the standard ``Last-Event-ID`` header:
|
|
113
|
-
*
|
|
111
|
+
* Send a message and stream the reply token-by-token over Server-Sent
|
|
112
|
+
* Events. The thread is created automatically when ``thread_id`` is omitted —
|
|
113
|
+
* the resolved id arrives as the first ``thread`` event. Resume a dropped
|
|
114
|
+
* stream with the standard ``Last-Event-ID`` header: missed events replay
|
|
115
|
+
* without running the turn again.
|
|
114
116
|
*/
|
|
115
117
|
streamMessage(request, requestOptions) {
|
|
116
118
|
return core.HttpResponsePromise.fromPromise(this.__streamMessage(request, requestOptions));
|
|
117
119
|
}
|
|
118
120
|
__streamMessage(request, requestOptions) {
|
|
119
121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
122
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
121
123
|
const { "Last-Event-ID": lastEventId, body: _body } = request;
|
|
122
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
124
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
125
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
126
|
+
"Last-Event-ID": lastEventId != null ? lastEventId : undefined,
|
|
127
|
+
"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,
|
|
128
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
123
129
|
const _response = yield core.fetcher({
|
|
124
|
-
url: core.url.join((
|
|
130
|
+
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"),
|
|
125
131
|
method: "POST",
|
|
126
132
|
headers: _headers,
|
|
127
133
|
contentType: "application/json",
|
|
@@ -129,10 +135,10 @@ export class Messaging {
|
|
|
129
135
|
requestType: "json",
|
|
130
136
|
body: _body,
|
|
131
137
|
responseType: "sse",
|
|
132
|
-
timeoutMs: ((
|
|
133
|
-
maxRetries: (
|
|
138
|
+
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,
|
|
139
|
+
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,
|
|
134
140
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
135
|
-
fetchFn: (
|
|
141
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
136
142
|
logging: this._options.logging,
|
|
137
143
|
});
|
|
138
144
|
if (_response.ok) {
|
|
@@ -191,10 +197,9 @@ export class Messaging {
|
|
|
191
197
|
});
|
|
192
198
|
}
|
|
193
199
|
/**
|
|
194
|
-
* Regenerate ``interaction_id`` on the thread against the live
|
|
195
|
-
* replay ``text`` onto the
|
|
196
|
-
*
|
|
197
|
-
* ``thread_id`` in the response is the clone's id, not the original.
|
|
200
|
+
* Regenerate ``interaction_id`` on the thread against the agent's live
|
|
201
|
+
* version, then replay ``text`` onto the resulting new thread. The response's
|
|
202
|
+
* ``thread_id`` is the new thread's id, not the original.
|
|
198
203
|
*
|
|
199
204
|
* @param {string} threadId
|
|
200
205
|
* @param {Apollo.RerunMessageRequest} request
|
|
@@ -210,7 +215,6 @@ export class Messaging {
|
|
|
210
215
|
*
|
|
211
216
|
* @example
|
|
212
217
|
* await client.messaging.rerun("threadId", {
|
|
213
|
-
* agent_id: "agent_id",
|
|
214
218
|
* interaction_id: "interaction_id",
|
|
215
219
|
* text: "text"
|
|
216
220
|
* })
|
|
@@ -220,20 +224,23 @@ export class Messaging {
|
|
|
220
224
|
}
|
|
221
225
|
__rerun(threadId, request, requestOptions) {
|
|
222
226
|
return __awaiter(this, void 0, void 0, function* () {
|
|
223
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
224
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
227
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
228
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
229
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
230
|
+
"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,
|
|
231
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
225
232
|
const _response = yield core.fetcher({
|
|
226
|
-
url: core.url.join((
|
|
233
|
+
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`),
|
|
227
234
|
method: "POST",
|
|
228
235
|
headers: _headers,
|
|
229
236
|
contentType: "application/json",
|
|
230
237
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
231
238
|
requestType: "json",
|
|
232
239
|
body: request,
|
|
233
|
-
timeoutMs: ((
|
|
234
|
-
maxRetries: (
|
|
240
|
+
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,
|
|
241
|
+
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,
|
|
235
242
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
236
|
-
fetchFn: (
|
|
243
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
237
244
|
logging: this._options.logging,
|
|
238
245
|
});
|
|
239
246
|
if (_response.ok) {
|
|
@@ -281,7 +288,7 @@ export class Messaging {
|
|
|
281
288
|
});
|
|
282
289
|
}
|
|
283
290
|
/**
|
|
284
|
-
* The thread transcript,
|
|
291
|
+
* The thread's full transcript, in chronological order.
|
|
285
292
|
*
|
|
286
293
|
* @param {string} threadId
|
|
287
294
|
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -302,17 +309,20 @@ export class Messaging {
|
|
|
302
309
|
}
|
|
303
310
|
__listMessages(threadId, requestOptions) {
|
|
304
311
|
return __awaiter(this, void 0, void 0, function* () {
|
|
305
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
306
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
312
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
313
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
314
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
315
|
+
"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,
|
|
316
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
307
317
|
const _response = yield core.fetcher({
|
|
308
|
-
url: core.url.join((
|
|
318
|
+
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`),
|
|
309
319
|
method: "GET",
|
|
310
320
|
headers: _headers,
|
|
311
321
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
312
|
-
timeoutMs: ((
|
|
313
|
-
maxRetries: (
|
|
322
|
+
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,
|
|
323
|
+
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,
|
|
314
324
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
315
|
-
fetchFn: (
|
|
325
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
316
326
|
logging: this._options.logging,
|
|
317
327
|
});
|
|
318
328
|
if (_response.ok) {
|
|
@@ -381,17 +391,20 @@ export class Messaging {
|
|
|
381
391
|
}
|
|
382
392
|
__threadTrace(threadId, requestOptions) {
|
|
383
393
|
return __awaiter(this, void 0, void 0, function* () {
|
|
384
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
385
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
394
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
395
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
396
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
397
|
+
"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,
|
|
398
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
386
399
|
const _response = yield core.fetcher({
|
|
387
|
-
url: core.url.join((
|
|
400
|
+
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`),
|
|
388
401
|
method: "GET",
|
|
389
402
|
headers: _headers,
|
|
390
403
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
391
|
-
timeoutMs: ((
|
|
392
|
-
maxRetries: (
|
|
404
|
+
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,
|
|
405
|
+
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,
|
|
393
406
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
394
|
-
fetchFn: (
|
|
407
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
395
408
|
logging: this._options.logging,
|
|
396
409
|
});
|
|
397
410
|
if (_response.ok) {
|
|
@@ -439,7 +452,7 @@ export class Messaging {
|
|
|
439
452
|
});
|
|
440
453
|
}
|
|
441
454
|
/**
|
|
442
|
-
*
|
|
455
|
+
* The reasoning trace of a single interaction, resolved by its id.
|
|
443
456
|
*
|
|
444
457
|
* @param {string} interactionId
|
|
445
458
|
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -460,17 +473,20 @@ export class Messaging {
|
|
|
460
473
|
}
|
|
461
474
|
__interactionTrace(interactionId, requestOptions) {
|
|
462
475
|
return __awaiter(this, void 0, void 0, function* () {
|
|
463
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
464
|
-
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers,
|
|
476
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
477
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
478
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
479
|
+
"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,
|
|
480
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
465
481
|
const _response = yield core.fetcher({
|
|
466
|
-
url: core.url.join((
|
|
482
|
+
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`),
|
|
467
483
|
method: "GET",
|
|
468
484
|
headers: _headers,
|
|
469
485
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
470
|
-
timeoutMs: ((
|
|
471
|
-
maxRetries: (
|
|
486
|
+
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,
|
|
487
|
+
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,
|
|
472
488
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
473
|
-
fetchFn: (
|
|
489
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
474
490
|
logging: this._options.logging,
|
|
475
491
|
});
|
|
476
492
|
if (_response.ok) {
|
|
@@ -517,4 +533,187 @@ export class Messaging {
|
|
|
517
533
|
}
|
|
518
534
|
});
|
|
519
535
|
}
|
|
536
|
+
/**
|
|
537
|
+
* Generate suggested follow-up prompts from a context you provide —
|
|
538
|
+
* useful for offering the end user quick next questions.
|
|
539
|
+
*
|
|
540
|
+
* @param {Apollo.GenerateFollowupSuggestionsRequest} request
|
|
541
|
+
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
542
|
+
*
|
|
543
|
+
* @throws {@link Apollo.BadRequestError}
|
|
544
|
+
* @throws {@link Apollo.UnauthorizedError}
|
|
545
|
+
* @throws {@link Apollo.ForbiddenError}
|
|
546
|
+
* @throws {@link Apollo.NotFoundError}
|
|
547
|
+
* @throws {@link Apollo.ConflictError}
|
|
548
|
+
* @throws {@link Apollo.UnprocessableEntityError}
|
|
549
|
+
* @throws {@link Apollo.InternalServerError}
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* await client.messaging.generateFollowupSuggestions()
|
|
553
|
+
*/
|
|
554
|
+
generateFollowupSuggestions(request = {}, requestOptions) {
|
|
555
|
+
return core.HttpResponsePromise.fromPromise(this.__generateFollowupSuggestions(request, requestOptions));
|
|
556
|
+
}
|
|
557
|
+
__generateFollowupSuggestions() {
|
|
558
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
559
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
560
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
561
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
562
|
+
"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,
|
|
563
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
564
|
+
const _response = yield core.fetcher({
|
|
565
|
+
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"),
|
|
566
|
+
method: "POST",
|
|
567
|
+
headers: _headers,
|
|
568
|
+
contentType: "application/json",
|
|
569
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
570
|
+
requestType: "json",
|
|
571
|
+
body: request,
|
|
572
|
+
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,
|
|
573
|
+
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,
|
|
574
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
575
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
576
|
+
logging: this._options.logging,
|
|
577
|
+
});
|
|
578
|
+
if (_response.ok) {
|
|
579
|
+
return {
|
|
580
|
+
data: _response.body,
|
|
581
|
+
rawResponse: _response.rawResponse,
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
if (_response.error.reason === "status-code") {
|
|
585
|
+
switch (_response.error.statusCode) {
|
|
586
|
+
case 400:
|
|
587
|
+
throw new Apollo.BadRequestError(_response.error.body, _response.rawResponse);
|
|
588
|
+
case 401:
|
|
589
|
+
throw new Apollo.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
590
|
+
case 403:
|
|
591
|
+
throw new Apollo.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
592
|
+
case 404:
|
|
593
|
+
throw new Apollo.NotFoundError(_response.error.body, _response.rawResponse);
|
|
594
|
+
case 409:
|
|
595
|
+
throw new Apollo.ConflictError(_response.error.body, _response.rawResponse);
|
|
596
|
+
case 422:
|
|
597
|
+
throw new Apollo.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
598
|
+
case 500:
|
|
599
|
+
throw new Apollo.InternalServerError(_response.error.body, _response.rawResponse);
|
|
600
|
+
default:
|
|
601
|
+
throw new errors.ApolloError({
|
|
602
|
+
statusCode: _response.error.statusCode,
|
|
603
|
+
body: _response.error.body,
|
|
604
|
+
rawResponse: _response.rawResponse,
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
switch (_response.error.reason) {
|
|
609
|
+
case "non-json":
|
|
610
|
+
throw new errors.ApolloError({
|
|
611
|
+
statusCode: _response.error.statusCode,
|
|
612
|
+
body: _response.error.rawBody,
|
|
613
|
+
rawResponse: _response.rawResponse,
|
|
614
|
+
});
|
|
615
|
+
case "timeout":
|
|
616
|
+
throw new errors.ApolloTimeoutError("Timeout exceeded when calling POST /messaging/v1/followup-suggestions.");
|
|
617
|
+
case "unknown":
|
|
618
|
+
throw new errors.ApolloError({
|
|
619
|
+
message: _response.error.errorMessage,
|
|
620
|
+
rawResponse: _response.rawResponse,
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* The welcome message of the agent's live version — what to show before
|
|
627
|
+
* the first user message.
|
|
628
|
+
*
|
|
629
|
+
* @param {Messaging.RequestOptions} requestOptions - Request-specific configuration.
|
|
630
|
+
*
|
|
631
|
+
* @throws {@link Apollo.BadRequestError}
|
|
632
|
+
* @throws {@link Apollo.UnauthorizedError}
|
|
633
|
+
* @throws {@link Apollo.ForbiddenError}
|
|
634
|
+
* @throws {@link Apollo.NotFoundError}
|
|
635
|
+
* @throws {@link Apollo.ConflictError}
|
|
636
|
+
* @throws {@link Apollo.UnprocessableEntityError}
|
|
637
|
+
* @throws {@link Apollo.InternalServerError}
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* await client.messaging.getWelcomeMessage()
|
|
641
|
+
*/
|
|
642
|
+
getWelcomeMessage(requestOptions) {
|
|
643
|
+
return core.HttpResponsePromise.fromPromise(this.__getWelcomeMessage(requestOptions));
|
|
644
|
+
}
|
|
645
|
+
__getWelcomeMessage(requestOptions) {
|
|
646
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
647
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
648
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
|
|
649
|
+
Authorization: yield this._getAuthorizationHeader(),
|
|
650
|
+
"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,
|
|
651
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
652
|
+
const _response = yield core.fetcher({
|
|
653
|
+
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"),
|
|
654
|
+
method: "GET",
|
|
655
|
+
headers: _headers,
|
|
656
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
657
|
+
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,
|
|
658
|
+
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,
|
|
659
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
660
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
661
|
+
logging: this._options.logging,
|
|
662
|
+
});
|
|
663
|
+
if (_response.ok) {
|
|
664
|
+
return {
|
|
665
|
+
data: _response.body,
|
|
666
|
+
rawResponse: _response.rawResponse,
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
if (_response.error.reason === "status-code") {
|
|
670
|
+
switch (_response.error.statusCode) {
|
|
671
|
+
case 400:
|
|
672
|
+
throw new Apollo.BadRequestError(_response.error.body, _response.rawResponse);
|
|
673
|
+
case 401:
|
|
674
|
+
throw new Apollo.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
675
|
+
case 403:
|
|
676
|
+
throw new Apollo.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
677
|
+
case 404:
|
|
678
|
+
throw new Apollo.NotFoundError(_response.error.body, _response.rawResponse);
|
|
679
|
+
case 409:
|
|
680
|
+
throw new Apollo.ConflictError(_response.error.body, _response.rawResponse);
|
|
681
|
+
case 422:
|
|
682
|
+
throw new Apollo.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
683
|
+
case 500:
|
|
684
|
+
throw new Apollo.InternalServerError(_response.error.body, _response.rawResponse);
|
|
685
|
+
default:
|
|
686
|
+
throw new errors.ApolloError({
|
|
687
|
+
statusCode: _response.error.statusCode,
|
|
688
|
+
body: _response.error.body,
|
|
689
|
+
rawResponse: _response.rawResponse,
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
switch (_response.error.reason) {
|
|
694
|
+
case "non-json":
|
|
695
|
+
throw new errors.ApolloError({
|
|
696
|
+
statusCode: _response.error.statusCode,
|
|
697
|
+
body: _response.error.rawBody,
|
|
698
|
+
rawResponse: _response.rawResponse,
|
|
699
|
+
});
|
|
700
|
+
case "timeout":
|
|
701
|
+
throw new errors.ApolloTimeoutError("Timeout exceeded when calling GET /messaging/v1/welcome-message.");
|
|
702
|
+
case "unknown":
|
|
703
|
+
throw new errors.ApolloError({
|
|
704
|
+
message: _response.error.errorMessage,
|
|
705
|
+
rawResponse: _response.rawResponse,
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
_getAuthorizationHeader() {
|
|
711
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
712
|
+
const bearer = yield core.Supplier.get(this._options.token);
|
|
713
|
+
if (bearer != null) {
|
|
714
|
+
return `Bearer ${bearer}`;
|
|
715
|
+
}
|
|
716
|
+
return undefined;
|
|
717
|
+
});
|
|
718
|
+
}
|
|
520
719
|
}
|
|
@@ -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;
|