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