@algolia/agent-studio 0.1.0-beta.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.
@@ -0,0 +1,1354 @@
1
+ // builds/browser.ts
2
+ import {
3
+ createBrowserLocalStorageCache,
4
+ createFallbackableCache,
5
+ createMemoryCache,
6
+ createNullLogger
7
+ } from "@algolia/client-common";
8
+ import { createXhrRequester } from "@algolia/requester-browser-xhr";
9
+
10
+ // src/agentStudioClient.ts
11
+ import { createAuth, createTransporter, getAlgoliaAgent, shuffle, validateRequired } from "@algolia/client-common";
12
+ var apiClientVersion = "0.1.0-beta.0";
13
+ function getDefaultHosts(appId) {
14
+ return [
15
+ {
16
+ url: `${appId}-dsn.algolia.net`,
17
+ accept: "read",
18
+ protocol: "https"
19
+ },
20
+ {
21
+ url: `${appId}.algolia.net`,
22
+ accept: "write",
23
+ protocol: "https"
24
+ }
25
+ ].concat(
26
+ shuffle([
27
+ {
28
+ url: `${appId}-1.algolianet.com`,
29
+ accept: "readWrite",
30
+ protocol: "https"
31
+ },
32
+ {
33
+ url: `${appId}-2.algolianet.com`,
34
+ accept: "readWrite",
35
+ protocol: "https"
36
+ },
37
+ {
38
+ url: `${appId}-3.algolianet.com`,
39
+ accept: "readWrite",
40
+ protocol: "https"
41
+ }
42
+ ])
43
+ );
44
+ }
45
+ function createAgentStudioClient({
46
+ appId: appIdOption,
47
+ apiKey: apiKeyOption,
48
+ authMode,
49
+ algoliaAgents,
50
+ ...options
51
+ }) {
52
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
53
+ const transporter = createTransporter({
54
+ hosts: getDefaultHosts(appIdOption),
55
+ ...options,
56
+ algoliaAgent: getAlgoliaAgent({
57
+ algoliaAgents,
58
+ client: "AgentStudio",
59
+ version: apiClientVersion
60
+ }),
61
+ baseHeaders: {
62
+ "content-type": "text/plain",
63
+ ...auth.headers(),
64
+ ...options.baseHeaders
65
+ },
66
+ baseQueryParameters: {
67
+ ...auth.queryParameters(),
68
+ ...options.baseQueryParameters
69
+ }
70
+ });
71
+ return {
72
+ transporter,
73
+ /**
74
+ * The `appId` currently in use.
75
+ */
76
+ appId: appIdOption,
77
+ /**
78
+ * The `apiKey` currently in use.
79
+ */
80
+ apiKey: apiKeyOption,
81
+ /**
82
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
83
+ */
84
+ clearCache() {
85
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
86
+ },
87
+ /**
88
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
89
+ */
90
+ get _ua() {
91
+ return transporter.algoliaAgent.value;
92
+ },
93
+ /**
94
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
95
+ *
96
+ * @param segment - The algolia agent (user-agent) segment to add.
97
+ * @param version - The version of the agent.
98
+ */
99
+ addAlgoliaAgent(segment, version) {
100
+ transporter.algoliaAgent.add({ segment, version });
101
+ },
102
+ /**
103
+ * Helper method to switch the API key used to authenticate the requests.
104
+ *
105
+ * @param params - Method params.
106
+ * @param params.apiKey - The new API Key to use.
107
+ */
108
+ setClientApiKey({ apiKey }) {
109
+ if (!authMode || authMode === "WithinHeaders") {
110
+ transporter.baseHeaders["x-algolia-api-key"] = apiKey;
111
+ } else {
112
+ transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
113
+ }
114
+ },
115
+ /**
116
+ * Add multiple allowed domain patterns. Duplicates are skipped.
117
+ *
118
+ * Required API Key ACLs:
119
+ * - editSettings
120
+ * @param bulkCreateAllowedDomains - The bulkCreateAllowedDomains object.
121
+ * @param bulkCreateAllowedDomains.agentId - The agentId.
122
+ * @param bulkCreateAllowedDomains.allowedDomainBulkInsert - The allowedDomainBulkInsert object.
123
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
124
+ */
125
+ bulkCreateAllowedDomains({ agentId, allowedDomainBulkInsert }, requestOptions) {
126
+ validateRequired("agentId", "bulkCreateAllowedDomains", agentId);
127
+ validateRequired("allowedDomainBulkInsert", "bulkCreateAllowedDomains", allowedDomainBulkInsert);
128
+ validateRequired("allowedDomainBulkInsert.domains", "bulkCreateAllowedDomains", allowedDomainBulkInsert.domains);
129
+ const requestPath = "/agent-studio/1/agents/{agentId}/allowed-domains/bulk".replace(
130
+ "{agentId}",
131
+ encodeURIComponent(agentId)
132
+ );
133
+ const headers = {};
134
+ const queryParameters = {};
135
+ const request = {
136
+ method: "POST",
137
+ path: requestPath,
138
+ queryParameters,
139
+ headers,
140
+ data: allowedDomainBulkInsert
141
+ };
142
+ return transporter.request(request, requestOptions);
143
+ },
144
+ /**
145
+ * Delete allowed domains by id list.
146
+ *
147
+ * Required API Key ACLs:
148
+ * - editSettings
149
+ * @param bulkDeleteAllowedDomains - The bulkDeleteAllowedDomains object.
150
+ * @param bulkDeleteAllowedDomains.agentId - The agentId.
151
+ * @param bulkDeleteAllowedDomains.allowedDomainBulkDelete - The allowedDomainBulkDelete object.
152
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
153
+ */
154
+ bulkDeleteAllowedDomains({ agentId, allowedDomainBulkDelete }, requestOptions) {
155
+ validateRequired("agentId", "bulkDeleteAllowedDomains", agentId);
156
+ validateRequired("allowedDomainBulkDelete", "bulkDeleteAllowedDomains", allowedDomainBulkDelete);
157
+ validateRequired(
158
+ "allowedDomainBulkDelete.domainIds",
159
+ "bulkDeleteAllowedDomains",
160
+ allowedDomainBulkDelete.domainIds
161
+ );
162
+ const requestPath = "/agent-studio/1/agents/{agentId}/allowed-domains/bulk".replace(
163
+ "{agentId}",
164
+ encodeURIComponent(agentId)
165
+ );
166
+ const headers = {};
167
+ const queryParameters = {};
168
+ const request = {
169
+ method: "DELETE",
170
+ path: requestPath,
171
+ queryParameters,
172
+ headers,
173
+ data: allowedDomainBulkDelete
174
+ };
175
+ return transporter.request(request, requestOptions);
176
+ },
177
+ /**
178
+ * Create a new agent.
179
+ *
180
+ * Required API Key ACLs:
181
+ * - editSettings
182
+ * @param agentConfigCreate - The agentConfigCreate object.
183
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
184
+ */
185
+ createAgent(agentConfigCreate, requestOptions) {
186
+ validateRequired("agentConfigCreate", "createAgent", agentConfigCreate);
187
+ validateRequired("agentConfigCreate.name", "createAgent", agentConfigCreate.name);
188
+ validateRequired("agentConfigCreate.instructions", "createAgent", agentConfigCreate.instructions);
189
+ const requestPath = "/agent-studio/1/agents";
190
+ const headers = {};
191
+ const queryParameters = {};
192
+ const request = {
193
+ method: "POST",
194
+ path: requestPath,
195
+ queryParameters,
196
+ headers,
197
+ data: agentConfigCreate
198
+ };
199
+ return transporter.request(request, requestOptions);
200
+ },
201
+ /**
202
+ * Add a single allowed domain pattern (e.g. https://app.example.com or *.example.com).
203
+ *
204
+ * Required API Key ACLs:
205
+ * - editSettings
206
+ * @param createAgentAllowedDomain - The createAgentAllowedDomain object.
207
+ * @param createAgentAllowedDomain.agentId - The agentId.
208
+ * @param createAgentAllowedDomain.allowedDomainCreate - The allowedDomainCreate object.
209
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
210
+ */
211
+ createAgentAllowedDomain({ agentId, allowedDomainCreate }, requestOptions) {
212
+ validateRequired("agentId", "createAgentAllowedDomain", agentId);
213
+ validateRequired("allowedDomainCreate", "createAgentAllowedDomain", allowedDomainCreate);
214
+ validateRequired("allowedDomainCreate.domain", "createAgentAllowedDomain", allowedDomainCreate.domain);
215
+ const requestPath = "/agent-studio/1/agents/{agentId}/allowed-domains".replace(
216
+ "{agentId}",
217
+ encodeURIComponent(agentId)
218
+ );
219
+ const headers = {};
220
+ const queryParameters = {};
221
+ const request = {
222
+ method: "POST",
223
+ path: requestPath,
224
+ queryParameters,
225
+ headers,
226
+ data: allowedDomainCreate
227
+ };
228
+ return transporter.request(request, requestOptions);
229
+ },
230
+ /**
231
+ * Create a completion for the specified agent. This endpoint handles two types of requests: 1. Normal completion request: User message -> Agent response 2. Tool approval response: User approval -> Execute tool -> Agent response Tool Approval Flow (for MCP tools with requiresApproval: true): - Request 1: User sends message -> Agent requests tool call -> Return approval request - Request 2: User approves -> Execute tool -> Agent continues with result.
232
+ *
233
+ * Required API Key ACLs:
234
+ * - search
235
+ * @param createAgentCompletion - The createAgentCompletion object.
236
+ * @param createAgentCompletion.agentId - The agentId.
237
+ * @param createAgentCompletion.compatibilityMode - Compatibility mode for the completion API.
238
+ * @param createAgentCompletion.agentCompletionRequest - The agentCompletionRequest object.
239
+ * @param createAgentCompletion.stream - Whether to stream the response or not.
240
+ * @param createAgentCompletion.cache - Use cached responses if available.
241
+ * @param createAgentCompletion.memory - Set to false to disable memory (enabled by default).
242
+ * @param createAgentCompletion.analytics - Set to false to skip analytics for this completion (default: true). Disables Agent Studio BigQuery analytics, Algolia search analytics, click analytics, and query-suggestions training. Useful for offline-eval workflows.
243
+ * @param createAgentCompletion.xAlgoliaSecureUserToken - The X-Algolia-Secure-User-Token.
244
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
245
+ */
246
+ createAgentCompletion({
247
+ agentId,
248
+ compatibilityMode,
249
+ agentCompletionRequest,
250
+ stream,
251
+ cache,
252
+ memory,
253
+ analytics,
254
+ xAlgoliaSecureUserToken
255
+ }, requestOptions) {
256
+ validateRequired("agentId", "createAgentCompletion", agentId);
257
+ validateRequired("compatibilityMode", "createAgentCompletion", compatibilityMode);
258
+ validateRequired("agentCompletionRequest", "createAgentCompletion", agentCompletionRequest);
259
+ const requestPath = "/agent-studio/1/agents/{agentId}/completions".replace(
260
+ "{agentId}",
261
+ encodeURIComponent(agentId)
262
+ );
263
+ const headers = {};
264
+ const queryParameters = {};
265
+ if (compatibilityMode !== void 0) {
266
+ queryParameters["compatibilityMode"] = compatibilityMode.toString();
267
+ }
268
+ if (stream !== void 0) {
269
+ queryParameters["stream"] = stream.toString();
270
+ }
271
+ if (cache !== void 0) {
272
+ queryParameters["cache"] = cache.toString();
273
+ }
274
+ if (memory !== void 0) {
275
+ queryParameters["memory"] = memory.toString();
276
+ }
277
+ if (analytics !== void 0) {
278
+ queryParameters["analytics"] = analytics.toString();
279
+ }
280
+ if (xAlgoliaSecureUserToken !== void 0) {
281
+ headers["X-Algolia-Secure-User-Token"] = xAlgoliaSecureUserToken.toString();
282
+ }
283
+ const request = {
284
+ method: "POST",
285
+ path: requestPath,
286
+ queryParameters,
287
+ headers,
288
+ data: agentCompletionRequest
289
+ };
290
+ return transporter.request(request, requestOptions);
291
+ },
292
+ /**
293
+ * Create a completion for the specified agent. This endpoint handles two types of requests: 1. Normal completion request: User message -> Agent response 2. Tool approval response: User approval -> Execute tool -> Agent response Tool Approval Flow (for MCP tools with requiresApproval: true): - Request 1: User sends message -> Agent requests tool call -> Return approval request - Request 2: User approves -> Execute tool -> Agent continues with result. (raw streaming version).
294
+ *
295
+ * Yields raw {@link ServerSentEvent} objects. Each event's `data` field contains a JSON-encoded `{ [key: string]: any; }` string.
296
+ *
297
+ * @see createAgentCompletionStream for the parsed variant.
298
+ * @see createAgentCompletion for the non-streaming version.
299
+ */
300
+ createAgentCompletionStreamRaw({
301
+ agentId,
302
+ compatibilityMode,
303
+ agentCompletionRequest,
304
+ stream,
305
+ cache,
306
+ memory,
307
+ analytics,
308
+ xAlgoliaSecureUserToken
309
+ }, requestOptions) {
310
+ validateRequired("agentId", "createAgentCompletionStreamRaw", agentId);
311
+ validateRequired("compatibilityMode", "createAgentCompletionStreamRaw", compatibilityMode);
312
+ validateRequired("agentCompletionRequest", "createAgentCompletionStreamRaw", agentCompletionRequest);
313
+ const requestPath = "/agent-studio/1/agents/{agentId}/completions".replace(
314
+ "{agentId}",
315
+ encodeURIComponent(agentId)
316
+ );
317
+ const headers = {};
318
+ const queryParameters = {};
319
+ if (compatibilityMode !== void 0) {
320
+ queryParameters["compatibilityMode"] = compatibilityMode.toString();
321
+ }
322
+ if (stream !== void 0) {
323
+ queryParameters["stream"] = stream.toString();
324
+ }
325
+ if (cache !== void 0) {
326
+ queryParameters["cache"] = cache.toString();
327
+ }
328
+ if (memory !== void 0) {
329
+ queryParameters["memory"] = memory.toString();
330
+ }
331
+ if (analytics !== void 0) {
332
+ queryParameters["analytics"] = analytics.toString();
333
+ }
334
+ if (xAlgoliaSecureUserToken !== void 0) {
335
+ headers["X-Algolia-Secure-User-Token"] = xAlgoliaSecureUserToken.toString();
336
+ }
337
+ const request = {
338
+ method: "POST",
339
+ path: requestPath,
340
+ queryParameters,
341
+ headers,
342
+ data: agentCompletionRequest
343
+ };
344
+ return transporter.requestStream(request, requestOptions);
345
+ },
346
+ /**
347
+ * Create a completion for the specified agent. This endpoint handles two types of requests: 1. Normal completion request: User message -> Agent response 2. Tool approval response: User approval -> Execute tool -> Agent response Tool Approval Flow (for MCP tools with requiresApproval: true): - Request 1: User sends message -> Agent requests tool call -> Return approval request - Request 2: User approves -> Execute tool -> Agent continues with result. (streaming version).
348
+ *
349
+ * Yields {@link StreamEvent} objects wrapping parsed `{ [key: string]: any; }` payloads.
350
+ *
351
+ * @see createAgentCompletionStreamRaw for the raw variant.
352
+ * @see createAgentCompletion for the non-streaming version.
353
+ */
354
+ async *createAgentCompletionStream({
355
+ agentId,
356
+ compatibilityMode,
357
+ agentCompletionRequest,
358
+ stream,
359
+ cache,
360
+ memory,
361
+ analytics,
362
+ xAlgoliaSecureUserToken
363
+ }, requestOptions) {
364
+ for await (const event of this.createAgentCompletionStreamRaw(
365
+ {
366
+ agentId,
367
+ compatibilityMode,
368
+ agentCompletionRequest,
369
+ stream,
370
+ cache,
371
+ memory,
372
+ analytics,
373
+ xAlgoliaSecureUserToken
374
+ },
375
+ requestOptions
376
+ )) {
377
+ try {
378
+ const data = JSON.parse(event.data);
379
+ yield { data, raw: event };
380
+ } catch (e) {
381
+ yield { data: null, raw: event, error: e };
382
+ }
383
+ }
384
+ },
385
+ /**
386
+ * Create new feedback entry.
387
+ *
388
+ * Required API Key ACLs:
389
+ * - search
390
+ * @param feedbackCreationRequest - The feedbackCreationRequest object.
391
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
392
+ */
393
+ createFeedback(feedbackCreationRequest, requestOptions) {
394
+ validateRequired("feedbackCreationRequest", "createFeedback", feedbackCreationRequest);
395
+ validateRequired("feedbackCreationRequest.messageId", "createFeedback", feedbackCreationRequest.messageId);
396
+ validateRequired("feedbackCreationRequest.agentId", "createFeedback", feedbackCreationRequest.agentId);
397
+ validateRequired("feedbackCreationRequest.vote", "createFeedback", feedbackCreationRequest.vote);
398
+ const requestPath = "/agent-studio/1/feedback";
399
+ const headers = {};
400
+ const queryParameters = {};
401
+ const request = {
402
+ method: "POST",
403
+ path: requestPath,
404
+ queryParameters,
405
+ headers,
406
+ data: feedbackCreationRequest
407
+ };
408
+ return transporter.request(request, requestOptions);
409
+ },
410
+ /**
411
+ * Create Provider.
412
+ *
413
+ * Required API Key ACLs:
414
+ * - editSettings
415
+ * @param providerAuthenticationCreate - The providerAuthenticationCreate object.
416
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
417
+ */
418
+ createProvider(providerAuthenticationCreate, requestOptions) {
419
+ validateRequired("providerAuthenticationCreate", "createProvider", providerAuthenticationCreate);
420
+ validateRequired("providerAuthenticationCreate.name", "createProvider", providerAuthenticationCreate.name);
421
+ validateRequired(
422
+ "providerAuthenticationCreate.providerName",
423
+ "createProvider",
424
+ providerAuthenticationCreate.providerName
425
+ );
426
+ validateRequired("providerAuthenticationCreate.input", "createProvider", providerAuthenticationCreate.input);
427
+ const requestPath = "/agent-studio/1/providers";
428
+ const headers = {};
429
+ const queryParameters = {};
430
+ const request = {
431
+ method: "POST",
432
+ path: requestPath,
433
+ queryParameters,
434
+ headers,
435
+ data: providerAuthenticationCreate
436
+ };
437
+ return transporter.request(request, requestOptions);
438
+ },
439
+ /**
440
+ * Create Secret Key.
441
+ *
442
+ * Required API Key ACLs:
443
+ * - admin
444
+ * @param secretKeyCreate - The secretKeyCreate object.
445
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
446
+ */
447
+ createSecretKey(secretKeyCreate, requestOptions) {
448
+ validateRequired("secretKeyCreate", "createSecretKey", secretKeyCreate);
449
+ validateRequired("secretKeyCreate.name", "createSecretKey", secretKeyCreate.name);
450
+ const requestPath = "/agent-studio/1/secret-keys";
451
+ const headers = {};
452
+ const queryParameters = {};
453
+ const request = {
454
+ method: "POST",
455
+ path: requestPath,
456
+ queryParameters,
457
+ headers,
458
+ data: secretKeyCreate
459
+ };
460
+ return transporter.request(request, requestOptions);
461
+ },
462
+ /**
463
+ * This method lets you send requests to the Algolia REST API.
464
+ * @param customDelete - The customDelete object.
465
+ * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
466
+ * @param customDelete.parameters - Query parameters to apply to the current query.
467
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
468
+ */
469
+ customDelete({ path, parameters }, requestOptions) {
470
+ validateRequired("path", "customDelete", path);
471
+ const requestPath = "/agent-studio/{path}".replace("{path}", path);
472
+ const headers = {};
473
+ const queryParameters = parameters ? parameters : {};
474
+ const request = {
475
+ method: "DELETE",
476
+ path: requestPath,
477
+ queryParameters,
478
+ headers
479
+ };
480
+ return transporter.request(request, requestOptions);
481
+ },
482
+ /**
483
+ * This method lets you send requests to the Algolia REST API.
484
+ * @param customGet - The customGet object.
485
+ * @param customGet.path - Path of the endpoint, for example `1/newFeature`.
486
+ * @param customGet.parameters - Query parameters to apply to the current query.
487
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
488
+ */
489
+ customGet({ path, parameters }, requestOptions) {
490
+ validateRequired("path", "customGet", path);
491
+ const requestPath = "/agent-studio/{path}".replace("{path}", path);
492
+ const headers = {};
493
+ const queryParameters = parameters ? parameters : {};
494
+ const request = {
495
+ method: "GET",
496
+ path: requestPath,
497
+ queryParameters,
498
+ headers
499
+ };
500
+ return transporter.request(request, requestOptions);
501
+ },
502
+ /**
503
+ * This method lets you send requests to the Algolia REST API.
504
+ * @param customPost - The customPost object.
505
+ * @param customPost.path - Path of the endpoint, for example `1/newFeature`.
506
+ * @param customPost.parameters - Query parameters to apply to the current query.
507
+ * @param customPost.body - Parameters to send with the custom request.
508
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
509
+ */
510
+ customPost({ path, parameters, body }, requestOptions) {
511
+ validateRequired("path", "customPost", path);
512
+ const requestPath = "/agent-studio/{path}".replace("{path}", path);
513
+ const headers = {};
514
+ const queryParameters = parameters ? parameters : {};
515
+ const request = {
516
+ method: "POST",
517
+ path: requestPath,
518
+ queryParameters,
519
+ headers,
520
+ data: body ? body : {}
521
+ };
522
+ return transporter.request(request, requestOptions);
523
+ },
524
+ /**
525
+ * This method lets you send requests to the Algolia REST API.
526
+ * @param customPut - The customPut object.
527
+ * @param customPut.path - Path of the endpoint, for example `1/newFeature`.
528
+ * @param customPut.parameters - Query parameters to apply to the current query.
529
+ * @param customPut.body - Parameters to send with the custom request.
530
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
531
+ */
532
+ customPut({ path, parameters, body }, requestOptions) {
533
+ validateRequired("path", "customPut", path);
534
+ const requestPath = "/agent-studio/{path}".replace("{path}", path);
535
+ const headers = {};
536
+ const queryParameters = parameters ? parameters : {};
537
+ const request = {
538
+ method: "PUT",
539
+ path: requestPath,
540
+ queryParameters,
541
+ headers,
542
+ data: body ? body : {}
543
+ };
544
+ return transporter.request(request, requestOptions);
545
+ },
546
+ /**
547
+ * Delete the specified agent.
548
+ *
549
+ * Required API Key ACLs:
550
+ * - editSettings
551
+ * @param deleteAgent - The deleteAgent object.
552
+ * @param deleteAgent.agentId - The agentId.
553
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
554
+ */
555
+ deleteAgent({ agentId }, requestOptions) {
556
+ validateRequired("agentId", "deleteAgent", agentId);
557
+ const requestPath = "/agent-studio/1/agents/{agentId}".replace("{agentId}", encodeURIComponent(agentId));
558
+ const headers = {};
559
+ const queryParameters = {};
560
+ const request = {
561
+ method: "DELETE",
562
+ path: requestPath,
563
+ queryParameters,
564
+ headers
565
+ };
566
+ return transporter.request(request, requestOptions);
567
+ },
568
+ /**
569
+ * Deletes the conversations matching the given filers.
570
+ *
571
+ * Required API Key ACLs:
572
+ * - logs
573
+ * @param deleteAgentConversations - The deleteAgentConversations object.
574
+ * @param deleteAgentConversations.agentId - The agentId.
575
+ * @param deleteAgentConversations.startDate - Filter conversations created after this date (format: YYYY-MM-DD).
576
+ * @param deleteAgentConversations.endDate - Filter conversations created before this date (format: YYYY-MM-DD).
577
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
578
+ */
579
+ deleteAgentConversations({ agentId, startDate, endDate }, requestOptions) {
580
+ validateRequired("agentId", "deleteAgentConversations", agentId);
581
+ const requestPath = "/agent-studio/1/agents/{agentId}/conversations".replace(
582
+ "{agentId}",
583
+ encodeURIComponent(agentId)
584
+ );
585
+ const headers = {};
586
+ const queryParameters = {};
587
+ if (startDate !== void 0) {
588
+ queryParameters["startDate"] = startDate.toString();
589
+ }
590
+ if (endDate !== void 0) {
591
+ queryParameters["endDate"] = endDate.toString();
592
+ }
593
+ const request = {
594
+ method: "DELETE",
595
+ path: requestPath,
596
+ queryParameters,
597
+ headers
598
+ };
599
+ return transporter.request(request, requestOptions);
600
+ },
601
+ /**
602
+ * Remove an allowed domain by id.
603
+ *
604
+ * Required API Key ACLs:
605
+ * - editSettings
606
+ * @param deleteAllowedDomain - The deleteAllowedDomain object.
607
+ * @param deleteAllowedDomain.domainId - The domainId.
608
+ * @param deleteAllowedDomain.agentId - The agentId.
609
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
610
+ */
611
+ deleteAllowedDomain({ domainId, agentId }, requestOptions) {
612
+ validateRequired("domainId", "deleteAllowedDomain", domainId);
613
+ validateRequired("agentId", "deleteAllowedDomain", agentId);
614
+ const requestPath = "/agent-studio/1/agents/{agentId}/allowed-domains/{domainId}".replace("{domainId}", encodeURIComponent(domainId)).replace("{agentId}", encodeURIComponent(agentId));
615
+ const headers = {};
616
+ const queryParameters = {};
617
+ const request = {
618
+ method: "DELETE",
619
+ path: requestPath,
620
+ queryParameters,
621
+ headers
622
+ };
623
+ return transporter.request(request, requestOptions);
624
+ },
625
+ /**
626
+ * Deletes the conversation with the given ID.
627
+ *
628
+ * Required API Key ACLs:
629
+ * - logs
630
+ * @param deleteConversation - The deleteConversation object.
631
+ * @param deleteConversation.conversationId - The conversationId.
632
+ * @param deleteConversation.agentId - The agentId.
633
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
634
+ */
635
+ deleteConversation({ conversationId, agentId }, requestOptions) {
636
+ validateRequired("conversationId", "deleteConversation", conversationId);
637
+ validateRequired("agentId", "deleteConversation", agentId);
638
+ const requestPath = "/agent-studio/1/agents/{agentId}/conversations/{conversationId}".replace("{conversationId}", encodeURIComponent(conversationId)).replace("{agentId}", encodeURIComponent(agentId));
639
+ const headers = {};
640
+ const queryParameters = {};
641
+ const request = {
642
+ method: "DELETE",
643
+ path: requestPath,
644
+ queryParameters,
645
+ headers
646
+ };
647
+ return transporter.request(request, requestOptions);
648
+ },
649
+ /**
650
+ * Delete Provider.
651
+ *
652
+ * Required API Key ACLs:
653
+ * - editSettings
654
+ * @param deleteProvider - The deleteProvider object.
655
+ * @param deleteProvider.providerId - The providerId.
656
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
657
+ */
658
+ deleteProvider({ providerId }, requestOptions) {
659
+ validateRequired("providerId", "deleteProvider", providerId);
660
+ const requestPath = "/agent-studio/1/providers/{providerId}".replace(
661
+ "{providerId}",
662
+ encodeURIComponent(providerId)
663
+ );
664
+ const headers = {};
665
+ const queryParameters = {};
666
+ const request = {
667
+ method: "DELETE",
668
+ path: requestPath,
669
+ queryParameters,
670
+ headers
671
+ };
672
+ return transporter.request(request, requestOptions);
673
+ },
674
+ /**
675
+ * Delete Secret Key.
676
+ *
677
+ * Required API Key ACLs:
678
+ * - admin
679
+ * @param deleteSecretKey - The deleteSecretKey object.
680
+ * @param deleteSecretKey.secretKeyId - The secretKeyId.
681
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
682
+ */
683
+ deleteSecretKey({ secretKeyId }, requestOptions) {
684
+ validateRequired("secretKeyId", "deleteSecretKey", secretKeyId);
685
+ const requestPath = "/agent-studio/1/secret-keys/{secretKeyId}".replace(
686
+ "{secretKeyId}",
687
+ encodeURIComponent(secretKeyId)
688
+ );
689
+ const headers = {};
690
+ const queryParameters = {};
691
+ const request = {
692
+ method: "DELETE",
693
+ path: requestPath,
694
+ queryParameters,
695
+ headers
696
+ };
697
+ return transporter.request(request, requestOptions);
698
+ },
699
+ /**
700
+ * Permanently deletes all messages for the given user token. Does not delete conversations.
701
+ *
702
+ * Required API Key ACLs:
703
+ * - logs
704
+ * @param deleteUserData - The deleteUserData object.
705
+ * @param deleteUserData.userToken - The userToken.
706
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
707
+ */
708
+ deleteUserData({ userToken }, requestOptions) {
709
+ validateRequired("userToken", "deleteUserData", userToken);
710
+ const requestPath = "/agent-studio/1/user-data/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
711
+ const headers = {};
712
+ const queryParameters = {};
713
+ const request = {
714
+ method: "DELETE",
715
+ path: requestPath,
716
+ queryParameters,
717
+ headers
718
+ };
719
+ return transporter.request(request, requestOptions);
720
+ },
721
+ /**
722
+ * Exports all conversations based on the passed filters.
723
+ *
724
+ * Required API Key ACLs:
725
+ * - logs
726
+ * @param exportConversations - The exportConversations object.
727
+ * @param exportConversations.agentId - The agentId.
728
+ * @param exportConversations.startDate - Filter conversations created after this date (format: YYYY-MM-DD).
729
+ * @param exportConversations.endDate - Filter conversations created before this date (format: YYYY-MM-DD).
730
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
731
+ */
732
+ exportConversations({ agentId, startDate, endDate }, requestOptions) {
733
+ validateRequired("agentId", "exportConversations", agentId);
734
+ const requestPath = "/agent-studio/1/agents/{agentId}/conversations/export".replace(
735
+ "{agentId}",
736
+ encodeURIComponent(agentId)
737
+ );
738
+ const headers = {};
739
+ const queryParameters = {};
740
+ if (startDate !== void 0) {
741
+ queryParameters["startDate"] = startDate.toString();
742
+ }
743
+ if (endDate !== void 0) {
744
+ queryParameters["endDate"] = endDate.toString();
745
+ }
746
+ const request = {
747
+ method: "GET",
748
+ path: requestPath,
749
+ queryParameters,
750
+ headers
751
+ };
752
+ return transporter.request(request, requestOptions);
753
+ },
754
+ /**
755
+ * Retrieve details of the specified agent.
756
+ *
757
+ * Required API Key ACLs:
758
+ * - settings
759
+ * @param getAgent - The getAgent object.
760
+ * @param getAgent.agentId - The agentId.
761
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
762
+ */
763
+ getAgent({ agentId }, requestOptions) {
764
+ validateRequired("agentId", "getAgent", agentId);
765
+ const requestPath = "/agent-studio/1/agents/{agentId}".replace("{agentId}", encodeURIComponent(agentId));
766
+ const headers = {};
767
+ const queryParameters = {};
768
+ const request = {
769
+ method: "GET",
770
+ path: requestPath,
771
+ queryParameters,
772
+ headers
773
+ };
774
+ return transporter.request(request, requestOptions);
775
+ },
776
+ /**
777
+ * Get a single allowed domain by id.
778
+ *
779
+ * Required API Key ACLs:
780
+ * - settings
781
+ * @param getAllowedDomain - The getAllowedDomain object.
782
+ * @param getAllowedDomain.domainId - The domainId.
783
+ * @param getAllowedDomain.agentId - The agentId.
784
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
785
+ */
786
+ getAllowedDomain({ domainId, agentId }, requestOptions) {
787
+ validateRequired("domainId", "getAllowedDomain", domainId);
788
+ validateRequired("agentId", "getAllowedDomain", agentId);
789
+ const requestPath = "/agent-studio/1/agents/{agentId}/allowed-domains/{domainId}".replace("{domainId}", encodeURIComponent(domainId)).replace("{agentId}", encodeURIComponent(agentId));
790
+ const headers = {};
791
+ const queryParameters = {};
792
+ const request = {
793
+ method: "GET",
794
+ path: requestPath,
795
+ queryParameters,
796
+ headers
797
+ };
798
+ return transporter.request(request, requestOptions);
799
+ },
800
+ /**
801
+ * Get Configuration.
802
+ *
803
+ * Required API Key ACLs:
804
+ * - logs
805
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
806
+ */
807
+ getConfiguration(requestOptions) {
808
+ const requestPath = "/agent-studio/1/configuration";
809
+ const headers = {};
810
+ const queryParameters = {};
811
+ const request = {
812
+ method: "GET",
813
+ path: requestPath,
814
+ queryParameters,
815
+ headers
816
+ };
817
+ return transporter.request(request, requestOptions);
818
+ },
819
+ /**
820
+ * Retrieves the conversation and its messages for the given ID.
821
+ *
822
+ * Required API Key ACLs:
823
+ * - logs
824
+ * @param getConversation - The getConversation object.
825
+ * @param getConversation.conversationId - The conversationId.
826
+ * @param getConversation.agentId - The agentId.
827
+ * @param getConversation.includeFeedback - Include feedback for the conversation.
828
+ * @param getConversation.xAlgoliaSecureUserToken - The X-Algolia-Secure-User-Token.
829
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
830
+ */
831
+ getConversation({ conversationId, agentId, includeFeedback, xAlgoliaSecureUserToken }, requestOptions) {
832
+ validateRequired("conversationId", "getConversation", conversationId);
833
+ validateRequired("agentId", "getConversation", agentId);
834
+ const requestPath = "/agent-studio/1/agents/{agentId}/conversations/{conversationId}".replace("{conversationId}", encodeURIComponent(conversationId)).replace("{agentId}", encodeURIComponent(agentId));
835
+ const headers = {};
836
+ const queryParameters = {};
837
+ if (includeFeedback !== void 0) {
838
+ queryParameters["includeFeedback"] = includeFeedback.toString();
839
+ }
840
+ if (xAlgoliaSecureUserToken !== void 0) {
841
+ headers["X-Algolia-Secure-User-Token"] = xAlgoliaSecureUserToken.toString();
842
+ }
843
+ const request = {
844
+ method: "GET",
845
+ path: requestPath,
846
+ queryParameters,
847
+ headers
848
+ };
849
+ return transporter.request(request, requestOptions);
850
+ },
851
+ /**
852
+ * Get Provider.
853
+ *
854
+ * Required API Key ACLs:
855
+ * - settings
856
+ * @param getProvider - The getProvider object.
857
+ * @param getProvider.providerId - The providerId.
858
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
859
+ */
860
+ getProvider({ providerId }, requestOptions) {
861
+ validateRequired("providerId", "getProvider", providerId);
862
+ const requestPath = "/agent-studio/1/providers/{providerId}".replace(
863
+ "{providerId}",
864
+ encodeURIComponent(providerId)
865
+ );
866
+ const headers = {};
867
+ const queryParameters = {};
868
+ const request = {
869
+ method: "GET",
870
+ path: requestPath,
871
+ queryParameters,
872
+ headers
873
+ };
874
+ return transporter.request(request, requestOptions);
875
+ },
876
+ /**
877
+ * Get Secret Key.
878
+ *
879
+ * Required API Key ACLs:
880
+ * - settings
881
+ * @param getSecretKey - The getSecretKey object.
882
+ * @param getSecretKey.secretKeyId - The secretKeyId.
883
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
884
+ */
885
+ getSecretKey({ secretKeyId }, requestOptions) {
886
+ validateRequired("secretKeyId", "getSecretKey", secretKeyId);
887
+ const requestPath = "/agent-studio/1/secret-keys/{secretKeyId}".replace(
888
+ "{secretKeyId}",
889
+ encodeURIComponent(secretKeyId)
890
+ );
891
+ const headers = {};
892
+ const queryParameters = {};
893
+ const request = {
894
+ method: "GET",
895
+ path: requestPath,
896
+ queryParameters,
897
+ headers
898
+ };
899
+ return transporter.request(request, requestOptions);
900
+ },
901
+ /**
902
+ * Retrieves all memories, conversations and their messages for the given user token.
903
+ *
904
+ * Required API Key ACLs:
905
+ * - logs
906
+ * @param getUserData - The getUserData object.
907
+ * @param getUserData.userToken - The userToken.
908
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
909
+ */
910
+ getUserData({ userToken }, requestOptions) {
911
+ validateRequired("userToken", "getUserData", userToken);
912
+ const requestPath = "/agent-studio/1/user-data/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
913
+ const headers = {};
914
+ const queryParameters = {};
915
+ const request = {
916
+ method: "GET",
917
+ path: requestPath,
918
+ queryParameters,
919
+ headers
920
+ };
921
+ return transporter.request(request, requestOptions);
922
+ },
923
+ /**
924
+ * Invalidate cached completions for this agent. Filter with `before` (exclusive).
925
+ *
926
+ * Required API Key ACLs:
927
+ * - editSettings
928
+ * @param invalidateAgentCache - The invalidateAgentCache object.
929
+ * @param invalidateAgentCache.agentId - The agentId.
930
+ * @param invalidateAgentCache.before - Delete entries strictly before this date (exclusive, YYYY-MM-DD).
931
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
932
+ */
933
+ invalidateAgentCache({ agentId, before }, requestOptions) {
934
+ validateRequired("agentId", "invalidateAgentCache", agentId);
935
+ const requestPath = "/agent-studio/1/agents/{agentId}/cache".replace("{agentId}", encodeURIComponent(agentId));
936
+ const headers = {};
937
+ const queryParameters = {};
938
+ if (before !== void 0) {
939
+ queryParameters["before"] = before.toString();
940
+ }
941
+ const request = {
942
+ method: "DELETE",
943
+ path: requestPath,
944
+ queryParameters,
945
+ headers
946
+ };
947
+ return transporter.request(request, requestOptions);
948
+ },
949
+ /**
950
+ * List all allowed domain patterns for this agent.
951
+ *
952
+ * Required API Key ACLs:
953
+ * - settings
954
+ * @param listAgentAllowedDomains - The listAgentAllowedDomains object.
955
+ * @param listAgentAllowedDomains.agentId - The agentId.
956
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
957
+ */
958
+ listAgentAllowedDomains({ agentId }, requestOptions) {
959
+ validateRequired("agentId", "listAgentAllowedDomains", agentId);
960
+ const requestPath = "/agent-studio/1/agents/{agentId}/allowed-domains".replace(
961
+ "{agentId}",
962
+ encodeURIComponent(agentId)
963
+ );
964
+ const headers = {};
965
+ const queryParameters = {};
966
+ const request = {
967
+ method: "GET",
968
+ path: requestPath,
969
+ queryParameters,
970
+ headers
971
+ };
972
+ return transporter.request(request, requestOptions);
973
+ },
974
+ /**
975
+ * Retrieves the conversations for the given agent ID.
976
+ *
977
+ * Required API Key ACLs:
978
+ * - logs
979
+ * @param listAgentConversations - The listAgentConversations object.
980
+ * @param listAgentConversations.agentId - The agentId.
981
+ * @param listAgentConversations.startDate - Filter conversations created after this date (format: YYYY-MM-DD).
982
+ * @param listAgentConversations.endDate - Filter conversations created before this date (format: YYYY-MM-DD).
983
+ * @param listAgentConversations.includeFeedback - Include feedback per conversation.
984
+ * @param listAgentConversations.feedbackVote - Filter by feedback value (requires includeFeedback=true).
985
+ * @param listAgentConversations.page - Page number.
986
+ * @param listAgentConversations.limit - Items per page.
987
+ * @param listAgentConversations.xAlgoliaSecureUserToken - The X-Algolia-Secure-User-Token.
988
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
989
+ */
990
+ listAgentConversations({
991
+ agentId,
992
+ startDate,
993
+ endDate,
994
+ includeFeedback,
995
+ feedbackVote,
996
+ page,
997
+ limit,
998
+ xAlgoliaSecureUserToken
999
+ }, requestOptions) {
1000
+ validateRequired("agentId", "listAgentConversations", agentId);
1001
+ const requestPath = "/agent-studio/1/agents/{agentId}/conversations".replace(
1002
+ "{agentId}",
1003
+ encodeURIComponent(agentId)
1004
+ );
1005
+ const headers = {};
1006
+ const queryParameters = {};
1007
+ if (startDate !== void 0) {
1008
+ queryParameters["startDate"] = startDate.toString();
1009
+ }
1010
+ if (endDate !== void 0) {
1011
+ queryParameters["endDate"] = endDate.toString();
1012
+ }
1013
+ if (includeFeedback !== void 0) {
1014
+ queryParameters["includeFeedback"] = includeFeedback.toString();
1015
+ }
1016
+ if (feedbackVote !== void 0) {
1017
+ queryParameters["feedbackVote"] = feedbackVote.toString();
1018
+ }
1019
+ if (page !== void 0) {
1020
+ queryParameters["page"] = page.toString();
1021
+ }
1022
+ if (limit !== void 0) {
1023
+ queryParameters["limit"] = limit.toString();
1024
+ }
1025
+ if (xAlgoliaSecureUserToken !== void 0) {
1026
+ headers["X-Algolia-Secure-User-Token"] = xAlgoliaSecureUserToken.toString();
1027
+ }
1028
+ const request = {
1029
+ method: "GET",
1030
+ path: requestPath,
1031
+ queryParameters,
1032
+ headers
1033
+ };
1034
+ return transporter.request(request, requestOptions);
1035
+ },
1036
+ /**
1037
+ * List all agents with pagination and filtering.
1038
+ *
1039
+ * Required API Key ACLs:
1040
+ * - settings
1041
+ * @param listAgents - The listAgents object.
1042
+ * @param listAgents.page - Page number.
1043
+ * @param listAgents.limit - Items per page.
1044
+ * @param listAgents.providerId - Filter by provider id.
1045
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1046
+ */
1047
+ listAgents({ page, limit, providerId } = {}, requestOptions = void 0) {
1048
+ const requestPath = "/agent-studio/1/agents";
1049
+ const headers = {};
1050
+ const queryParameters = {};
1051
+ if (page !== void 0) {
1052
+ queryParameters["page"] = page.toString();
1053
+ }
1054
+ if (limit !== void 0) {
1055
+ queryParameters["limit"] = limit.toString();
1056
+ }
1057
+ if (providerId !== void 0) {
1058
+ queryParameters["providerId"] = providerId.toString();
1059
+ }
1060
+ const request = {
1061
+ method: "GET",
1062
+ path: requestPath,
1063
+ queryParameters,
1064
+ headers
1065
+ };
1066
+ return transporter.request(request, requestOptions);
1067
+ },
1068
+ /**
1069
+ * Get Provider Models.
1070
+ *
1071
+ * Required API Key ACLs:
1072
+ * - settings
1073
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1074
+ */
1075
+ listModels(requestOptions) {
1076
+ const requestPath = "/agent-studio/1/providers/models";
1077
+ const headers = {};
1078
+ const queryParameters = {};
1079
+ const request = {
1080
+ method: "GET",
1081
+ path: requestPath,
1082
+ queryParameters,
1083
+ headers
1084
+ };
1085
+ return transporter.request(request, requestOptions);
1086
+ },
1087
+ /**
1088
+ * Get available models for a specific provider.
1089
+ *
1090
+ * Required API Key ACLs:
1091
+ * - settings
1092
+ * @param listProviderModels - The listProviderModels object.
1093
+ * @param listProviderModels.providerId - The providerId.
1094
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1095
+ */
1096
+ listProviderModels({ providerId }, requestOptions) {
1097
+ validateRequired("providerId", "listProviderModels", providerId);
1098
+ const requestPath = "/agent-studio/1/providers/{providerId}/models".replace(
1099
+ "{providerId}",
1100
+ encodeURIComponent(providerId)
1101
+ );
1102
+ const headers = {};
1103
+ const queryParameters = {};
1104
+ const request = {
1105
+ method: "GET",
1106
+ path: requestPath,
1107
+ queryParameters,
1108
+ headers
1109
+ };
1110
+ return transporter.request(request, requestOptions);
1111
+ },
1112
+ /**
1113
+ * List Providers.
1114
+ *
1115
+ * Required API Key ACLs:
1116
+ * - settings
1117
+ * @param listProviders - The listProviders object.
1118
+ * @param listProviders.page - Page number.
1119
+ * @param listProviders.limit - Items per page.
1120
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1121
+ */
1122
+ listProviders({ page, limit } = {}, requestOptions = void 0) {
1123
+ const requestPath = "/agent-studio/1/providers";
1124
+ const headers = {};
1125
+ const queryParameters = {};
1126
+ if (page !== void 0) {
1127
+ queryParameters["page"] = page.toString();
1128
+ }
1129
+ if (limit !== void 0) {
1130
+ queryParameters["limit"] = limit.toString();
1131
+ }
1132
+ const request = {
1133
+ method: "GET",
1134
+ path: requestPath,
1135
+ queryParameters,
1136
+ headers
1137
+ };
1138
+ return transporter.request(request, requestOptions);
1139
+ },
1140
+ /**
1141
+ * List Secret Keys.
1142
+ *
1143
+ * Required API Key ACLs:
1144
+ * - settings
1145
+ * @param listSecretKeys - The listSecretKeys object.
1146
+ * @param listSecretKeys.page - Page number.
1147
+ * @param listSecretKeys.limit - Items per page.
1148
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1149
+ */
1150
+ listSecretKeys({ page, limit } = {}, requestOptions = void 0) {
1151
+ const requestPath = "/agent-studio/1/secret-keys";
1152
+ const headers = {};
1153
+ const queryParameters = {};
1154
+ if (page !== void 0) {
1155
+ queryParameters["page"] = page.toString();
1156
+ }
1157
+ if (limit !== void 0) {
1158
+ queryParameters["limit"] = limit.toString();
1159
+ }
1160
+ const request = {
1161
+ method: "GET",
1162
+ path: requestPath,
1163
+ queryParameters,
1164
+ headers
1165
+ };
1166
+ return transporter.request(request, requestOptions);
1167
+ },
1168
+ /**
1169
+ * Publish the specified agent.
1170
+ *
1171
+ * Required API Key ACLs:
1172
+ * - editSettings
1173
+ * @param publishAgent - The publishAgent object.
1174
+ * @param publishAgent.agentId - The agentId.
1175
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1176
+ */
1177
+ publishAgent({ agentId }, requestOptions) {
1178
+ validateRequired("agentId", "publishAgent", agentId);
1179
+ const requestPath = "/agent-studio/1/agents/{agentId}/publish".replace("{agentId}", encodeURIComponent(agentId));
1180
+ const headers = {};
1181
+ const queryParameters = {};
1182
+ const request = {
1183
+ method: "POST",
1184
+ path: requestPath,
1185
+ queryParameters,
1186
+ headers
1187
+ };
1188
+ return transporter.request(request, requestOptions);
1189
+ },
1190
+ /**
1191
+ * Unpublish the specified agent.
1192
+ *
1193
+ * Required API Key ACLs:
1194
+ * - editSettings
1195
+ * @param unpublishAgent - The unpublishAgent object.
1196
+ * @param unpublishAgent.agentId - The agentId.
1197
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1198
+ */
1199
+ unpublishAgent({ agentId }, requestOptions) {
1200
+ validateRequired("agentId", "unpublishAgent", agentId);
1201
+ const requestPath = "/agent-studio/1/agents/{agentId}/unpublish".replace(
1202
+ "{agentId}",
1203
+ encodeURIComponent(agentId)
1204
+ );
1205
+ const headers = {};
1206
+ const queryParameters = {};
1207
+ const request = {
1208
+ method: "POST",
1209
+ path: requestPath,
1210
+ queryParameters,
1211
+ headers
1212
+ };
1213
+ return transporter.request(request, requestOptions);
1214
+ },
1215
+ /**
1216
+ * Update the specified agent.
1217
+ *
1218
+ * Required API Key ACLs:
1219
+ * - editSettings
1220
+ * @param updateAgent - The updateAgent object.
1221
+ * @param updateAgent.agentId - The agentId.
1222
+ * @param updateAgent.agentConfigUpdate - The agentConfigUpdate object.
1223
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1224
+ */
1225
+ updateAgent({ agentId, agentConfigUpdate }, requestOptions) {
1226
+ validateRequired("agentId", "updateAgent", agentId);
1227
+ validateRequired("agentConfigUpdate", "updateAgent", agentConfigUpdate);
1228
+ const requestPath = "/agent-studio/1/agents/{agentId}".replace("{agentId}", encodeURIComponent(agentId));
1229
+ const headers = {};
1230
+ const queryParameters = {};
1231
+ const request = {
1232
+ method: "PATCH",
1233
+ path: requestPath,
1234
+ queryParameters,
1235
+ headers,
1236
+ data: agentConfigUpdate
1237
+ };
1238
+ return transporter.request(request, requestOptions);
1239
+ },
1240
+ /**
1241
+ * Patch Configuration.
1242
+ *
1243
+ * Required API Key ACLs:
1244
+ * - logs
1245
+ * @param applicationConfigPatch - The applicationConfigPatch object.
1246
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1247
+ */
1248
+ updateConfiguration(applicationConfigPatch, requestOptions) {
1249
+ validateRequired("applicationConfigPatch", "updateConfiguration", applicationConfigPatch);
1250
+ const requestPath = "/agent-studio/1/configuration";
1251
+ const headers = {};
1252
+ const queryParameters = {};
1253
+ const request = {
1254
+ method: "PATCH",
1255
+ path: requestPath,
1256
+ queryParameters,
1257
+ headers,
1258
+ data: applicationConfigPatch
1259
+ };
1260
+ return transporter.request(request, requestOptions);
1261
+ },
1262
+ /**
1263
+ * Update Provider.
1264
+ *
1265
+ * Required API Key ACLs:
1266
+ * - editSettings
1267
+ * @param updateProvider - The updateProvider object.
1268
+ * @param updateProvider.providerId - The providerId.
1269
+ * @param updateProvider.providerAuthenticationPatch - The providerAuthenticationPatch object.
1270
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1271
+ */
1272
+ updateProvider({ providerId, providerAuthenticationPatch }, requestOptions) {
1273
+ validateRequired("providerId", "updateProvider", providerId);
1274
+ validateRequired("providerAuthenticationPatch", "updateProvider", providerAuthenticationPatch);
1275
+ const requestPath = "/agent-studio/1/providers/{providerId}".replace(
1276
+ "{providerId}",
1277
+ encodeURIComponent(providerId)
1278
+ );
1279
+ const headers = {};
1280
+ const queryParameters = {};
1281
+ const request = {
1282
+ method: "PATCH",
1283
+ path: requestPath,
1284
+ queryParameters,
1285
+ headers,
1286
+ data: providerAuthenticationPatch
1287
+ };
1288
+ return transporter.request(request, requestOptions);
1289
+ },
1290
+ /**
1291
+ * Patch Secret Key.
1292
+ *
1293
+ * Required API Key ACLs:
1294
+ * - admin
1295
+ * @param updateSecretKey - The updateSecretKey object.
1296
+ * @param updateSecretKey.secretKeyId - The secretKeyId.
1297
+ * @param updateSecretKey.secretKeyPatch - The secretKeyPatch object.
1298
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1299
+ */
1300
+ updateSecretKey({ secretKeyId, secretKeyPatch }, requestOptions) {
1301
+ validateRequired("secretKeyId", "updateSecretKey", secretKeyId);
1302
+ validateRequired("secretKeyPatch", "updateSecretKey", secretKeyPatch);
1303
+ const requestPath = "/agent-studio/1/secret-keys/{secretKeyId}".replace(
1304
+ "{secretKeyId}",
1305
+ encodeURIComponent(secretKeyId)
1306
+ );
1307
+ const headers = {};
1308
+ const queryParameters = {};
1309
+ const request = {
1310
+ method: "PATCH",
1311
+ path: requestPath,
1312
+ queryParameters,
1313
+ headers,
1314
+ data: secretKeyPatch
1315
+ };
1316
+ return transporter.request(request, requestOptions);
1317
+ }
1318
+ };
1319
+ }
1320
+
1321
+ // builds/browser.ts
1322
+ function agentStudioClient(appId, apiKey, options) {
1323
+ if (!appId || typeof appId !== "string") {
1324
+ throw new Error("`appId` is missing.");
1325
+ }
1326
+ if (!apiKey || typeof apiKey !== "string") {
1327
+ throw new Error("`apiKey` is missing.");
1328
+ }
1329
+ const { compression: _compression, ...browserOptions } = options || {};
1330
+ return createAgentStudioClient({
1331
+ appId,
1332
+ apiKey,
1333
+ timeouts: {
1334
+ connect: 25e3,
1335
+ read: 25e3,
1336
+ write: 25e3
1337
+ },
1338
+ logger: createNullLogger(),
1339
+ requester: createXhrRequester(),
1340
+ algoliaAgents: [{ segment: "Browser" }],
1341
+ authMode: "WithinQueryParameters",
1342
+ responsesCache: createMemoryCache(),
1343
+ requestsCache: createMemoryCache({ serializable: false }),
1344
+ hostsCache: createFallbackableCache({
1345
+ caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()]
1346
+ }),
1347
+ ...browserOptions
1348
+ });
1349
+ }
1350
+ export {
1351
+ agentStudioClient,
1352
+ apiClientVersion
1353
+ };
1354
+ //# sourceMappingURL=browser.js.map