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