@pidgeon-ai/sdk 0.1.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -20,144 +20,1571 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- Pidgeon: () => Pidgeon,
24
- PidgeonError: () => PidgeonError,
25
23
  SIGNATURE_HEADER: () => SIGNATURE_HEADER,
26
24
  TIMESTAMP_HEADER: () => TIMESTAMP_HEADER,
27
- verifyWebhook: () => verifyWebhook
25
+ agentAttachHuman: () => agentAttachHuman,
26
+ agentSignUp: () => agentSignUp,
27
+ agentVerify: () => agentVerify,
28
+ appPasswordsCreate: () => appPasswordsCreate,
29
+ appPasswordsList: () => appPasswordsList,
30
+ appPasswordsRevoke: () => appPasswordsRevoke,
31
+ attachmentsDownloadUrl: () => attachmentsDownloadUrl,
32
+ attachmentsUpload: () => attachmentsUpload,
33
+ calendarCreateEvent: () => calendarCreateEvent,
34
+ calendarDeleteEvent: () => calendarDeleteEvent,
35
+ calendarGet: () => calendarGet,
36
+ calendarGetAgenda: () => calendarGetAgenda,
37
+ calendarGetEvent: () => calendarGetEvent,
38
+ calendarListEventInstances: () => calendarListEventInstances,
39
+ calendarListEvents: () => calendarListEvents,
40
+ calendarRespondToEvent: () => calendarRespondToEvent,
41
+ calendarUpdate: () => calendarUpdate,
42
+ calendarUpdateEvent: () => calendarUpdateEvent,
43
+ client: () => client,
44
+ createClient: () => createClient,
45
+ createConfig: () => createConfig,
46
+ domainsCreate: () => domainsCreate,
47
+ domainsDelete: () => domainsDelete,
48
+ domainsGet: () => domainsGet,
49
+ domainsGetSetupLink: () => domainsGetSetupLink,
50
+ domainsList: () => domainsList,
51
+ domainsUpdate: () => domainsUpdate,
52
+ domainsVerify: () => domainsVerify,
53
+ domainsZoneFile: () => domainsZoneFile,
54
+ draftsCancelSchedule: () => draftsCancelSchedule,
55
+ draftsCreate: () => draftsCreate,
56
+ draftsDelete: () => draftsDelete,
57
+ draftsGet: () => draftsGet,
58
+ draftsList: () => draftsList,
59
+ draftsRemoveAttachment: () => draftsRemoveAttachment,
60
+ draftsSchedule: () => draftsSchedule,
61
+ draftsSend: () => draftsSend,
62
+ draftsUpdate: () => draftsUpdate,
63
+ eventsGet: () => eventsGet,
64
+ eventsList: () => eventsList,
65
+ identitiesAccessCreate: () => identitiesAccessCreate,
66
+ identitiesAccessDelete: () => identitiesAccessDelete,
67
+ identitiesAccessGet: () => identitiesAccessGet,
68
+ identitiesCreate: () => identitiesCreate,
69
+ identitiesDelete: () => identitiesDelete,
70
+ identitiesGet: () => identitiesGet,
71
+ identitiesList: () => identitiesList,
72
+ identitiesReceiveRulesCreate: () => identitiesReceiveRulesCreate,
73
+ identitiesReceiveRulesDelete: () => identitiesReceiveRulesDelete,
74
+ identitiesReceiveRulesGet: () => identitiesReceiveRulesGet,
75
+ identitiesSendRulesCreate: () => identitiesSendRulesCreate,
76
+ identitiesSendRulesDelete: () => identitiesSendRulesDelete,
77
+ identitiesSendRulesGet: () => identitiesSendRulesGet,
78
+ identitiesSuspendTenant: () => identitiesSuspendTenant,
79
+ identitiesUpdate: () => identitiesUpdate,
80
+ keysCreate: () => keysCreate,
81
+ keysGet: () => keysGet,
82
+ keysList: () => keysList,
83
+ keysRevoke: () => keysRevoke,
84
+ keysUpdate: () => keysUpdate,
85
+ labelsCreate: () => labelsCreate,
86
+ labelsDelete: () => labelsDelete,
87
+ labelsList: () => labelsList,
88
+ labelsUpdate: () => labelsUpdate,
89
+ mailboxesChanges: () => mailboxesChanges,
90
+ mailboxesEmptyTrash: () => mailboxesEmptyTrash,
91
+ mailboxesList: () => mailboxesList,
92
+ mailboxesListFolder: () => mailboxesListFolder,
93
+ messagesAct: () => messagesAct,
94
+ messagesForward: () => messagesForward,
95
+ messagesGet: () => messagesGet,
96
+ messagesListInThread: () => messagesListInThread,
97
+ messagesRaw: () => messagesRaw,
98
+ messagesReply: () => messagesReply,
99
+ messagesReplyAll: () => messagesReplyAll,
100
+ messagesRespondToInvitation: () => messagesRespondToInvitation,
101
+ messagesSearch: () => messagesSearch,
102
+ messagesSend: () => messagesSend,
103
+ messagesUndo: () => messagesUndo,
104
+ messagesUpdate: () => messagesUpdate,
105
+ metricsQuery: () => metricsQuery,
106
+ routingCreate: () => routingCreate,
107
+ routingDelete: () => routingDelete,
108
+ routingList: () => routingList,
109
+ routingUpdate: () => routingUpdate,
110
+ threadsGet: () => threadsGet,
111
+ threadsLabelsCreate: () => threadsLabelsCreate,
112
+ threadsLabelsDelete: () => threadsLabelsDelete,
113
+ threadsLabelsGet: () => threadsLabelsGet,
114
+ threadsList: () => threadsList,
115
+ threadsUpdate: () => threadsUpdate,
116
+ verifyWebhook: () => verifyWebhook,
117
+ webhooksCreate: () => webhooksCreate,
118
+ webhooksDelete: () => webhooksDelete,
119
+ webhooksDeliveries: () => webhooksDeliveries,
120
+ webhooksGet: () => webhooksGet,
121
+ webhooksGetHeaders: () => webhooksGetHeaders,
122
+ webhooksList: () => webhooksList,
123
+ webhooksReplay: () => webhooksReplay,
124
+ webhooksUpdate: () => webhooksUpdate,
125
+ webhooksUpdateHeaders: () => webhooksUpdateHeaders,
126
+ workspaceGet: () => workspaceGet,
127
+ workspaceMembers: () => workspaceMembers
28
128
  });
29
129
  module.exports = __toCommonJS(index_exports);
30
130
 
31
- // src/client.ts
32
- var PidgeonError = class extends Error {
33
- code;
34
- status;
35
- field;
36
- requestId;
37
- constructor(input) {
38
- super(input.message);
39
- this.name = "PidgeonError";
40
- this.code = input.code;
41
- this.status = input.status;
42
- this.field = input.field;
43
- this.requestId = input.requestId;
44
- }
45
- };
46
- var DEFAULT_BASE_URL = "https://pidgeon.ai/api/v1";
47
- var Pidgeon = class {
48
- #apiKey;
49
- #baseUrl;
50
- #fetch;
51
- constructor(options) {
52
- if (!options.apiKey) throw new Error("An API key is required.");
53
- this.#apiKey = options.apiKey;
54
- this.#baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
55
- this.#fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
56
- }
57
- async #request(method, path, options = {}) {
58
- const url = new URL(`${this.#baseUrl}${path}`);
59
- for (const [key, value] of Object.entries(options.query ?? {})) {
60
- if (value !== void 0) url.searchParams.set(key, String(value));
61
- }
62
- const response = await this.#fetch(url, {
63
- method,
64
- headers: {
65
- Authorization: `Bearer ${this.#apiKey}`,
66
- ...options.body ? { "Content-Type": "application/json" } : {}
67
- },
68
- body: options.body ? JSON.stringify(options.body) : void 0
131
+ // src/generated/core/bodySerializer.gen.ts
132
+ var serializeFormDataPair = (data, key, value) => {
133
+ if (typeof value === "string" || value instanceof Blob) {
134
+ data.append(key, value);
135
+ } else if (value instanceof Date) {
136
+ data.append(key, value.toISOString());
137
+ } else {
138
+ data.append(key, JSON.stringify(value));
139
+ }
140
+ };
141
+ var formDataBodySerializer = {
142
+ bodySerializer: (body) => {
143
+ const data = new FormData();
144
+ Object.entries(body).forEach(([key, value]) => {
145
+ if (value === void 0 || value === null) {
146
+ return;
147
+ }
148
+ if (Array.isArray(value)) {
149
+ value.forEach((v) => serializeFormDataPair(data, key, v));
150
+ } else {
151
+ serializeFormDataPair(data, key, value);
152
+ }
69
153
  });
70
- const requestId = response.headers.get("x-request-id") ?? void 0;
71
- const payload = await response.json().catch(() => null);
72
- if (!response.ok || payload?.error) {
73
- throw new PidgeonError({
74
- code: payload?.error?.code ?? "internal",
75
- message: payload?.error?.message ?? `Request failed with ${response.status}.`,
76
- status: response.status,
77
- field: payload?.error?.field,
78
- requestId
79
- });
80
- }
81
- return payload?.data;
82
- }
83
- // --- identities ---------------------------------------------------------
84
- identities = {
85
- list: () => this.#request("GET", "/identities"),
86
- get: (id) => this.#request("GET", `/identities/${id}`),
87
- create: (input) => this.#request("POST", "/identities", { body: input }),
88
- update: (id, input) => this.#request("PATCH", `/identities/${id}`, { body: input }),
89
- delete: (id) => this.#request("DELETE", `/identities/${id}`)
90
- };
91
- // --- messages -----------------------------------------------------------
92
- messages = {
93
- get: (id) => this.#request("GET", `/messages/${id}`),
94
- listInThread: (threadId, options = {}) => this.#requestPage("GET", "/messages", {
95
- thread_id: threadId,
96
- limit: options.limit
97
- }),
98
- send: (input) => this.#request(
99
- "POST",
100
- "/messages",
101
- { body: input }
102
- )
103
- };
104
- attachments = {
105
- /** A short-lived signed URL. Fetch it when you need it, don't store it. */
106
- downloadUrl: (id) => this.#request("GET", `/attachments/${id}`)
154
+ return data;
155
+ }
156
+ };
157
+ var jsonBodySerializer = {
158
+ bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
159
+ };
160
+
161
+ // src/generated/core/serverSentEvents.gen.ts
162
+ function createSseClient({
163
+ onRequest,
164
+ onSseError,
165
+ onSseEvent,
166
+ responseTransformer,
167
+ responseValidator,
168
+ sseDefaultRetryDelay,
169
+ sseMaxRetryAttempts,
170
+ sseMaxRetryDelay,
171
+ sseSleepFn,
172
+ url,
173
+ ...options
174
+ }) {
175
+ let lastEventId;
176
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
177
+ const createStream = async function* () {
178
+ let retryDelay = sseDefaultRetryDelay ?? 3e3;
179
+ let attempt = 0;
180
+ const signal = options.signal ?? new AbortController().signal;
181
+ while (true) {
182
+ if (signal.aborted) break;
183
+ attempt++;
184
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
185
+ if (lastEventId !== void 0) {
186
+ headers.set("Last-Event-ID", lastEventId);
187
+ }
188
+ try {
189
+ const requestInit = {
190
+ redirect: "follow",
191
+ ...options,
192
+ body: options.serializedBody,
193
+ headers,
194
+ signal
195
+ };
196
+ let request = new Request(url, requestInit);
197
+ if (onRequest) {
198
+ request = await onRequest(url, requestInit);
199
+ }
200
+ const _fetch = options.fetch ?? globalThis.fetch;
201
+ const response = await _fetch(request);
202
+ if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
203
+ if (!response.body) throw new Error("No body in SSE response");
204
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
205
+ let buffer = "";
206
+ const abortHandler = () => {
207
+ try {
208
+ reader.cancel();
209
+ } catch {
210
+ }
211
+ };
212
+ signal.addEventListener("abort", abortHandler);
213
+ try {
214
+ while (true) {
215
+ const { done, value } = await reader.read();
216
+ if (done) break;
217
+ buffer += value;
218
+ buffer = buffer.replace(/\r\n?/g, "\n");
219
+ const chunks = buffer.split("\n\n");
220
+ buffer = chunks.pop() ?? "";
221
+ for (const chunk of chunks) {
222
+ const lines = chunk.split("\n");
223
+ const dataLines = [];
224
+ let eventName;
225
+ for (const line of lines) {
226
+ if (line.startsWith("data:")) {
227
+ dataLines.push(line.replace(/^data:\s*/, ""));
228
+ } else if (line.startsWith("event:")) {
229
+ eventName = line.replace(/^event:\s*/, "");
230
+ } else if (line.startsWith("id:")) {
231
+ lastEventId = line.replace(/^id:\s*/, "");
232
+ } else if (line.startsWith("retry:")) {
233
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
234
+ if (!Number.isNaN(parsed)) {
235
+ retryDelay = parsed;
236
+ }
237
+ }
238
+ }
239
+ let data;
240
+ let parsedJson = false;
241
+ if (dataLines.length) {
242
+ const rawData = dataLines.join("\n");
243
+ try {
244
+ data = JSON.parse(rawData);
245
+ parsedJson = true;
246
+ } catch {
247
+ data = rawData;
248
+ }
249
+ }
250
+ if (parsedJson) {
251
+ if (responseValidator) {
252
+ await responseValidator(data);
253
+ }
254
+ if (responseTransformer) {
255
+ data = await responseTransformer(data);
256
+ }
257
+ }
258
+ onSseEvent?.({
259
+ data,
260
+ event: eventName,
261
+ id: lastEventId,
262
+ retry: retryDelay
263
+ });
264
+ if (dataLines.length) {
265
+ yield data;
266
+ }
267
+ }
268
+ }
269
+ } finally {
270
+ signal.removeEventListener("abort", abortHandler);
271
+ reader.releaseLock();
272
+ }
273
+ break;
274
+ } catch (error) {
275
+ onSseError?.(error);
276
+ if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
277
+ break;
278
+ }
279
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
280
+ await sleep(backoff);
281
+ }
282
+ }
107
283
  };
108
- // --- threads ------------------------------------------------------------
109
- threads = {
110
- list: (options = {}) => this.#requestPage("GET", "/threads", options),
111
- get: (id) => this.#request("GET", `/threads/${id}`),
112
- update: (id, input) => this.#request("PATCH", `/threads/${id}`, { body: input }),
113
- /** Hand the conversation to a person. The takeover primitive, named. */
114
- handOff: (id) => this.#request("PATCH", `/threads/${id}`, {
115
- body: { owner_type: "human", status: "human_review" }
284
+ const stream = createStream();
285
+ return { stream };
286
+ }
287
+
288
+ // src/generated/core/pathSerializer.gen.ts
289
+ var separatorArrayExplode = (style) => {
290
+ switch (style) {
291
+ case "label":
292
+ return ".";
293
+ case "matrix":
294
+ return ";";
295
+ case "simple":
296
+ return ",";
297
+ default:
298
+ return "&";
299
+ }
300
+ };
301
+ var separatorArrayNoExplode = (style) => {
302
+ switch (style) {
303
+ case "form":
304
+ return ",";
305
+ case "pipeDelimited":
306
+ return "|";
307
+ case "spaceDelimited":
308
+ return "%20";
309
+ default:
310
+ return ",";
311
+ }
312
+ };
313
+ var separatorObjectExplode = (style) => {
314
+ switch (style) {
315
+ case "label":
316
+ return ".";
317
+ case "matrix":
318
+ return ";";
319
+ case "simple":
320
+ return ",";
321
+ default:
322
+ return "&";
323
+ }
324
+ };
325
+ var serializeArrayParam = ({
326
+ allowReserved,
327
+ explode,
328
+ name,
329
+ style,
330
+ value
331
+ }) => {
332
+ if (!explode) {
333
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
334
+ switch (style) {
335
+ case "label":
336
+ return `.${joinedValues2}`;
337
+ case "matrix":
338
+ return `;${name}=${joinedValues2}`;
339
+ case "simple":
340
+ return joinedValues2;
341
+ default:
342
+ return `${name}=${joinedValues2}`;
343
+ }
344
+ }
345
+ const separator = separatorArrayExplode(style);
346
+ const joinedValues = value.map((v) => {
347
+ if (style === "label" || style === "simple") {
348
+ return allowReserved ? v : encodeURIComponent(v);
349
+ }
350
+ return serializePrimitiveParam({
351
+ allowReserved,
352
+ name,
353
+ value: v
354
+ });
355
+ }).join(separator);
356
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
357
+ };
358
+ var serializePrimitiveParam = ({
359
+ allowReserved,
360
+ name,
361
+ value
362
+ }) => {
363
+ if (value === void 0 || value === null) {
364
+ return "";
365
+ }
366
+ if (typeof value === "object") {
367
+ throw new Error(
368
+ "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
369
+ );
370
+ }
371
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
372
+ };
373
+ var serializeObjectParam = ({
374
+ allowReserved,
375
+ explode,
376
+ name,
377
+ style,
378
+ value,
379
+ valueOnly
380
+ }) => {
381
+ if (value instanceof Date) {
382
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
383
+ }
384
+ if (style !== "deepObject" && !explode) {
385
+ let values = [];
386
+ Object.entries(value).forEach(([key, v]) => {
387
+ values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
388
+ });
389
+ const joinedValues2 = values.join(",");
390
+ switch (style) {
391
+ case "form":
392
+ return `${name}=${joinedValues2}`;
393
+ case "label":
394
+ return `.${joinedValues2}`;
395
+ case "matrix":
396
+ return `;${name}=${joinedValues2}`;
397
+ default:
398
+ return joinedValues2;
399
+ }
400
+ }
401
+ const separator = separatorObjectExplode(style);
402
+ const joinedValues = Object.entries(value).map(
403
+ ([key, v]) => serializePrimitiveParam({
404
+ allowReserved,
405
+ name: style === "deepObject" ? `${name}[${key}]` : key,
406
+ value: v
116
407
  })
408
+ ).join(separator);
409
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
410
+ };
411
+
412
+ // src/generated/core/utils.gen.ts
413
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
414
+ var defaultPathSerializer = ({ path, url: _url }) => {
415
+ let url = _url;
416
+ const matches = _url.match(PATH_PARAM_RE);
417
+ if (matches) {
418
+ for (const match of matches) {
419
+ let explode = false;
420
+ let name = match.substring(1, match.length - 1);
421
+ let style = "simple";
422
+ if (name.endsWith("*")) {
423
+ explode = true;
424
+ name = name.substring(0, name.length - 1);
425
+ }
426
+ if (name.startsWith(".")) {
427
+ name = name.substring(1);
428
+ style = "label";
429
+ } else if (name.startsWith(";")) {
430
+ name = name.substring(1);
431
+ style = "matrix";
432
+ }
433
+ const value = path[name];
434
+ if (value === void 0 || value === null) {
435
+ continue;
436
+ }
437
+ if (Array.isArray(value)) {
438
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
439
+ continue;
440
+ }
441
+ if (typeof value === "object") {
442
+ url = url.replace(
443
+ match,
444
+ serializeObjectParam({
445
+ explode,
446
+ name,
447
+ style,
448
+ value,
449
+ valueOnly: true
450
+ })
451
+ );
452
+ continue;
453
+ }
454
+ if (style === "matrix") {
455
+ url = url.replace(
456
+ match,
457
+ `;${serializePrimitiveParam({
458
+ name,
459
+ value
460
+ })}`
461
+ );
462
+ continue;
463
+ }
464
+ const replaceValue = encodeURIComponent(
465
+ style === "label" ? `.${value}` : value
466
+ );
467
+ url = url.replace(match, replaceValue);
468
+ }
469
+ }
470
+ return url;
471
+ };
472
+ var getUrl = ({
473
+ baseUrl,
474
+ path,
475
+ query,
476
+ querySerializer,
477
+ url: _url
478
+ }) => {
479
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
480
+ let url = (baseUrl ?? "") + pathUrl;
481
+ if (path) {
482
+ url = defaultPathSerializer({ path, url });
483
+ }
484
+ let search = query ? querySerializer(query) : "";
485
+ if (search.startsWith("?")) {
486
+ search = search.substring(1);
487
+ }
488
+ if (search) {
489
+ url += `?${search}`;
490
+ }
491
+ return url;
492
+ };
493
+ function getValidRequestBody(options) {
494
+ const hasBody = options.body !== void 0;
495
+ const isSerializedBody = hasBody && options.bodySerializer;
496
+ if (isSerializedBody) {
497
+ if ("serializedBody" in options) {
498
+ const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
499
+ return hasSerializedBody ? options.serializedBody : null;
500
+ }
501
+ return options.body !== "" ? options.body : null;
502
+ }
503
+ if (hasBody) {
504
+ return options.body;
505
+ }
506
+ return void 0;
507
+ }
508
+
509
+ // src/generated/core/auth.gen.ts
510
+ var getAuthToken = async (auth, callback) => {
511
+ const token = typeof callback === "function" ? await callback(auth) : callback;
512
+ if (!token) {
513
+ return;
514
+ }
515
+ if (auth.scheme === "bearer") {
516
+ return `Bearer ${token}`;
517
+ }
518
+ if (auth.scheme === "basic") {
519
+ return `Basic ${btoa(token)}`;
520
+ }
521
+ return token;
522
+ };
523
+
524
+ // src/generated/client/utils.gen.ts
525
+ var createQuerySerializer = ({
526
+ parameters = {},
527
+ ...args
528
+ } = {}) => {
529
+ const querySerializer = (queryParams) => {
530
+ const search = [];
531
+ if (queryParams && typeof queryParams === "object") {
532
+ for (const name in queryParams) {
533
+ const value = queryParams[name];
534
+ if (value === void 0 || value === null) {
535
+ continue;
536
+ }
537
+ const options = parameters[name] || args;
538
+ if (Array.isArray(value)) {
539
+ const serializedArray = serializeArrayParam({
540
+ allowReserved: options.allowReserved,
541
+ explode: true,
542
+ name,
543
+ style: "form",
544
+ value,
545
+ ...options.array
546
+ });
547
+ if (serializedArray) search.push(serializedArray);
548
+ } else if (typeof value === "object") {
549
+ const serializedObject = serializeObjectParam({
550
+ allowReserved: options.allowReserved,
551
+ explode: true,
552
+ name,
553
+ style: "deepObject",
554
+ value,
555
+ ...options.object
556
+ });
557
+ if (serializedObject) search.push(serializedObject);
558
+ } else {
559
+ const serializedPrimitive = serializePrimitiveParam({
560
+ allowReserved: options.allowReserved,
561
+ name,
562
+ value
563
+ });
564
+ if (serializedPrimitive) search.push(serializedPrimitive);
565
+ }
566
+ }
567
+ }
568
+ return search.join("&");
117
569
  };
118
- // --- webhooks -----------------------------------------------------------
119
- webhooks = {
120
- list: () => this.#request("GET", "/webhooks"),
121
- /** The response carries `secret`, once. Store it before you discard it. */
122
- create: (input) => this.#request("POST", "/webhooks", { body: input }),
123
- delete: (id) => this.#request("DELETE", `/webhooks/${id}`)
124
- };
125
- // --- events -------------------------------------------------------------
126
- events = {
127
- list: (options = {}) => this.#requestPage("GET", "/events", options),
128
- get: (id) => this.#request("GET", `/events/${id}`)
570
+ return querySerializer;
571
+ };
572
+ var getParseAs = (contentType) => {
573
+ if (!contentType) {
574
+ return "stream";
575
+ }
576
+ const cleanContent = contentType.split(";")[0]?.trim();
577
+ if (!cleanContent) {
578
+ return;
579
+ }
580
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
581
+ return "json";
582
+ }
583
+ if (cleanContent === "multipart/form-data") {
584
+ return "formData";
585
+ }
586
+ if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
587
+ return "blob";
588
+ }
589
+ if (cleanContent.startsWith("text/")) {
590
+ return "text";
591
+ }
592
+ return;
593
+ };
594
+ var checkForExistence = (options, name) => {
595
+ if (!name) {
596
+ return false;
597
+ }
598
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
599
+ return true;
600
+ }
601
+ return false;
602
+ };
603
+ async function setAuthParams(options) {
604
+ for (const auth of options.security ?? []) {
605
+ if (checkForExistence(options, auth.name)) {
606
+ continue;
607
+ }
608
+ const token = await getAuthToken(auth, options.auth);
609
+ if (!token) {
610
+ continue;
611
+ }
612
+ const name = auth.name ?? "Authorization";
613
+ switch (auth.in) {
614
+ case "query":
615
+ if (!options.query) {
616
+ options.query = {};
617
+ }
618
+ options.query[name] = token;
619
+ break;
620
+ case "cookie":
621
+ options.headers.append("Cookie", `${name}=${token}`);
622
+ break;
623
+ case "header":
624
+ default:
625
+ options.headers.set(name, token);
626
+ break;
627
+ }
628
+ }
629
+ }
630
+ var buildUrl = (options) => getUrl({
631
+ baseUrl: options.baseUrl,
632
+ path: options.path,
633
+ query: options.query,
634
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
635
+ url: options.url
636
+ });
637
+ var mergeConfigs = (a, b) => {
638
+ const config = { ...a, ...b };
639
+ if (config.baseUrl?.endsWith("/")) {
640
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
641
+ }
642
+ config.headers = mergeHeaders(a.headers, b.headers);
643
+ return config;
644
+ };
645
+ var headersEntries = (headers) => {
646
+ const entries = [];
647
+ headers.forEach((value, key) => {
648
+ entries.push([key, value]);
649
+ });
650
+ return entries;
651
+ };
652
+ var mergeHeaders = (...headers) => {
653
+ const mergedHeaders = new Headers();
654
+ for (const header of headers) {
655
+ if (!header) {
656
+ continue;
657
+ }
658
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
659
+ for (const [key, value] of iterator) {
660
+ if (value === null) {
661
+ mergedHeaders.delete(key);
662
+ } else if (Array.isArray(value)) {
663
+ for (const v of value) {
664
+ mergedHeaders.append(key, v);
665
+ }
666
+ } else if (value !== void 0) {
667
+ mergedHeaders.set(
668
+ key,
669
+ typeof value === "object" ? JSON.stringify(value) : value
670
+ );
671
+ }
672
+ }
673
+ }
674
+ return mergedHeaders;
675
+ };
676
+ var Interceptors = class {
677
+ fns = [];
678
+ clear() {
679
+ this.fns = [];
680
+ }
681
+ eject(id) {
682
+ const index = this.getInterceptorIndex(id);
683
+ if (this.fns[index]) {
684
+ this.fns[index] = null;
685
+ }
686
+ }
687
+ exists(id) {
688
+ const index = this.getInterceptorIndex(id);
689
+ return Boolean(this.fns[index]);
690
+ }
691
+ getInterceptorIndex(id) {
692
+ if (typeof id === "number") {
693
+ return this.fns[id] ? id : -1;
694
+ }
695
+ return this.fns.indexOf(id);
696
+ }
697
+ update(id, fn) {
698
+ const index = this.getInterceptorIndex(id);
699
+ if (this.fns[index]) {
700
+ this.fns[index] = fn;
701
+ return id;
702
+ }
703
+ return false;
704
+ }
705
+ use(fn) {
706
+ this.fns.push(fn);
707
+ return this.fns.length - 1;
708
+ }
709
+ };
710
+ var createInterceptors = () => ({
711
+ error: new Interceptors(),
712
+ request: new Interceptors(),
713
+ response: new Interceptors()
714
+ });
715
+ var defaultQuerySerializer = createQuerySerializer({
716
+ allowReserved: false,
717
+ array: {
718
+ explode: true,
719
+ style: "form"
720
+ },
721
+ object: {
722
+ explode: true,
723
+ style: "deepObject"
724
+ }
725
+ });
726
+ var defaultHeaders = {
727
+ "Content-Type": "application/json"
728
+ };
729
+ var createConfig = (override = {}) => ({
730
+ ...jsonBodySerializer,
731
+ headers: defaultHeaders,
732
+ parseAs: "auto",
733
+ querySerializer: defaultQuerySerializer,
734
+ ...override
735
+ });
736
+
737
+ // src/generated/client/client.gen.ts
738
+ var createClient = (config = {}) => {
739
+ let _config = mergeConfigs(createConfig(), config);
740
+ const getConfig = () => ({ ..._config });
741
+ const setConfig = (config2) => {
742
+ _config = mergeConfigs(_config, config2);
743
+ return getConfig();
129
744
  };
130
- domains = {
131
- /** Read-only. Adding and verifying a domain is a DNS-and-a-human task. */
132
- list: () => this.#request("GET", "/domains")
745
+ const interceptors = createInterceptors();
746
+ const beforeRequest = async (options) => {
747
+ const opts = {
748
+ ..._config,
749
+ ...options,
750
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
751
+ headers: mergeHeaders(_config.headers, options.headers),
752
+ serializedBody: void 0
753
+ };
754
+ if (opts.security) {
755
+ await setAuthParams(opts);
756
+ }
757
+ if (opts.requestValidator) {
758
+ await opts.requestValidator(opts);
759
+ }
760
+ if (opts.body !== void 0 && opts.bodySerializer) {
761
+ opts.serializedBody = opts.bodySerializer(opts.body);
762
+ }
763
+ if (opts.body === void 0 || opts.serializedBody === "") {
764
+ opts.headers.delete("Content-Type");
765
+ }
766
+ const resolvedOpts = opts;
767
+ const url = buildUrl(resolvedOpts);
768
+ return { opts: resolvedOpts, url };
133
769
  };
134
- async #requestPage(method, path, query) {
135
- const url = new URL(`${this.#baseUrl}${path}`);
136
- for (const [key, value] of Object.entries(query)) {
137
- if (value !== void 0) url.searchParams.set(key, String(value));
770
+ const request = async (options) => {
771
+ const throwOnError = options.throwOnError ?? _config.throwOnError;
772
+ const responseStyle = options.responseStyle ?? _config.responseStyle;
773
+ let request2;
774
+ let response;
775
+ try {
776
+ const { opts, url } = await beforeRequest(options);
777
+ const requestInit = {
778
+ redirect: "follow",
779
+ ...opts,
780
+ body: getValidRequestBody(opts)
781
+ };
782
+ request2 = new Request(url, requestInit);
783
+ for (const fn of interceptors.request.fns) {
784
+ if (fn) {
785
+ request2 = await fn(request2, opts);
786
+ }
787
+ }
788
+ const _fetch = opts.fetch;
789
+ response = await _fetch(request2);
790
+ for (const fn of interceptors.response.fns) {
791
+ if (fn) {
792
+ response = await fn(response, request2, opts);
793
+ }
794
+ }
795
+ const result = {
796
+ request: request2,
797
+ response
798
+ };
799
+ if (response.ok) {
800
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
801
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
802
+ let emptyData;
803
+ switch (parseAs) {
804
+ case "arrayBuffer":
805
+ case "blob":
806
+ case "text":
807
+ emptyData = await response[parseAs]();
808
+ break;
809
+ case "formData":
810
+ emptyData = new FormData();
811
+ break;
812
+ case "stream":
813
+ emptyData = response.body;
814
+ break;
815
+ case "json":
816
+ default:
817
+ emptyData = {};
818
+ break;
819
+ }
820
+ return opts.responseStyle === "data" ? emptyData : {
821
+ data: emptyData,
822
+ ...result
823
+ };
824
+ }
825
+ let data;
826
+ switch (parseAs) {
827
+ case "arrayBuffer":
828
+ case "blob":
829
+ case "formData":
830
+ case "text":
831
+ data = await response[parseAs]();
832
+ break;
833
+ case "json": {
834
+ const text = await response.text();
835
+ data = text ? JSON.parse(text) : {};
836
+ break;
837
+ }
838
+ case "stream":
839
+ return opts.responseStyle === "data" ? response.body : {
840
+ data: response.body,
841
+ ...result
842
+ };
843
+ }
844
+ if (parseAs === "json") {
845
+ if (opts.responseValidator) {
846
+ await opts.responseValidator(data);
847
+ }
848
+ if (opts.responseTransformer) {
849
+ data = await opts.responseTransformer(data);
850
+ }
851
+ }
852
+ return opts.responseStyle === "data" ? data : {
853
+ data,
854
+ ...result
855
+ };
856
+ }
857
+ const textError = await response.text();
858
+ let jsonError;
859
+ try {
860
+ jsonError = JSON.parse(textError);
861
+ } catch {
862
+ }
863
+ throw jsonError ?? textError;
864
+ } catch (error) {
865
+ let finalError = error;
866
+ for (const fn of interceptors.error.fns) {
867
+ if (fn) {
868
+ finalError = await fn(finalError, response, request2, options);
869
+ }
870
+ }
871
+ finalError = finalError || {};
872
+ if (throwOnError) {
873
+ throw finalError;
874
+ }
875
+ return responseStyle === "data" ? void 0 : {
876
+ error: finalError,
877
+ request: request2,
878
+ response
879
+ };
138
880
  }
139
- const response = await this.#fetch(url, {
881
+ };
882
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
883
+ const makeSseFn = (method) => async (options) => {
884
+ const { opts, url } = await beforeRequest(options);
885
+ return createSseClient({
886
+ ...opts,
887
+ body: opts.body,
140
888
  method,
141
- headers: { Authorization: `Bearer ${this.#apiKey}` }
889
+ onRequest: async (url2, init) => {
890
+ let request2 = new Request(url2, init);
891
+ for (const fn of interceptors.request.fns) {
892
+ if (fn) {
893
+ request2 = await fn(request2, opts);
894
+ }
895
+ }
896
+ return request2;
897
+ },
898
+ serializedBody: getValidRequestBody(opts),
899
+ url
142
900
  });
143
- const payload = await response.json().catch(() => null);
144
- if (!response.ok || payload?.error) {
145
- throw new PidgeonError({
146
- code: payload?.error?.code ?? "internal",
147
- message: payload?.error?.message ?? `Request failed with ${response.status}.`,
148
- status: response.status,
149
- field: payload?.error?.field,
150
- requestId: response.headers.get("x-request-id") ?? void 0
151
- });
152
- }
153
- return {
154
- data: payload?.data ?? [],
155
- has_more: payload?.has_more ?? false,
156
- next_cursor: payload?.next_cursor ?? null
157
- };
158
- }
901
+ };
902
+ const _buildUrl = (options) => buildUrl({ ..._config, ...options });
903
+ return {
904
+ buildUrl: _buildUrl,
905
+ connect: makeMethodFn("CONNECT"),
906
+ delete: makeMethodFn("DELETE"),
907
+ get: makeMethodFn("GET"),
908
+ getConfig,
909
+ head: makeMethodFn("HEAD"),
910
+ interceptors,
911
+ options: makeMethodFn("OPTIONS"),
912
+ patch: makeMethodFn("PATCH"),
913
+ post: makeMethodFn("POST"),
914
+ put: makeMethodFn("PUT"),
915
+ request,
916
+ setConfig,
917
+ sse: {
918
+ connect: makeSseFn("CONNECT"),
919
+ delete: makeSseFn("DELETE"),
920
+ get: makeSseFn("GET"),
921
+ head: makeSseFn("HEAD"),
922
+ options: makeSseFn("OPTIONS"),
923
+ patch: makeSseFn("PATCH"),
924
+ post: makeSseFn("POST"),
925
+ put: makeSseFn("PUT"),
926
+ trace: makeSseFn("TRACE")
927
+ },
928
+ trace: makeMethodFn("TRACE")
929
+ };
159
930
  };
160
931
 
932
+ // src/generated/client.gen.ts
933
+ var client = createClient(
934
+ createConfig({ baseUrl: "https://pidgeon.ai/api/v1" })
935
+ );
936
+
937
+ // src/generated/sdk.gen.ts
938
+ var agentSignUp = (options) => (options.client ?? client).post({
939
+ url: "/agent/signup",
940
+ ...options,
941
+ headers: {
942
+ "Content-Type": "application/json",
943
+ ...options.headers
944
+ }
945
+ });
946
+ var agentAttachHuman = (options) => (options.client ?? client).post({
947
+ url: "/agent/human",
948
+ ...options,
949
+ headers: {
950
+ "Content-Type": "application/json",
951
+ ...options.headers
952
+ }
953
+ });
954
+ var agentVerify = (options) => (options.client ?? client).post({
955
+ url: "/agent/verify",
956
+ ...options,
957
+ headers: {
958
+ "Content-Type": "application/json",
959
+ ...options.headers
960
+ }
961
+ });
962
+ var identitiesList = (options) => (options?.client ?? client).get({
963
+ security: [{ scheme: "bearer", type: "http" }],
964
+ url: "/identities",
965
+ ...options
966
+ });
967
+ var identitiesCreate = (options) => (options.client ?? client).post({
968
+ security: [{ scheme: "bearer", type: "http" }],
969
+ url: "/identities",
970
+ ...options,
971
+ headers: {
972
+ "Content-Type": "application/json",
973
+ ...options.headers
974
+ }
975
+ });
976
+ var identitiesDelete = (options) => (options.client ?? client).delete({
977
+ security: [{ scheme: "bearer", type: "http" }],
978
+ url: "/identities/{id}",
979
+ ...options
980
+ });
981
+ var identitiesGet = (options) => (options.client ?? client).get({
982
+ security: [{ scheme: "bearer", type: "http" }],
983
+ url: "/identities/{id}",
984
+ ...options
985
+ });
986
+ var identitiesUpdate = (options) => (options.client ?? client).patch(
987
+ {
988
+ security: [{ scheme: "bearer", type: "http" }],
989
+ url: "/identities/{id}",
990
+ ...options,
991
+ headers: {
992
+ "Content-Type": "application/json",
993
+ ...options.headers
994
+ }
995
+ }
996
+ );
997
+ var identitiesAccessDelete = (options) => (options.client ?? client).delete({
998
+ security: [{ scheme: "bearer", type: "http" }],
999
+ url: "/identities/{id}/access",
1000
+ ...options
1001
+ });
1002
+ var identitiesAccessGet = (options) => (options.client ?? client).get({
1003
+ security: [{ scheme: "bearer", type: "http" }],
1004
+ url: "/identities/{id}/access",
1005
+ ...options
1006
+ });
1007
+ var identitiesAccessCreate = (options) => (options.client ?? client).post({
1008
+ security: [{ scheme: "bearer", type: "http" }],
1009
+ url: "/identities/{id}/access",
1010
+ ...options,
1011
+ headers: {
1012
+ "Content-Type": "application/json",
1013
+ ...options.headers
1014
+ }
1015
+ });
1016
+ var identitiesSendRulesDelete = (options) => (options.client ?? client).delete({
1017
+ security: [{ scheme: "bearer", type: "http" }],
1018
+ url: "/identities/{id}/send-rules",
1019
+ ...options
1020
+ });
1021
+ var identitiesSendRulesGet = (options) => (options.client ?? client).get({
1022
+ security: [{ scheme: "bearer", type: "http" }],
1023
+ url: "/identities/{id}/send-rules",
1024
+ ...options
1025
+ });
1026
+ var identitiesSendRulesCreate = (options) => (options.client ?? client).post({
1027
+ security: [{ scheme: "bearer", type: "http" }],
1028
+ url: "/identities/{id}/send-rules",
1029
+ ...options,
1030
+ headers: {
1031
+ "Content-Type": "application/json",
1032
+ ...options.headers
1033
+ }
1034
+ });
1035
+ var identitiesReceiveRulesDelete = (options) => (options.client ?? client).delete({
1036
+ security: [{ scheme: "bearer", type: "http" }],
1037
+ url: "/identities/{id}/receive-rules",
1038
+ ...options
1039
+ });
1040
+ var identitiesReceiveRulesGet = (options) => (options.client ?? client).get({
1041
+ security: [{ scheme: "bearer", type: "http" }],
1042
+ url: "/identities/{id}/receive-rules",
1043
+ ...options
1044
+ });
1045
+ var identitiesReceiveRulesCreate = (options) => (options.client ?? client).post({
1046
+ security: [{ scheme: "bearer", type: "http" }],
1047
+ url: "/identities/{id}/receive-rules",
1048
+ ...options,
1049
+ headers: {
1050
+ "Content-Type": "application/json",
1051
+ ...options.headers
1052
+ }
1053
+ });
1054
+ var identitiesSuspendTenant = (options) => (options.client ?? client).post({
1055
+ security: [{ scheme: "bearer", type: "http" }],
1056
+ url: "/tenants/{id}/suspend",
1057
+ ...options
1058
+ });
1059
+ var labelsList = (options) => (options.client ?? client).get({
1060
+ security: [{ scheme: "bearer", type: "http" }],
1061
+ url: "/labels",
1062
+ ...options
1063
+ });
1064
+ var labelsCreate = (options) => (options.client ?? client).post({
1065
+ security: [{ scheme: "bearer", type: "http" }],
1066
+ url: "/labels",
1067
+ ...options,
1068
+ headers: {
1069
+ "Content-Type": "application/json",
1070
+ ...options.headers
1071
+ }
1072
+ });
1073
+ var labelsDelete = (options) => (options.client ?? client).delete({
1074
+ security: [{ scheme: "bearer", type: "http" }],
1075
+ url: "/labels/{id}",
1076
+ ...options
1077
+ });
1078
+ var labelsUpdate = (options) => (options.client ?? client).patch({
1079
+ security: [{ scheme: "bearer", type: "http" }],
1080
+ url: "/labels/{id}",
1081
+ ...options,
1082
+ headers: {
1083
+ "Content-Type": "application/json",
1084
+ ...options.headers
1085
+ }
1086
+ });
1087
+ var threadsLabelsDelete = (options) => (options.client ?? client).delete({
1088
+ security: [{ scheme: "bearer", type: "http" }],
1089
+ url: "/threads/{id}/labels",
1090
+ ...options
1091
+ });
1092
+ var threadsLabelsGet = (options) => (options.client ?? client).get({
1093
+ security: [{ scheme: "bearer", type: "http" }],
1094
+ url: "/threads/{id}/labels",
1095
+ ...options
1096
+ });
1097
+ var threadsLabelsCreate = (options) => (options.client ?? client).post({
1098
+ security: [{ scheme: "bearer", type: "http" }],
1099
+ url: "/threads/{id}/labels",
1100
+ ...options,
1101
+ headers: {
1102
+ "Content-Type": "application/json",
1103
+ ...options.headers
1104
+ }
1105
+ });
1106
+ var messagesListInThread = (options) => (options.client ?? client).get({
1107
+ security: [{ scheme: "bearer", type: "http" }],
1108
+ url: "/messages",
1109
+ ...options
1110
+ });
1111
+ var messagesSend = (options) => (options.client ?? client).post({
1112
+ security: [{ scheme: "bearer", type: "http" }],
1113
+ url: "/messages",
1114
+ ...options,
1115
+ headers: {
1116
+ "Content-Type": "application/json",
1117
+ ...options.headers
1118
+ }
1119
+ });
1120
+ var messagesSearch = (options) => (options.client ?? client).get({
1121
+ security: [{ scheme: "bearer", type: "http" }],
1122
+ url: "/messages/search",
1123
+ ...options
1124
+ });
1125
+ var messagesAct = (options) => (options.client ?? client).post({
1126
+ security: [{ scheme: "bearer", type: "http" }],
1127
+ url: "/messages/actions",
1128
+ ...options,
1129
+ headers: {
1130
+ "Content-Type": "application/json",
1131
+ ...options.headers
1132
+ }
1133
+ });
1134
+ var messagesUndo = (options) => (options.client ?? client).post({
1135
+ security: [{ scheme: "bearer", type: "http" }],
1136
+ url: "/messages/undo",
1137
+ ...options,
1138
+ headers: {
1139
+ "Content-Type": "application/json",
1140
+ ...options.headers
1141
+ }
1142
+ });
1143
+ var messagesGet = (options) => (options.client ?? client).get({
1144
+ security: [{ scheme: "bearer", type: "http" }],
1145
+ url: "/messages/{id}",
1146
+ ...options
1147
+ });
1148
+ var messagesUpdate = (options) => (options.client ?? client).patch({
1149
+ security: [{ scheme: "bearer", type: "http" }],
1150
+ url: "/messages/{id}",
1151
+ ...options,
1152
+ headers: {
1153
+ "Content-Type": "application/json",
1154
+ ...options.headers
1155
+ }
1156
+ });
1157
+ var messagesReply = (options) => (options.client ?? client).post({
1158
+ security: [{ scheme: "bearer", type: "http" }],
1159
+ url: "/messages/{id}/reply",
1160
+ ...options,
1161
+ headers: {
1162
+ "Content-Type": "application/json",
1163
+ ...options.headers
1164
+ }
1165
+ });
1166
+ var messagesReplyAll = (options) => (options.client ?? client).post({
1167
+ security: [{ scheme: "bearer", type: "http" }],
1168
+ url: "/messages/{id}/reply-all",
1169
+ ...options,
1170
+ headers: {
1171
+ "Content-Type": "application/json",
1172
+ ...options.headers
1173
+ }
1174
+ });
1175
+ var messagesForward = (options) => (options.client ?? client).post({
1176
+ security: [{ scheme: "bearer", type: "http" }],
1177
+ url: "/messages/{id}/forward",
1178
+ ...options,
1179
+ headers: {
1180
+ "Content-Type": "application/json",
1181
+ ...options.headers
1182
+ }
1183
+ });
1184
+ var messagesRaw = (options) => (options.client ?? client).get({
1185
+ security: [{ scheme: "bearer", type: "http" }],
1186
+ url: "/messages/{id}/raw",
1187
+ ...options
1188
+ });
1189
+ var threadsList = (options) => (options?.client ?? client).get({
1190
+ security: [{ scheme: "bearer", type: "http" }],
1191
+ url: "/threads",
1192
+ ...options
1193
+ });
1194
+ var threadsGet = (options) => (options.client ?? client).get({
1195
+ security: [{ scheme: "bearer", type: "http" }],
1196
+ url: "/threads/{id}",
1197
+ ...options
1198
+ });
1199
+ var threadsUpdate = (options) => (options.client ?? client).patch({
1200
+ security: [{ scheme: "bearer", type: "http" }],
1201
+ url: "/threads/{id}",
1202
+ ...options,
1203
+ headers: {
1204
+ "Content-Type": "application/json",
1205
+ ...options.headers
1206
+ }
1207
+ });
1208
+ var domainsList = (options) => (options?.client ?? client).get({
1209
+ security: [{ scheme: "bearer", type: "http" }],
1210
+ url: "/domains",
1211
+ ...options
1212
+ });
1213
+ var domainsCreate = (options) => (options.client ?? client).post({
1214
+ security: [{ scheme: "bearer", type: "http" }],
1215
+ url: "/domains",
1216
+ ...options,
1217
+ headers: {
1218
+ "Content-Type": "application/json",
1219
+ ...options.headers
1220
+ }
1221
+ });
1222
+ var domainsZoneFile = (options) => (options.client ?? client).get({
1223
+ security: [{ scheme: "bearer", type: "http" }],
1224
+ url: "/domains/{id}/zone-file",
1225
+ ...options
1226
+ });
1227
+ var domainsGetSetupLink = (options) => (options.client ?? client).get({
1228
+ security: [{ scheme: "bearer", type: "http" }],
1229
+ url: "/domains/{id}/setup-link",
1230
+ ...options
1231
+ });
1232
+ var domainsVerify = (options) => (options.client ?? client).post({
1233
+ security: [{ scheme: "bearer", type: "http" }],
1234
+ url: "/domains/{id}/verify",
1235
+ ...options
1236
+ });
1237
+ var domainsDelete = (options) => (options.client ?? client).delete({
1238
+ security: [{ scheme: "bearer", type: "http" }],
1239
+ url: "/domains/{id}",
1240
+ ...options
1241
+ });
1242
+ var domainsGet = (options) => (options.client ?? client).get({
1243
+ security: [{ scheme: "bearer", type: "http" }],
1244
+ url: "/domains/{id}",
1245
+ ...options
1246
+ });
1247
+ var domainsUpdate = (options) => (options.client ?? client).patch({
1248
+ security: [{ scheme: "bearer", type: "http" }],
1249
+ url: "/domains/{id}",
1250
+ ...options,
1251
+ headers: {
1252
+ "Content-Type": "application/json",
1253
+ ...options.headers
1254
+ }
1255
+ });
1256
+ var routingList = (options) => (options?.client ?? client).get({
1257
+ security: [{ scheme: "bearer", type: "http" }],
1258
+ url: "/routing-rules",
1259
+ ...options
1260
+ });
1261
+ var routingCreate = (options) => (options.client ?? client).post({
1262
+ security: [{ scheme: "bearer", type: "http" }],
1263
+ url: "/routing-rules",
1264
+ ...options,
1265
+ headers: {
1266
+ "Content-Type": "application/json",
1267
+ ...options.headers
1268
+ }
1269
+ });
1270
+ var routingDelete = (options) => (options.client ?? client).delete({
1271
+ security: [{ scheme: "bearer", type: "http" }],
1272
+ url: "/routing-rules/{id}",
1273
+ ...options
1274
+ });
1275
+ var routingUpdate = (options) => (options.client ?? client).patch({
1276
+ security: [{ scheme: "bearer", type: "http" }],
1277
+ url: "/routing-rules/{id}",
1278
+ ...options,
1279
+ headers: {
1280
+ "Content-Type": "application/json",
1281
+ ...options.headers
1282
+ }
1283
+ });
1284
+ var mailboxesList = (options) => (options.client ?? client).get({
1285
+ security: [{ scheme: "bearer", type: "http" }],
1286
+ url: "/mailboxes",
1287
+ ...options
1288
+ });
1289
+ var mailboxesChanges = (options) => (options.client ?? client).get({
1290
+ security: [{ scheme: "bearer", type: "http" }],
1291
+ url: "/mailboxes/changes",
1292
+ ...options
1293
+ });
1294
+ var mailboxesEmptyTrash = (options) => (options.client ?? client).delete({
1295
+ security: [{ scheme: "bearer", type: "http" }],
1296
+ url: "/mailboxes/{folder}",
1297
+ ...options
1298
+ });
1299
+ var mailboxesListFolder = (options) => (options.client ?? client).get({
1300
+ security: [{ scheme: "bearer", type: "http" }],
1301
+ url: "/mailboxes/{folder}",
1302
+ ...options
1303
+ });
1304
+ var keysList = (options) => (options?.client ?? client).get({
1305
+ security: [{ scheme: "bearer", type: "http" }],
1306
+ url: "/api-keys",
1307
+ ...options
1308
+ });
1309
+ var keysCreate = (options) => (options.client ?? client).post({
1310
+ security: [{ scheme: "bearer", type: "http" }],
1311
+ url: "/api-keys",
1312
+ ...options,
1313
+ headers: {
1314
+ "Content-Type": "application/json",
1315
+ ...options.headers
1316
+ }
1317
+ });
1318
+ var keysRevoke = (options) => (options.client ?? client).delete({
1319
+ security: [{ scheme: "bearer", type: "http" }],
1320
+ url: "/api-keys/{id}",
1321
+ ...options
1322
+ });
1323
+ var keysGet = (options) => (options.client ?? client).get({
1324
+ security: [{ scheme: "bearer", type: "http" }],
1325
+ url: "/api-keys/{id}",
1326
+ ...options
1327
+ });
1328
+ var keysUpdate = (options) => (options.client ?? client).patch({
1329
+ security: [{ scheme: "bearer", type: "http" }],
1330
+ url: "/api-keys/{id}",
1331
+ ...options,
1332
+ headers: {
1333
+ "Content-Type": "application/json",
1334
+ ...options.headers
1335
+ }
1336
+ });
1337
+ var appPasswordsList = (options) => (options.client ?? client).get({
1338
+ security: [{ scheme: "bearer", type: "http" }],
1339
+ url: "/app-passwords",
1340
+ ...options
1341
+ });
1342
+ var appPasswordsCreate = (options) => (options.client ?? client).post({
1343
+ security: [{ scheme: "bearer", type: "http" }],
1344
+ url: "/app-passwords",
1345
+ ...options,
1346
+ headers: {
1347
+ "Content-Type": "application/json",
1348
+ ...options.headers
1349
+ }
1350
+ });
1351
+ var appPasswordsRevoke = (options) => (options.client ?? client).delete({
1352
+ security: [{ scheme: "bearer", type: "http" }],
1353
+ url: "/app-passwords/{id}",
1354
+ ...options
1355
+ });
1356
+ var workspaceGet = (options) => (options?.client ?? client).get({
1357
+ security: [{ scheme: "bearer", type: "http" }],
1358
+ url: "/workspace",
1359
+ ...options
1360
+ });
1361
+ var workspaceMembers = (options) => (options?.client ?? client).get({
1362
+ security: [{ scheme: "bearer", type: "http" }],
1363
+ url: "/workspace/members",
1364
+ ...options
1365
+ });
1366
+ var eventsList = (options) => (options?.client ?? client).get({
1367
+ security: [{ scheme: "bearer", type: "http" }],
1368
+ url: "/events",
1369
+ ...options
1370
+ });
1371
+ var eventsGet = (options) => (options.client ?? client).get({
1372
+ security: [{ scheme: "bearer", type: "http" }],
1373
+ url: "/events/{id}",
1374
+ ...options
1375
+ });
1376
+ var webhooksList = (options) => (options?.client ?? client).get({
1377
+ security: [{ scheme: "bearer", type: "http" }],
1378
+ url: "/webhooks",
1379
+ ...options
1380
+ });
1381
+ var webhooksCreate = (options) => (options.client ?? client).post({
1382
+ security: [{ scheme: "bearer", type: "http" }],
1383
+ url: "/webhooks",
1384
+ ...options,
1385
+ headers: {
1386
+ "Content-Type": "application/json",
1387
+ ...options.headers
1388
+ }
1389
+ });
1390
+ var webhooksDelete = (options) => (options.client ?? client).delete({
1391
+ security: [{ scheme: "bearer", type: "http" }],
1392
+ url: "/webhooks/{id}",
1393
+ ...options
1394
+ });
1395
+ var webhooksGet = (options) => (options.client ?? client).get({
1396
+ security: [{ scheme: "bearer", type: "http" }],
1397
+ url: "/webhooks/{id}",
1398
+ ...options
1399
+ });
1400
+ var webhooksUpdate = (options) => (options.client ?? client).patch({
1401
+ security: [{ scheme: "bearer", type: "http" }],
1402
+ url: "/webhooks/{id}",
1403
+ ...options,
1404
+ headers: {
1405
+ "Content-Type": "application/json",
1406
+ ...options.headers
1407
+ }
1408
+ });
1409
+ var webhooksGetHeaders = (options) => (options.client ?? client).get({
1410
+ security: [{ scheme: "bearer", type: "http" }],
1411
+ url: "/webhooks/{id}/headers",
1412
+ ...options
1413
+ });
1414
+ var webhooksUpdateHeaders = (options) => (options.client ?? client).put({
1415
+ security: [{ scheme: "bearer", type: "http" }],
1416
+ url: "/webhooks/{id}/headers",
1417
+ ...options,
1418
+ headers: {
1419
+ "Content-Type": "application/json",
1420
+ ...options.headers
1421
+ }
1422
+ });
1423
+ var webhooksDeliveries = (options) => (options.client ?? client).get({
1424
+ security: [{ scheme: "bearer", type: "http" }],
1425
+ url: "/deliveries",
1426
+ ...options
1427
+ });
1428
+ var webhooksReplay = (options) => (options.client ?? client).post({
1429
+ security: [{ scheme: "bearer", type: "http" }],
1430
+ url: "/deliveries/{id}/replay",
1431
+ ...options
1432
+ });
1433
+ var messagesRespondToInvitation = (options) => (options.client ?? client).post({
1434
+ security: [{ scheme: "bearer", type: "http" }],
1435
+ url: "/messages/{id}/invitation/respond",
1436
+ ...options,
1437
+ headers: {
1438
+ "Content-Type": "application/json",
1439
+ ...options.headers
1440
+ }
1441
+ });
1442
+ var calendarGet = (options) => (options.client ?? client).get({
1443
+ security: [{ scheme: "bearer", type: "http" }],
1444
+ url: "/identities/{id}/calendar",
1445
+ ...options
1446
+ });
1447
+ var calendarUpdate = (options) => (options.client ?? client).patch({
1448
+ security: [{ scheme: "bearer", type: "http" }],
1449
+ url: "/identities/{id}/calendar",
1450
+ ...options,
1451
+ headers: {
1452
+ "Content-Type": "application/json",
1453
+ ...options.headers
1454
+ }
1455
+ });
1456
+ var calendarListEvents = (options) => (options.client ?? client).get({
1457
+ security: [{ scheme: "bearer", type: "http" }],
1458
+ url: "/identities/{id}/calendar/events",
1459
+ ...options
1460
+ });
1461
+ var calendarCreateEvent = (options) => (options.client ?? client).post({
1462
+ security: [{ scheme: "bearer", type: "http" }],
1463
+ url: "/identities/{id}/calendar/events",
1464
+ ...options,
1465
+ headers: {
1466
+ "Content-Type": "application/json",
1467
+ ...options.headers
1468
+ }
1469
+ });
1470
+ var calendarRespondToEvent = (options) => (options.client ?? client).post({
1471
+ security: [{ scheme: "bearer", type: "http" }],
1472
+ url: "/identities/{id}/calendar/events/{eventId}/respond",
1473
+ ...options,
1474
+ headers: {
1475
+ "Content-Type": "application/json",
1476
+ ...options.headers
1477
+ }
1478
+ });
1479
+ var calendarListEventInstances = (options) => (options.client ?? client).get({
1480
+ security: [{ scheme: "bearer", type: "http" }],
1481
+ url: "/identities/{id}/calendar/events/{eventId}/instances",
1482
+ ...options
1483
+ });
1484
+ var calendarGetAgenda = (options) => (options.client ?? client).get(
1485
+ {
1486
+ security: [{ scheme: "bearer", type: "http" }],
1487
+ url: "/identities/{id}/calendar/agenda",
1488
+ ...options
1489
+ }
1490
+ );
1491
+ var calendarDeleteEvent = (options) => (options.client ?? client).delete({
1492
+ security: [{ scheme: "bearer", type: "http" }],
1493
+ url: "/identities/{id}/calendar/events/{eventId}",
1494
+ ...options
1495
+ });
1496
+ var calendarGetEvent = (options) => (options.client ?? client).get({
1497
+ security: [{ scheme: "bearer", type: "http" }],
1498
+ url: "/identities/{id}/calendar/events/{eventId}",
1499
+ ...options
1500
+ });
1501
+ var calendarUpdateEvent = (options) => (options.client ?? client).patch({
1502
+ security: [{ scheme: "bearer", type: "http" }],
1503
+ url: "/identities/{id}/calendar/events/{eventId}",
1504
+ ...options,
1505
+ headers: {
1506
+ "Content-Type": "application/json",
1507
+ ...options.headers
1508
+ }
1509
+ });
1510
+ var draftsList = (options) => (options.client ?? client).get({
1511
+ security: [{ scheme: "bearer", type: "http" }],
1512
+ url: "/drafts",
1513
+ ...options
1514
+ });
1515
+ var draftsCreate = (options) => (options.client ?? client).post({
1516
+ security: [{ scheme: "bearer", type: "http" }],
1517
+ url: "/drafts",
1518
+ ...options,
1519
+ headers: {
1520
+ "Content-Type": "application/json",
1521
+ ...options.headers
1522
+ }
1523
+ });
1524
+ var draftsDelete = (options) => (options.client ?? client).delete({
1525
+ security: [{ scheme: "bearer", type: "http" }],
1526
+ url: "/drafts/{id}",
1527
+ ...options
1528
+ });
1529
+ var draftsGet = (options) => (options.client ?? client).get({
1530
+ security: [{ scheme: "bearer", type: "http" }],
1531
+ url: "/drafts/{id}",
1532
+ ...options
1533
+ });
1534
+ var draftsUpdate = (options) => (options.client ?? client).patch({
1535
+ security: [{ scheme: "bearer", type: "http" }],
1536
+ url: "/drafts/{id}",
1537
+ ...options,
1538
+ headers: {
1539
+ "Content-Type": "application/json",
1540
+ ...options.headers
1541
+ }
1542
+ });
1543
+ var draftsSend = (options) => (options.client ?? client).post({
1544
+ security: [{ scheme: "bearer", type: "http" }],
1545
+ url: "/drafts/{id}/send",
1546
+ ...options
1547
+ });
1548
+ var draftsCancelSchedule = (options) => (options.client ?? client).delete({
1549
+ security: [{ scheme: "bearer", type: "http" }],
1550
+ url: "/drafts/{id}/schedule",
1551
+ ...options
1552
+ });
1553
+ var draftsSchedule = (options) => (options.client ?? client).post({
1554
+ security: [{ scheme: "bearer", type: "http" }],
1555
+ url: "/drafts/{id}/schedule",
1556
+ ...options,
1557
+ headers: {
1558
+ "Content-Type": "application/json",
1559
+ ...options.headers
1560
+ }
1561
+ });
1562
+ var draftsRemoveAttachment = (options) => (options.client ?? client).delete({
1563
+ security: [{ scheme: "bearer", type: "http" }],
1564
+ url: "/drafts/{id}/attachments/{attachmentId}",
1565
+ ...options
1566
+ });
1567
+ var metricsQuery = (options) => (options?.client ?? client).get({
1568
+ security: [{ scheme: "bearer", type: "http" }],
1569
+ url: "/metrics",
1570
+ ...options
1571
+ });
1572
+ var attachmentsUpload = (options) => (options.client ?? client).post({
1573
+ ...formDataBodySerializer,
1574
+ security: [{ scheme: "bearer", type: "http" }],
1575
+ url: "/attachments",
1576
+ ...options,
1577
+ headers: {
1578
+ "Content-Type": null,
1579
+ ...options.headers
1580
+ }
1581
+ });
1582
+ var attachmentsDownloadUrl = (options) => (options.client ?? client).get({
1583
+ security: [{ scheme: "bearer", type: "http" }],
1584
+ url: "/attachments/{id}",
1585
+ ...options
1586
+ });
1587
+
161
1588
  // src/webhooks.ts
162
1589
  var SIGNATURE_HEADER = "x-pidgeon-signature";
163
1590
  var TIMESTAMP_HEADER = "x-pidgeon-timestamp";
@@ -201,10 +1628,110 @@ function constantTimeEqual(a, b) {
201
1628
  }
202
1629
  // Annotate the CommonJS export names for ESM import in node:
203
1630
  0 && (module.exports = {
204
- Pidgeon,
205
- PidgeonError,
206
1631
  SIGNATURE_HEADER,
207
1632
  TIMESTAMP_HEADER,
208
- verifyWebhook
1633
+ agentAttachHuman,
1634
+ agentSignUp,
1635
+ agentVerify,
1636
+ appPasswordsCreate,
1637
+ appPasswordsList,
1638
+ appPasswordsRevoke,
1639
+ attachmentsDownloadUrl,
1640
+ attachmentsUpload,
1641
+ calendarCreateEvent,
1642
+ calendarDeleteEvent,
1643
+ calendarGet,
1644
+ calendarGetAgenda,
1645
+ calendarGetEvent,
1646
+ calendarListEventInstances,
1647
+ calendarListEvents,
1648
+ calendarRespondToEvent,
1649
+ calendarUpdate,
1650
+ calendarUpdateEvent,
1651
+ client,
1652
+ createClient,
1653
+ createConfig,
1654
+ domainsCreate,
1655
+ domainsDelete,
1656
+ domainsGet,
1657
+ domainsGetSetupLink,
1658
+ domainsList,
1659
+ domainsUpdate,
1660
+ domainsVerify,
1661
+ domainsZoneFile,
1662
+ draftsCancelSchedule,
1663
+ draftsCreate,
1664
+ draftsDelete,
1665
+ draftsGet,
1666
+ draftsList,
1667
+ draftsRemoveAttachment,
1668
+ draftsSchedule,
1669
+ draftsSend,
1670
+ draftsUpdate,
1671
+ eventsGet,
1672
+ eventsList,
1673
+ identitiesAccessCreate,
1674
+ identitiesAccessDelete,
1675
+ identitiesAccessGet,
1676
+ identitiesCreate,
1677
+ identitiesDelete,
1678
+ identitiesGet,
1679
+ identitiesList,
1680
+ identitiesReceiveRulesCreate,
1681
+ identitiesReceiveRulesDelete,
1682
+ identitiesReceiveRulesGet,
1683
+ identitiesSendRulesCreate,
1684
+ identitiesSendRulesDelete,
1685
+ identitiesSendRulesGet,
1686
+ identitiesSuspendTenant,
1687
+ identitiesUpdate,
1688
+ keysCreate,
1689
+ keysGet,
1690
+ keysList,
1691
+ keysRevoke,
1692
+ keysUpdate,
1693
+ labelsCreate,
1694
+ labelsDelete,
1695
+ labelsList,
1696
+ labelsUpdate,
1697
+ mailboxesChanges,
1698
+ mailboxesEmptyTrash,
1699
+ mailboxesList,
1700
+ mailboxesListFolder,
1701
+ messagesAct,
1702
+ messagesForward,
1703
+ messagesGet,
1704
+ messagesListInThread,
1705
+ messagesRaw,
1706
+ messagesReply,
1707
+ messagesReplyAll,
1708
+ messagesRespondToInvitation,
1709
+ messagesSearch,
1710
+ messagesSend,
1711
+ messagesUndo,
1712
+ messagesUpdate,
1713
+ metricsQuery,
1714
+ routingCreate,
1715
+ routingDelete,
1716
+ routingList,
1717
+ routingUpdate,
1718
+ threadsGet,
1719
+ threadsLabelsCreate,
1720
+ threadsLabelsDelete,
1721
+ threadsLabelsGet,
1722
+ threadsList,
1723
+ threadsUpdate,
1724
+ verifyWebhook,
1725
+ webhooksCreate,
1726
+ webhooksDelete,
1727
+ webhooksDeliveries,
1728
+ webhooksGet,
1729
+ webhooksGetHeaders,
1730
+ webhooksList,
1731
+ webhooksReplay,
1732
+ webhooksUpdate,
1733
+ webhooksUpdateHeaders,
1734
+ workspaceGet,
1735
+ workspaceMembers
209
1736
  });
210
1737
  //# sourceMappingURL=index.cjs.map