@macro-inc/sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +177 -0
- package/dist/chunk-5HAKQN23.js +1263 -0
- package/dist/chunk-77EI4LSQ.js +2492 -0
- package/dist/chunk-CTKR64MY.js +1436 -0
- package/dist/chunk-JXIQT5TH.js +1467 -0
- package/dist/chunk-P4DTO6VD.js +830 -0
- package/dist/chunk-PAAFJYGO.js +967 -0
- package/dist/chunk-QNUS5BC5.js +913 -0
- package/dist/chunk-SGAHIERJ.js +1235 -0
- package/dist/chunk-V45LUJDI.js +838 -0
- package/dist/chunk-YRUXFEZM.js +1044 -0
- package/dist/generated/agent-harness/client/client.gen.d.ts +2 -0
- package/dist/generated/agent-harness/client/index.d.ts +10 -0
- package/dist/generated/agent-harness/client/types.gen.d.ts +120 -0
- package/dist/generated/agent-harness/client/utils.gen.d.ts +37 -0
- package/dist/generated/agent-harness/client.gen.d.ts +12 -0
- package/dist/generated/agent-harness/core/auth.gen.d.ts +25 -0
- package/dist/generated/agent-harness/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/agent-harness/core/params.gen.d.ts +43 -0
- package/dist/generated/agent-harness/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/agent-harness/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/agent-harness/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/agent-harness/core/types.gen.d.ts +83 -0
- package/dist/generated/agent-harness/core/utils.gen.d.ts +19 -0
- package/dist/generated/agent-harness/index.d.ts +2 -0
- package/dist/generated/agent-harness/index.js +6 -0
- package/dist/generated/agent-harness/sdk.gen.d.ts +84 -0
- package/dist/generated/agent-harness/types.gen.d.ts +539 -0
- package/dist/generated/auth/client/client.gen.d.ts +2 -0
- package/dist/generated/auth/client/index.d.ts +10 -0
- package/dist/generated/auth/client/types.gen.d.ts +120 -0
- package/dist/generated/auth/client/utils.gen.d.ts +37 -0
- package/dist/generated/auth/client.gen.d.ts +12 -0
- package/dist/generated/auth/core/auth.gen.d.ts +25 -0
- package/dist/generated/auth/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/auth/core/params.gen.d.ts +43 -0
- package/dist/generated/auth/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/auth/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/auth/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/auth/core/types.gen.d.ts +83 -0
- package/dist/generated/auth/core/utils.gen.d.ts +19 -0
- package/dist/generated/auth/index.d.ts +2 -0
- package/dist/generated/auth/index.js +6 -0
- package/dist/generated/auth/sdk.gen.d.ts +383 -0
- package/dist/generated/auth/types.gen.d.ts +2175 -0
- package/dist/generated/cognition/client/client.gen.d.ts +2 -0
- package/dist/generated/cognition/client/index.d.ts +10 -0
- package/dist/generated/cognition/client/types.gen.d.ts +120 -0
- package/dist/generated/cognition/client/utils.gen.d.ts +37 -0
- package/dist/generated/cognition/client.gen.d.ts +12 -0
- package/dist/generated/cognition/core/auth.gen.d.ts +25 -0
- package/dist/generated/cognition/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/cognition/core/params.gen.d.ts +43 -0
- package/dist/generated/cognition/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/cognition/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/cognition/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/cognition/core/types.gen.d.ts +83 -0
- package/dist/generated/cognition/core/utils.gen.d.ts +19 -0
- package/dist/generated/cognition/index.d.ts +2 -0
- package/dist/generated/cognition/index.js +6 -0
- package/dist/generated/cognition/sdk.gen.d.ts +224 -0
- package/dist/generated/cognition/types.gen.d.ts +2484 -0
- package/dist/generated/connection/client/client.gen.d.ts +2 -0
- package/dist/generated/connection/client/index.d.ts +10 -0
- package/dist/generated/connection/client/types.gen.d.ts +120 -0
- package/dist/generated/connection/client/utils.gen.d.ts +37 -0
- package/dist/generated/connection/client.gen.d.ts +12 -0
- package/dist/generated/connection/core/auth.gen.d.ts +25 -0
- package/dist/generated/connection/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/connection/core/params.gen.d.ts +43 -0
- package/dist/generated/connection/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/connection/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/connection/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/connection/core/types.gen.d.ts +83 -0
- package/dist/generated/connection/core/utils.gen.d.ts +19 -0
- package/dist/generated/connection/index.d.ts +2 -0
- package/dist/generated/connection/index.js +839 -0
- package/dist/generated/connection/sdk.gen.d.ts +38 -0
- package/dist/generated/connection/types.gen.d.ts +235 -0
- package/dist/generated/contacts/client/client.gen.d.ts +2 -0
- package/dist/generated/contacts/client/index.d.ts +10 -0
- package/dist/generated/contacts/client/types.gen.d.ts +120 -0
- package/dist/generated/contacts/client/utils.gen.d.ts +37 -0
- package/dist/generated/contacts/client.gen.d.ts +12 -0
- package/dist/generated/contacts/core/auth.gen.d.ts +25 -0
- package/dist/generated/contacts/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/contacts/core/params.gen.d.ts +43 -0
- package/dist/generated/contacts/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/contacts/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/contacts/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/contacts/core/types.gen.d.ts +83 -0
- package/dist/generated/contacts/core/utils.gen.d.ts +19 -0
- package/dist/generated/contacts/index.d.ts +2 -0
- package/dist/generated/contacts/index.js +6 -0
- package/dist/generated/contacts/sdk.gen.d.ts +43 -0
- package/dist/generated/contacts/types.gen.d.ts +52 -0
- package/dist/generated/email/client/client.gen.d.ts +2 -0
- package/dist/generated/email/client/index.d.ts +10 -0
- package/dist/generated/email/client/types.gen.d.ts +120 -0
- package/dist/generated/email/client/utils.gen.d.ts +37 -0
- package/dist/generated/email/client.gen.d.ts +12 -0
- package/dist/generated/email/core/auth.gen.d.ts +25 -0
- package/dist/generated/email/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/email/core/params.gen.d.ts +43 -0
- package/dist/generated/email/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/email/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/email/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/email/core/types.gen.d.ts +83 -0
- package/dist/generated/email/core/utils.gen.d.ts +19 -0
- package/dist/generated/email/index.d.ts +2 -0
- package/dist/generated/email/index.js +6 -0
- package/dist/generated/email/sdk.gen.d.ts +254 -0
- package/dist/generated/email/types.gen.d.ts +2614 -0
- package/dist/generated/notification/client/client.gen.d.ts +2 -0
- package/dist/generated/notification/client/index.d.ts +10 -0
- package/dist/generated/notification/client/types.gen.d.ts +120 -0
- package/dist/generated/notification/client/utils.gen.d.ts +37 -0
- package/dist/generated/notification/client.gen.d.ts +12 -0
- package/dist/generated/notification/core/auth.gen.d.ts +25 -0
- package/dist/generated/notification/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/notification/core/params.gen.d.ts +43 -0
- package/dist/generated/notification/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/notification/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/notification/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/notification/core/types.gen.d.ts +83 -0
- package/dist/generated/notification/core/utils.gen.d.ts +19 -0
- package/dist/generated/notification/index.d.ts +2 -0
- package/dist/generated/notification/index.js +6 -0
- package/dist/generated/notification/sdk.gen.d.ts +118 -0
- package/dist/generated/notification/types.gen.d.ts +1352 -0
- package/dist/generated/properties/client/client.gen.d.ts +2 -0
- package/dist/generated/properties/client/index.d.ts +10 -0
- package/dist/generated/properties/client/types.gen.d.ts +120 -0
- package/dist/generated/properties/client/utils.gen.d.ts +37 -0
- package/dist/generated/properties/client.gen.d.ts +12 -0
- package/dist/generated/properties/core/auth.gen.d.ts +25 -0
- package/dist/generated/properties/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/properties/core/params.gen.d.ts +43 -0
- package/dist/generated/properties/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/properties/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/properties/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/properties/core/types.gen.d.ts +83 -0
- package/dist/generated/properties/core/utils.gen.d.ts +19 -0
- package/dist/generated/properties/index.d.ts +2 -0
- package/dist/generated/properties/index.js +6 -0
- package/dist/generated/properties/sdk.gen.d.ts +158 -0
- package/dist/generated/properties/types.gen.d.ts +1288 -0
- package/dist/generated/scheduled-action/client/client.gen.d.ts +2 -0
- package/dist/generated/scheduled-action/client/index.d.ts +10 -0
- package/dist/generated/scheduled-action/client/types.gen.d.ts +120 -0
- package/dist/generated/scheduled-action/client/utils.gen.d.ts +37 -0
- package/dist/generated/scheduled-action/client.gen.d.ts +12 -0
- package/dist/generated/scheduled-action/core/auth.gen.d.ts +25 -0
- package/dist/generated/scheduled-action/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/scheduled-action/core/params.gen.d.ts +43 -0
- package/dist/generated/scheduled-action/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/scheduled-action/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/scheduled-action/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/scheduled-action/core/types.gen.d.ts +83 -0
- package/dist/generated/scheduled-action/core/utils.gen.d.ts +19 -0
- package/dist/generated/scheduled-action/index.d.ts +2 -0
- package/dist/generated/scheduled-action/index.js +845 -0
- package/dist/generated/scheduled-action/sdk.gen.d.ts +42 -0
- package/dist/generated/scheduled-action/types.gen.d.ts +241 -0
- package/dist/generated/search/client/client.gen.d.ts +2 -0
- package/dist/generated/search/client/index.d.ts +10 -0
- package/dist/generated/search/client/types.gen.d.ts +120 -0
- package/dist/generated/search/client/utils.gen.d.ts +37 -0
- package/dist/generated/search/client.gen.d.ts +12 -0
- package/dist/generated/search/core/auth.gen.d.ts +25 -0
- package/dist/generated/search/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/search/core/params.gen.d.ts +43 -0
- package/dist/generated/search/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/search/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/search/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/search/core/types.gen.d.ts +83 -0
- package/dist/generated/search/core/utils.gen.d.ts +19 -0
- package/dist/generated/search/index.d.ts +2 -0
- package/dist/generated/search/index.js +6 -0
- package/dist/generated/search/sdk.gen.d.ts +44 -0
- package/dist/generated/search/types.gen.d.ts +2194 -0
- package/dist/generated/static-files/client/client.gen.d.ts +2 -0
- package/dist/generated/static-files/client/index.d.ts +10 -0
- package/dist/generated/static-files/client/types.gen.d.ts +120 -0
- package/dist/generated/static-files/client/utils.gen.d.ts +37 -0
- package/dist/generated/static-files/client.gen.d.ts +12 -0
- package/dist/generated/static-files/core/auth.gen.d.ts +25 -0
- package/dist/generated/static-files/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/static-files/core/params.gen.d.ts +43 -0
- package/dist/generated/static-files/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/static-files/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/static-files/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/static-files/core/types.gen.d.ts +83 -0
- package/dist/generated/static-files/core/utils.gen.d.ts +19 -0
- package/dist/generated/static-files/index.d.ts +2 -0
- package/dist/generated/static-files/index.js +842 -0
- package/dist/generated/static-files/sdk.gen.d.ts +43 -0
- package/dist/generated/static-files/types.gen.d.ts +214 -0
- package/dist/generated/storage/client/client.gen.d.ts +2 -0
- package/dist/generated/storage/client/index.d.ts +10 -0
- package/dist/generated/storage/client/types.gen.d.ts +120 -0
- package/dist/generated/storage/client/utils.gen.d.ts +37 -0
- package/dist/generated/storage/client.gen.d.ts +12 -0
- package/dist/generated/storage/core/auth.gen.d.ts +25 -0
- package/dist/generated/storage/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/storage/core/params.gen.d.ts +43 -0
- package/dist/generated/storage/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/storage/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/storage/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/storage/core/types.gen.d.ts +83 -0
- package/dist/generated/storage/core/utils.gen.d.ts +19 -0
- package/dist/generated/storage/index.d.ts +2 -0
- package/dist/generated/storage/index.js +6 -0
- package/dist/generated/storage/sdk.gen.d.ts +858 -0
- package/dist/generated/storage/types.gen.d.ts +12105 -0
- package/dist/generated/unfurl/client/client.gen.d.ts +2 -0
- package/dist/generated/unfurl/client/index.d.ts +10 -0
- package/dist/generated/unfurl/client/types.gen.d.ts +120 -0
- package/dist/generated/unfurl/client/utils.gen.d.ts +37 -0
- package/dist/generated/unfurl/client.gen.d.ts +12 -0
- package/dist/generated/unfurl/core/auth.gen.d.ts +25 -0
- package/dist/generated/unfurl/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/unfurl/core/params.gen.d.ts +43 -0
- package/dist/generated/unfurl/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/unfurl/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/unfurl/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/unfurl/core/types.gen.d.ts +83 -0
- package/dist/generated/unfurl/core/utils.gen.d.ts +19 -0
- package/dist/generated/unfurl/index.d.ts +2 -0
- package/dist/generated/unfurl/index.js +835 -0
- package/dist/generated/unfurl/sdk.gen.d.ts +47 -0
- package/dist/generated/unfurl/types.gen.d.ts +125 -0
- package/dist/src/config.d.ts +51 -0
- package/dist/src/entities/agent-sessions/agent-session.d.ts +45 -0
- package/dist/src/entities/agent-sessions/namespace.d.ts +18 -0
- package/dist/src/entities/bots/namespace.d.ts +25 -0
- package/dist/src/entities/calls/call-record.d.ts +55 -0
- package/dist/src/entities/calls/namespace.d.ts +9 -0
- package/dist/src/entities/channels/channel.d.ts +88 -0
- package/dist/src/entities/channels/message.d.ts +64 -0
- package/dist/src/entities/channels/namespace.d.ts +30 -0
- package/dist/src/entities/channels/post.d.ts +20 -0
- package/dist/src/entities/channels/thread.d.ts +30 -0
- package/dist/src/entities/chats/chat.d.ts +55 -0
- package/dist/src/entities/chats/namespace.d.ts +14 -0
- package/dist/src/entities/crm/comment.d.ts +43 -0
- package/dist/src/entities/crm/company.d.ts +70 -0
- package/dist/src/entities/crm/contact.d.ts +48 -0
- package/dist/src/entities/crm/namespace.d.ts +22 -0
- package/dist/src/entities/documents/comment.d.ts +41 -0
- package/dist/src/entities/documents/document.d.ts +130 -0
- package/dist/src/entities/documents/namespace.d.ts +43 -0
- package/dist/src/entities/documents/system-skill.d.ts +16 -0
- package/dist/src/entities/email/attachment.d.ts +36 -0
- package/dist/src/entities/email/label.d.ts +31 -0
- package/dist/src/entities/email/link.d.ts +29 -0
- package/dist/src/entities/email/message.d.ts +58 -0
- package/dist/src/entities/email/namespace.d.ts +49 -0
- package/dist/src/entities/email/thread.d.ts +88 -0
- package/dist/src/entities/entity.d.ts +101 -0
- package/dist/src/entities/favorites/namespace.d.ts +19 -0
- package/dist/src/entities/foreign/foreign-entity.d.ts +30 -0
- package/dist/src/entities/foreign/namespace.d.ts +7 -0
- package/dist/src/entities/notifications/namespace.d.ts +29 -0
- package/dist/src/entities/notifications/notification.d.ts +50 -0
- package/dist/src/entities/pins/namespace.d.ts +19 -0
- package/dist/src/entities/projects/namespace.d.ts +13 -0
- package/dist/src/entities/projects/project.d.ts +42 -0
- package/dist/src/entities/properties/namespace.d.ts +47 -0
- package/dist/src/entities/properties/property-definition.d.ts +45 -0
- package/dist/src/entities/properties/property-option.d.ts +32 -0
- package/dist/src/entities/search.d.ts +23 -0
- package/dist/src/entities/tasks/namespace.d.ts +21 -0
- package/dist/src/entities/tasks/task.d.ts +34 -0
- package/dist/src/entities/teams/namespace.d.ts +12 -0
- package/dist/src/entities/teams/team.d.ts +40 -0
- package/dist/src/entities/users/namespace.d.ts +10 -0
- package/dist/src/entities/users/user.d.ts +43 -0
- package/dist/src/entities/webhooks/namespace.d.ts +31 -0
- package/dist/src/entities/webhooks/webhook.d.ts +88 -0
- package/dist/src/events/hydrate/channel.d.ts +85 -0
- package/dist/src/events/hydrate/document.d.ts +54 -0
- package/dist/src/events/receiver.d.ts +51 -0
- package/dist/src/events/types.d.ts +40 -0
- package/dist/src/events/verify.d.ts +13 -0
- package/dist/src/local-portmap.d.ts +8 -0
- package/dist/src/macro.d.ts +62 -0
- package/dist/src/macro.js +4215 -0
- package/dist/src/mentions.d.ts +37 -0
- package/dist/src/raw.d.ts +12 -0
- package/dist/src/utils/client.d.ts +53 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/lazy.d.ts +18 -0
- package/dist/src/utils/pagination.d.ts +7 -0
- package/dist/src/utils/unwrap.d.ts +23 -0
- package/package.json +49 -0
|
@@ -0,0 +1,1467 @@
|
|
|
1
|
+
// generated/auth/core/bodySerializer.gen.ts
|
|
2
|
+
var jsonBodySerializer = {
|
|
3
|
+
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
// generated/auth/core/serverSentEvents.gen.ts
|
|
7
|
+
function createSseClient({
|
|
8
|
+
onRequest,
|
|
9
|
+
onSseError,
|
|
10
|
+
onSseEvent,
|
|
11
|
+
responseTransformer,
|
|
12
|
+
responseValidator,
|
|
13
|
+
sseDefaultRetryDelay,
|
|
14
|
+
sseMaxRetryAttempts,
|
|
15
|
+
sseMaxRetryDelay,
|
|
16
|
+
sseSleepFn,
|
|
17
|
+
url,
|
|
18
|
+
...options
|
|
19
|
+
}) {
|
|
20
|
+
let lastEventId;
|
|
21
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
22
|
+
const createStream = async function* () {
|
|
23
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
24
|
+
let attempt = 0;
|
|
25
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
26
|
+
while (true) {
|
|
27
|
+
if (signal.aborted) break;
|
|
28
|
+
attempt++;
|
|
29
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
30
|
+
if (lastEventId !== void 0) {
|
|
31
|
+
headers.set("Last-Event-ID", lastEventId);
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const requestInit = {
|
|
35
|
+
redirect: "follow",
|
|
36
|
+
...options,
|
|
37
|
+
body: options.serializedBody,
|
|
38
|
+
headers,
|
|
39
|
+
signal
|
|
40
|
+
};
|
|
41
|
+
let request = new Request(url, requestInit);
|
|
42
|
+
if (onRequest) {
|
|
43
|
+
request = await onRequest(url, requestInit);
|
|
44
|
+
}
|
|
45
|
+
const _fetch = options.fetch ?? globalThis.fetch;
|
|
46
|
+
const response = await _fetch(request);
|
|
47
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
48
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
49
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
50
|
+
let buffer = "";
|
|
51
|
+
const abortHandler = () => {
|
|
52
|
+
try {
|
|
53
|
+
reader.cancel();
|
|
54
|
+
} catch {
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
signal.addEventListener("abort", abortHandler);
|
|
58
|
+
try {
|
|
59
|
+
while (true) {
|
|
60
|
+
const { done, value } = await reader.read();
|
|
61
|
+
if (done) break;
|
|
62
|
+
buffer += value;
|
|
63
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
64
|
+
const chunks = buffer.split("\n\n");
|
|
65
|
+
buffer = chunks.pop() ?? "";
|
|
66
|
+
for (const chunk of chunks) {
|
|
67
|
+
const lines = chunk.split("\n");
|
|
68
|
+
const dataLines = [];
|
|
69
|
+
let eventName;
|
|
70
|
+
for (const line of lines) {
|
|
71
|
+
if (line.startsWith("data:")) {
|
|
72
|
+
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
73
|
+
} else if (line.startsWith("event:")) {
|
|
74
|
+
eventName = line.replace(/^event:\s*/, "");
|
|
75
|
+
} else if (line.startsWith("id:")) {
|
|
76
|
+
lastEventId = line.replace(/^id:\s*/, "");
|
|
77
|
+
} else if (line.startsWith("retry:")) {
|
|
78
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
79
|
+
if (!Number.isNaN(parsed)) {
|
|
80
|
+
retryDelay = parsed;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
let data;
|
|
85
|
+
let parsedJson = false;
|
|
86
|
+
if (dataLines.length) {
|
|
87
|
+
const rawData = dataLines.join("\n");
|
|
88
|
+
try {
|
|
89
|
+
data = JSON.parse(rawData);
|
|
90
|
+
parsedJson = true;
|
|
91
|
+
} catch {
|
|
92
|
+
data = rawData;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (parsedJson) {
|
|
96
|
+
if (responseValidator) {
|
|
97
|
+
await responseValidator(data);
|
|
98
|
+
}
|
|
99
|
+
if (responseTransformer) {
|
|
100
|
+
data = await responseTransformer(data);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
onSseEvent?.({
|
|
104
|
+
data,
|
|
105
|
+
event: eventName,
|
|
106
|
+
id: lastEventId,
|
|
107
|
+
retry: retryDelay
|
|
108
|
+
});
|
|
109
|
+
if (dataLines.length) {
|
|
110
|
+
yield data;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} finally {
|
|
115
|
+
signal.removeEventListener("abort", abortHandler);
|
|
116
|
+
reader.releaseLock();
|
|
117
|
+
}
|
|
118
|
+
break;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
onSseError?.(error);
|
|
121
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
125
|
+
await sleep(backoff);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const stream = createStream();
|
|
130
|
+
return { stream };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// generated/auth/core/pathSerializer.gen.ts
|
|
134
|
+
var separatorArrayExplode = (style) => {
|
|
135
|
+
switch (style) {
|
|
136
|
+
case "label":
|
|
137
|
+
return ".";
|
|
138
|
+
case "matrix":
|
|
139
|
+
return ";";
|
|
140
|
+
case "simple":
|
|
141
|
+
return ",";
|
|
142
|
+
default:
|
|
143
|
+
return "&";
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var separatorArrayNoExplode = (style) => {
|
|
147
|
+
switch (style) {
|
|
148
|
+
case "form":
|
|
149
|
+
return ",";
|
|
150
|
+
case "pipeDelimited":
|
|
151
|
+
return "|";
|
|
152
|
+
case "spaceDelimited":
|
|
153
|
+
return "%20";
|
|
154
|
+
default:
|
|
155
|
+
return ",";
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
var separatorObjectExplode = (style) => {
|
|
159
|
+
switch (style) {
|
|
160
|
+
case "label":
|
|
161
|
+
return ".";
|
|
162
|
+
case "matrix":
|
|
163
|
+
return ";";
|
|
164
|
+
case "simple":
|
|
165
|
+
return ",";
|
|
166
|
+
default:
|
|
167
|
+
return "&";
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
var serializeArrayParam = ({
|
|
171
|
+
allowReserved,
|
|
172
|
+
explode,
|
|
173
|
+
name,
|
|
174
|
+
style,
|
|
175
|
+
value
|
|
176
|
+
}) => {
|
|
177
|
+
if (!explode) {
|
|
178
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
179
|
+
switch (style) {
|
|
180
|
+
case "label":
|
|
181
|
+
return `.${joinedValues2}`;
|
|
182
|
+
case "matrix":
|
|
183
|
+
return `;${name}=${joinedValues2}`;
|
|
184
|
+
case "simple":
|
|
185
|
+
return joinedValues2;
|
|
186
|
+
default:
|
|
187
|
+
return `${name}=${joinedValues2}`;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const separator = separatorArrayExplode(style);
|
|
191
|
+
const joinedValues = value.map((v) => {
|
|
192
|
+
if (style === "label" || style === "simple") {
|
|
193
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
194
|
+
}
|
|
195
|
+
return serializePrimitiveParam({
|
|
196
|
+
allowReserved,
|
|
197
|
+
name,
|
|
198
|
+
value: v
|
|
199
|
+
});
|
|
200
|
+
}).join(separator);
|
|
201
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
202
|
+
};
|
|
203
|
+
var serializePrimitiveParam = ({
|
|
204
|
+
allowReserved,
|
|
205
|
+
name,
|
|
206
|
+
value
|
|
207
|
+
}) => {
|
|
208
|
+
if (value === void 0 || value === null) {
|
|
209
|
+
return "";
|
|
210
|
+
}
|
|
211
|
+
if (typeof value === "object") {
|
|
212
|
+
throw new Error(
|
|
213
|
+
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
217
|
+
};
|
|
218
|
+
var serializeObjectParam = ({
|
|
219
|
+
allowReserved,
|
|
220
|
+
explode,
|
|
221
|
+
name,
|
|
222
|
+
style,
|
|
223
|
+
value,
|
|
224
|
+
valueOnly
|
|
225
|
+
}) => {
|
|
226
|
+
if (value instanceof Date) {
|
|
227
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
228
|
+
}
|
|
229
|
+
if (style !== "deepObject" && !explode) {
|
|
230
|
+
let values = [];
|
|
231
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
232
|
+
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
233
|
+
});
|
|
234
|
+
const joinedValues2 = values.join(",");
|
|
235
|
+
switch (style) {
|
|
236
|
+
case "form":
|
|
237
|
+
return `${name}=${joinedValues2}`;
|
|
238
|
+
case "label":
|
|
239
|
+
return `.${joinedValues2}`;
|
|
240
|
+
case "matrix":
|
|
241
|
+
return `;${name}=${joinedValues2}`;
|
|
242
|
+
default:
|
|
243
|
+
return joinedValues2;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const separator = separatorObjectExplode(style);
|
|
247
|
+
const joinedValues = Object.entries(value).map(
|
|
248
|
+
([key, v]) => serializePrimitiveParam({
|
|
249
|
+
allowReserved,
|
|
250
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
251
|
+
value: v
|
|
252
|
+
})
|
|
253
|
+
).join(separator);
|
|
254
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// generated/auth/core/utils.gen.ts
|
|
258
|
+
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
259
|
+
var defaultPathSerializer = ({ path, url: _url }) => {
|
|
260
|
+
let url = _url;
|
|
261
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
262
|
+
if (matches) {
|
|
263
|
+
for (const match of matches) {
|
|
264
|
+
let explode = false;
|
|
265
|
+
let name = match.substring(1, match.length - 1);
|
|
266
|
+
let style = "simple";
|
|
267
|
+
if (name.endsWith("*")) {
|
|
268
|
+
explode = true;
|
|
269
|
+
name = name.substring(0, name.length - 1);
|
|
270
|
+
}
|
|
271
|
+
if (name.startsWith(".")) {
|
|
272
|
+
name = name.substring(1);
|
|
273
|
+
style = "label";
|
|
274
|
+
} else if (name.startsWith(";")) {
|
|
275
|
+
name = name.substring(1);
|
|
276
|
+
style = "matrix";
|
|
277
|
+
}
|
|
278
|
+
const value = path[name];
|
|
279
|
+
if (value === void 0 || value === null) {
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
if (Array.isArray(value)) {
|
|
283
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
if (typeof value === "object") {
|
|
287
|
+
url = url.replace(
|
|
288
|
+
match,
|
|
289
|
+
serializeObjectParam({
|
|
290
|
+
explode,
|
|
291
|
+
name,
|
|
292
|
+
style,
|
|
293
|
+
value,
|
|
294
|
+
valueOnly: true
|
|
295
|
+
})
|
|
296
|
+
);
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (style === "matrix") {
|
|
300
|
+
url = url.replace(
|
|
301
|
+
match,
|
|
302
|
+
`;${serializePrimitiveParam({
|
|
303
|
+
name,
|
|
304
|
+
value
|
|
305
|
+
})}`
|
|
306
|
+
);
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
const replaceValue = encodeURIComponent(
|
|
310
|
+
style === "label" ? `.${value}` : value
|
|
311
|
+
);
|
|
312
|
+
url = url.replace(match, replaceValue);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return url;
|
|
316
|
+
};
|
|
317
|
+
var getUrl = ({
|
|
318
|
+
baseUrl,
|
|
319
|
+
path,
|
|
320
|
+
query,
|
|
321
|
+
querySerializer,
|
|
322
|
+
url: _url
|
|
323
|
+
}) => {
|
|
324
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
325
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
326
|
+
if (path) {
|
|
327
|
+
url = defaultPathSerializer({ path, url });
|
|
328
|
+
}
|
|
329
|
+
let search = query ? querySerializer(query) : "";
|
|
330
|
+
if (search.startsWith("?")) {
|
|
331
|
+
search = search.substring(1);
|
|
332
|
+
}
|
|
333
|
+
if (search) {
|
|
334
|
+
url += `?${search}`;
|
|
335
|
+
}
|
|
336
|
+
return url;
|
|
337
|
+
};
|
|
338
|
+
function getValidRequestBody(options) {
|
|
339
|
+
const hasBody = options.body !== void 0;
|
|
340
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
341
|
+
if (isSerializedBody) {
|
|
342
|
+
if ("serializedBody" in options) {
|
|
343
|
+
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
344
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
345
|
+
}
|
|
346
|
+
return options.body !== "" ? options.body : null;
|
|
347
|
+
}
|
|
348
|
+
if (hasBody) {
|
|
349
|
+
return options.body;
|
|
350
|
+
}
|
|
351
|
+
return void 0;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// generated/auth/core/auth.gen.ts
|
|
355
|
+
var getAuthToken = async (auth, callback) => {
|
|
356
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
357
|
+
if (!token) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (auth.scheme === "bearer") {
|
|
361
|
+
return `Bearer ${token}`;
|
|
362
|
+
}
|
|
363
|
+
if (auth.scheme === "basic") {
|
|
364
|
+
return `Basic ${btoa(token)}`;
|
|
365
|
+
}
|
|
366
|
+
return token;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// generated/auth/client/utils.gen.ts
|
|
370
|
+
var createQuerySerializer = ({
|
|
371
|
+
parameters = {},
|
|
372
|
+
...args
|
|
373
|
+
} = {}) => {
|
|
374
|
+
const querySerializer = (queryParams) => {
|
|
375
|
+
const search = [];
|
|
376
|
+
if (queryParams && typeof queryParams === "object") {
|
|
377
|
+
for (const name in queryParams) {
|
|
378
|
+
const value = queryParams[name];
|
|
379
|
+
if (value === void 0 || value === null) {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
const options = parameters[name] || args;
|
|
383
|
+
if (Array.isArray(value)) {
|
|
384
|
+
const serializedArray = serializeArrayParam({
|
|
385
|
+
allowReserved: options.allowReserved,
|
|
386
|
+
explode: true,
|
|
387
|
+
name,
|
|
388
|
+
style: "form",
|
|
389
|
+
value,
|
|
390
|
+
...options.array
|
|
391
|
+
});
|
|
392
|
+
if (serializedArray) search.push(serializedArray);
|
|
393
|
+
} else if (typeof value === "object") {
|
|
394
|
+
const serializedObject = serializeObjectParam({
|
|
395
|
+
allowReserved: options.allowReserved,
|
|
396
|
+
explode: true,
|
|
397
|
+
name,
|
|
398
|
+
style: "deepObject",
|
|
399
|
+
value,
|
|
400
|
+
...options.object
|
|
401
|
+
});
|
|
402
|
+
if (serializedObject) search.push(serializedObject);
|
|
403
|
+
} else {
|
|
404
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
405
|
+
allowReserved: options.allowReserved,
|
|
406
|
+
name,
|
|
407
|
+
value
|
|
408
|
+
});
|
|
409
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return search.join("&");
|
|
414
|
+
};
|
|
415
|
+
return querySerializer;
|
|
416
|
+
};
|
|
417
|
+
var getParseAs = (contentType) => {
|
|
418
|
+
if (!contentType) {
|
|
419
|
+
return "stream";
|
|
420
|
+
}
|
|
421
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
422
|
+
if (!cleanContent) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
426
|
+
return "json";
|
|
427
|
+
}
|
|
428
|
+
if (cleanContent === "multipart/form-data") {
|
|
429
|
+
return "formData";
|
|
430
|
+
}
|
|
431
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
432
|
+
return "blob";
|
|
433
|
+
}
|
|
434
|
+
if (cleanContent.startsWith("text/")) {
|
|
435
|
+
return "text";
|
|
436
|
+
}
|
|
437
|
+
return;
|
|
438
|
+
};
|
|
439
|
+
var checkForExistence = (options, name) => {
|
|
440
|
+
if (!name) {
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
return false;
|
|
447
|
+
};
|
|
448
|
+
async function setAuthParams(options) {
|
|
449
|
+
for (const auth of options.security ?? []) {
|
|
450
|
+
if (checkForExistence(options, auth.name)) {
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
const token = await getAuthToken(auth, options.auth);
|
|
454
|
+
if (!token) {
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
const name = auth.name ?? "Authorization";
|
|
458
|
+
switch (auth.in) {
|
|
459
|
+
case "query":
|
|
460
|
+
if (!options.query) {
|
|
461
|
+
options.query = {};
|
|
462
|
+
}
|
|
463
|
+
options.query[name] = token;
|
|
464
|
+
break;
|
|
465
|
+
case "cookie":
|
|
466
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
467
|
+
break;
|
|
468
|
+
case "header":
|
|
469
|
+
default:
|
|
470
|
+
options.headers.set(name, token);
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
var buildUrl = (options) => getUrl({
|
|
476
|
+
baseUrl: options.baseUrl,
|
|
477
|
+
path: options.path,
|
|
478
|
+
query: options.query,
|
|
479
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
480
|
+
url: options.url
|
|
481
|
+
});
|
|
482
|
+
var mergeConfigs = (a, b) => {
|
|
483
|
+
const config = { ...a, ...b };
|
|
484
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
485
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
486
|
+
}
|
|
487
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
488
|
+
return config;
|
|
489
|
+
};
|
|
490
|
+
var headersEntries = (headers) => {
|
|
491
|
+
const entries = [];
|
|
492
|
+
headers.forEach((value, key) => {
|
|
493
|
+
entries.push([key, value]);
|
|
494
|
+
});
|
|
495
|
+
return entries;
|
|
496
|
+
};
|
|
497
|
+
var mergeHeaders = (...headers) => {
|
|
498
|
+
const mergedHeaders = new Headers();
|
|
499
|
+
for (const header of headers) {
|
|
500
|
+
if (!header) {
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
504
|
+
for (const [key, value] of iterator) {
|
|
505
|
+
if (value === null) {
|
|
506
|
+
mergedHeaders.delete(key);
|
|
507
|
+
} else if (Array.isArray(value)) {
|
|
508
|
+
for (const v of value) {
|
|
509
|
+
mergedHeaders.append(key, v);
|
|
510
|
+
}
|
|
511
|
+
} else if (value !== void 0) {
|
|
512
|
+
mergedHeaders.set(
|
|
513
|
+
key,
|
|
514
|
+
typeof value === "object" ? JSON.stringify(value) : value
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return mergedHeaders;
|
|
520
|
+
};
|
|
521
|
+
var Interceptors = class {
|
|
522
|
+
fns = [];
|
|
523
|
+
clear() {
|
|
524
|
+
this.fns = [];
|
|
525
|
+
}
|
|
526
|
+
eject(id) {
|
|
527
|
+
const index = this.getInterceptorIndex(id);
|
|
528
|
+
if (this.fns[index]) {
|
|
529
|
+
this.fns[index] = null;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
exists(id) {
|
|
533
|
+
const index = this.getInterceptorIndex(id);
|
|
534
|
+
return Boolean(this.fns[index]);
|
|
535
|
+
}
|
|
536
|
+
getInterceptorIndex(id) {
|
|
537
|
+
if (typeof id === "number") {
|
|
538
|
+
return this.fns[id] ? id : -1;
|
|
539
|
+
}
|
|
540
|
+
return this.fns.indexOf(id);
|
|
541
|
+
}
|
|
542
|
+
update(id, fn) {
|
|
543
|
+
const index = this.getInterceptorIndex(id);
|
|
544
|
+
if (this.fns[index]) {
|
|
545
|
+
this.fns[index] = fn;
|
|
546
|
+
return id;
|
|
547
|
+
}
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
550
|
+
use(fn) {
|
|
551
|
+
this.fns.push(fn);
|
|
552
|
+
return this.fns.length - 1;
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
var createInterceptors = () => ({
|
|
556
|
+
error: new Interceptors(),
|
|
557
|
+
request: new Interceptors(),
|
|
558
|
+
response: new Interceptors()
|
|
559
|
+
});
|
|
560
|
+
var defaultQuerySerializer = createQuerySerializer({
|
|
561
|
+
allowReserved: false,
|
|
562
|
+
array: {
|
|
563
|
+
explode: true,
|
|
564
|
+
style: "form"
|
|
565
|
+
},
|
|
566
|
+
object: {
|
|
567
|
+
explode: true,
|
|
568
|
+
style: "deepObject"
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
var defaultHeaders = {
|
|
572
|
+
"Content-Type": "application/json"
|
|
573
|
+
};
|
|
574
|
+
var createConfig = (override = {}) => ({
|
|
575
|
+
...jsonBodySerializer,
|
|
576
|
+
headers: defaultHeaders,
|
|
577
|
+
parseAs: "auto",
|
|
578
|
+
querySerializer: defaultQuerySerializer,
|
|
579
|
+
...override
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
// generated/auth/client/client.gen.ts
|
|
583
|
+
var createClient = (config = {}) => {
|
|
584
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
585
|
+
const getConfig = () => ({ ..._config });
|
|
586
|
+
const setConfig = (config2) => {
|
|
587
|
+
_config = mergeConfigs(_config, config2);
|
|
588
|
+
return getConfig();
|
|
589
|
+
};
|
|
590
|
+
const interceptors = createInterceptors();
|
|
591
|
+
const beforeRequest = async (options) => {
|
|
592
|
+
const opts = {
|
|
593
|
+
..._config,
|
|
594
|
+
...options,
|
|
595
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
596
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
597
|
+
serializedBody: void 0
|
|
598
|
+
};
|
|
599
|
+
if (opts.security) {
|
|
600
|
+
await setAuthParams(opts);
|
|
601
|
+
}
|
|
602
|
+
if (opts.requestValidator) {
|
|
603
|
+
await opts.requestValidator(opts);
|
|
604
|
+
}
|
|
605
|
+
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
606
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
607
|
+
}
|
|
608
|
+
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
609
|
+
opts.headers.delete("Content-Type");
|
|
610
|
+
}
|
|
611
|
+
const resolvedOpts = opts;
|
|
612
|
+
const url = buildUrl(resolvedOpts);
|
|
613
|
+
return { opts: resolvedOpts, url };
|
|
614
|
+
};
|
|
615
|
+
const request = async (options) => {
|
|
616
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
617
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
618
|
+
let request2;
|
|
619
|
+
let response;
|
|
620
|
+
try {
|
|
621
|
+
const { opts, url } = await beforeRequest(options);
|
|
622
|
+
const requestInit = {
|
|
623
|
+
redirect: "follow",
|
|
624
|
+
...opts,
|
|
625
|
+
body: getValidRequestBody(opts)
|
|
626
|
+
};
|
|
627
|
+
request2 = new Request(url, requestInit);
|
|
628
|
+
for (const fn of interceptors.request.fns) {
|
|
629
|
+
if (fn) {
|
|
630
|
+
request2 = await fn(request2, opts);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
const _fetch = opts.fetch;
|
|
634
|
+
response = await _fetch(request2);
|
|
635
|
+
for (const fn of interceptors.response.fns) {
|
|
636
|
+
if (fn) {
|
|
637
|
+
response = await fn(response, request2, opts);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
const result = {
|
|
641
|
+
request: request2,
|
|
642
|
+
response
|
|
643
|
+
};
|
|
644
|
+
if (response.ok) {
|
|
645
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
646
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
647
|
+
let emptyData;
|
|
648
|
+
switch (parseAs) {
|
|
649
|
+
case "arrayBuffer":
|
|
650
|
+
case "blob":
|
|
651
|
+
case "text":
|
|
652
|
+
emptyData = await response[parseAs]();
|
|
653
|
+
break;
|
|
654
|
+
case "formData":
|
|
655
|
+
emptyData = new FormData();
|
|
656
|
+
break;
|
|
657
|
+
case "stream":
|
|
658
|
+
emptyData = response.body;
|
|
659
|
+
break;
|
|
660
|
+
case "json":
|
|
661
|
+
default:
|
|
662
|
+
emptyData = {};
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
666
|
+
data: emptyData,
|
|
667
|
+
...result
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
let data;
|
|
671
|
+
switch (parseAs) {
|
|
672
|
+
case "arrayBuffer":
|
|
673
|
+
case "blob":
|
|
674
|
+
case "formData":
|
|
675
|
+
case "text":
|
|
676
|
+
data = await response[parseAs]();
|
|
677
|
+
break;
|
|
678
|
+
case "json": {
|
|
679
|
+
const text = await response.text();
|
|
680
|
+
data = text ? JSON.parse(text) : {};
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
case "stream":
|
|
684
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
685
|
+
data: response.body,
|
|
686
|
+
...result
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
if (parseAs === "json") {
|
|
690
|
+
if (opts.responseValidator) {
|
|
691
|
+
await opts.responseValidator(data);
|
|
692
|
+
}
|
|
693
|
+
if (opts.responseTransformer) {
|
|
694
|
+
data = await opts.responseTransformer(data);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return opts.responseStyle === "data" ? data : {
|
|
698
|
+
data,
|
|
699
|
+
...result
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
const textError = await response.text();
|
|
703
|
+
let jsonError;
|
|
704
|
+
try {
|
|
705
|
+
jsonError = JSON.parse(textError);
|
|
706
|
+
} catch {
|
|
707
|
+
}
|
|
708
|
+
throw jsonError ?? textError;
|
|
709
|
+
} catch (error) {
|
|
710
|
+
let finalError = error;
|
|
711
|
+
for (const fn of interceptors.error.fns) {
|
|
712
|
+
if (fn) {
|
|
713
|
+
finalError = await fn(finalError, response, request2, options);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
finalError = finalError || {};
|
|
717
|
+
if (throwOnError) {
|
|
718
|
+
throw finalError;
|
|
719
|
+
}
|
|
720
|
+
return responseStyle === "data" ? void 0 : {
|
|
721
|
+
error: finalError,
|
|
722
|
+
request: request2,
|
|
723
|
+
response
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
728
|
+
const makeSseFn = (method) => async (options) => {
|
|
729
|
+
const { opts, url } = await beforeRequest(options);
|
|
730
|
+
return createSseClient({
|
|
731
|
+
...opts,
|
|
732
|
+
body: opts.body,
|
|
733
|
+
method,
|
|
734
|
+
onRequest: async (url2, init) => {
|
|
735
|
+
let request2 = new Request(url2, init);
|
|
736
|
+
for (const fn of interceptors.request.fns) {
|
|
737
|
+
if (fn) {
|
|
738
|
+
request2 = await fn(request2, opts);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
return request2;
|
|
742
|
+
},
|
|
743
|
+
serializedBody: getValidRequestBody(opts),
|
|
744
|
+
url
|
|
745
|
+
});
|
|
746
|
+
};
|
|
747
|
+
const _buildUrl = (options) => buildUrl({ ..._config, ...options });
|
|
748
|
+
return {
|
|
749
|
+
buildUrl: _buildUrl,
|
|
750
|
+
connect: makeMethodFn("CONNECT"),
|
|
751
|
+
delete: makeMethodFn("DELETE"),
|
|
752
|
+
get: makeMethodFn("GET"),
|
|
753
|
+
getConfig,
|
|
754
|
+
head: makeMethodFn("HEAD"),
|
|
755
|
+
interceptors,
|
|
756
|
+
options: makeMethodFn("OPTIONS"),
|
|
757
|
+
patch: makeMethodFn("PATCH"),
|
|
758
|
+
post: makeMethodFn("POST"),
|
|
759
|
+
put: makeMethodFn("PUT"),
|
|
760
|
+
request,
|
|
761
|
+
setConfig,
|
|
762
|
+
sse: {
|
|
763
|
+
connect: makeSseFn("CONNECT"),
|
|
764
|
+
delete: makeSseFn("DELETE"),
|
|
765
|
+
get: makeSseFn("GET"),
|
|
766
|
+
head: makeSseFn("HEAD"),
|
|
767
|
+
options: makeSseFn("OPTIONS"),
|
|
768
|
+
patch: makeSseFn("PATCH"),
|
|
769
|
+
post: makeSseFn("POST"),
|
|
770
|
+
put: makeSseFn("PUT"),
|
|
771
|
+
trace: makeSseFn("TRACE")
|
|
772
|
+
},
|
|
773
|
+
trace: makeMethodFn("TRACE")
|
|
774
|
+
};
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
// generated/auth/client.gen.ts
|
|
778
|
+
var client = createClient(createConfig());
|
|
779
|
+
|
|
780
|
+
// generated/auth/sdk.gen.ts
|
|
781
|
+
var HeyApiClient = class {
|
|
782
|
+
client;
|
|
783
|
+
constructor(args) {
|
|
784
|
+
this.client = args?.client ?? client;
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
var HeyApiRegistry = class {
|
|
788
|
+
defaultKey = "default";
|
|
789
|
+
instances = /* @__PURE__ */ new Map();
|
|
790
|
+
get(key) {
|
|
791
|
+
const instance = this.instances.get(key ?? this.defaultKey);
|
|
792
|
+
if (!instance) {
|
|
793
|
+
throw new Error(`No SDK client found. Create one with "new Sdk()" to fix this error.`);
|
|
794
|
+
}
|
|
795
|
+
return instance;
|
|
796
|
+
}
|
|
797
|
+
set(value, key) {
|
|
798
|
+
this.instances.set(key ?? this.defaultKey, value);
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
var Sdk = class _Sdk extends HeyApiClient {
|
|
802
|
+
static __registry = new HeyApiRegistry();
|
|
803
|
+
constructor(args) {
|
|
804
|
+
super(args);
|
|
805
|
+
_Sdk.__registry.set(this, args?.key);
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Forgets the caller's Cursor API key.
|
|
809
|
+
*
|
|
810
|
+
* This does **not** revoke the key at Cursor — it keeps working everywhere
|
|
811
|
+
* else it is used, and only Cursor can revoke it. Any UI offering this has to
|
|
812
|
+
* say so rather than implying otherwise.
|
|
813
|
+
*
|
|
814
|
+
* Deleting when there is nothing to delete succeeds: the caller's intent is
|
|
815
|
+
* "I should have no key registered", and that is already true.
|
|
816
|
+
*/
|
|
817
|
+
deleteCursorApiKey(options) {
|
|
818
|
+
return (options?.client ?? this.client).delete({ url: "/cursor-api-key", ...options });
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Whether the caller has a Cursor API key registered.
|
|
822
|
+
*
|
|
823
|
+
* Never returns the key, or any part of it. There is no screen that needs one,
|
|
824
|
+
* and a masked key still leaks its length and alphabet.
|
|
825
|
+
*/
|
|
826
|
+
getCursorApiKey(options) {
|
|
827
|
+
return (options?.client ?? this.client).get({ url: "/cursor-api-key", ...options });
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Registers or replaces the caller's Cursor API key.
|
|
831
|
+
*
|
|
832
|
+
* The key is validated on shape alone — this cannot distinguish a live key
|
|
833
|
+
* from forty random characters behind the right prefix. Confirming it against
|
|
834
|
+
* Cursor's `GET /v1/me` is the obvious improvement, and is what would let this
|
|
835
|
+
* report the connected account rather than only that a key exists.
|
|
836
|
+
*/
|
|
837
|
+
putCursorApiKey(options) {
|
|
838
|
+
return (options.client ?? this.client).put({
|
|
839
|
+
url: "/cursor-api-key",
|
|
840
|
+
...options,
|
|
841
|
+
headers: {
|
|
842
|
+
"Content-Type": "application/json",
|
|
843
|
+
...options.headers
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Choose the model this user's `@cursor` sessions start on.
|
|
849
|
+
*
|
|
850
|
+
* Stores the id only; its parameters are resolved from Cursor's own default
|
|
851
|
+
* variant at session start. Not validated against the live model list here —
|
|
852
|
+
* the settings dropdown offers only real ids, and a stale id degrades to the
|
|
853
|
+
* deployment default at spawn rather than failing, so a round trip to Cursor
|
|
854
|
+
* on every save would buy nothing.
|
|
855
|
+
*/
|
|
856
|
+
putCursorDefaultModel(options) {
|
|
857
|
+
return (options.client ?? this.client).put({
|
|
858
|
+
url: "/cursor-api-key/default-model",
|
|
859
|
+
...options,
|
|
860
|
+
headers: {
|
|
861
|
+
"Content-Type": "application/json",
|
|
862
|
+
...options.headers
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* List the models the caller's Cursor account offers.
|
|
868
|
+
*
|
|
869
|
+
* Reached only from the settings dropdown, so it decrypts the user's own key
|
|
870
|
+
* and asks Cursor directly — the list is per-account and changes, so there is
|
|
871
|
+
* nothing to cache statically. Reuses the harness's Cursor client rather than
|
|
872
|
+
* reimplementing the `/v1/models` parse, keeping one source of truth for what
|
|
873
|
+
* a model is.
|
|
874
|
+
*/
|
|
875
|
+
listCursorModels(options) {
|
|
876
|
+
return (options?.client ?? this.client).get({ url: "/cursor-api-key/models", ...options });
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Verifies the user's primary email for FusionAuth
|
|
880
|
+
*/
|
|
881
|
+
verifyFusionauthUserEmail(options) {
|
|
882
|
+
return (options.client ?? this.client).get({ url: "/email/fusionauth/verify/{verification_id}", ...options });
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Resend the user's primary email verification for FusionAuth
|
|
886
|
+
*/
|
|
887
|
+
resendFusionauthVerifyUserEmail(options) {
|
|
888
|
+
return (options.client ?? this.client).post({
|
|
889
|
+
url: "/email/fusionauth_resend",
|
|
890
|
+
...options,
|
|
891
|
+
headers: {
|
|
892
|
+
"Content-Type": "application/json",
|
|
893
|
+
...options.headers
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Generates an email link for the user to verify their email address.
|
|
899
|
+
*/
|
|
900
|
+
generateEmailLink(options) {
|
|
901
|
+
return (options.client ?? this.client).post({
|
|
902
|
+
url: "/email/generate/link",
|
|
903
|
+
...options,
|
|
904
|
+
headers: {
|
|
905
|
+
"Content-Type": "application/json",
|
|
906
|
+
...options.headers
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Verifies the user's email for a user profile
|
|
912
|
+
*/
|
|
913
|
+
verifyEmailLink(options) {
|
|
914
|
+
return (options.client ?? this.client).get({ url: "/email/verify/{verification_id}", ...options });
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Enriches GitHub pull request references with live GitHub data for the authenticated user.
|
|
918
|
+
*/
|
|
919
|
+
enrichGithubPullRequests(options) {
|
|
920
|
+
return (options.client ?? this.client).post({
|
|
921
|
+
url: "/github_pull_requests/enrich",
|
|
922
|
+
...options,
|
|
923
|
+
headers: {
|
|
924
|
+
"Content-Type": "application/json",
|
|
925
|
+
...options.headers
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Health check
|
|
931
|
+
*/
|
|
932
|
+
healthHandler(options) {
|
|
933
|
+
return (options?.client ?? this.client).get({ url: "/health", ...options });
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Generates a macro-api-token using the user's macro-access-token
|
|
937
|
+
* You can either have your access token in the cookies or in the request
|
|
938
|
+
* headers
|
|
939
|
+
* Authorization: Bearer <access_token>
|
|
940
|
+
* This returns a new macro-api-token
|
|
941
|
+
*/
|
|
942
|
+
macroApiToken(options) {
|
|
943
|
+
return (options.client ?? this.client).get({ url: "/jwt/macro_api_token", ...options });
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Refreshes a JWT token
|
|
947
|
+
* You can either have your access token and refresh token in the cookies or in the request
|
|
948
|
+
* headers
|
|
949
|
+
* Authorization: Bearer <access_token>
|
|
950
|
+
* x-macro-refresh-token: <refresh_token>
|
|
951
|
+
* This returns the cookies with the new access and refresh token
|
|
952
|
+
*/
|
|
953
|
+
refresh(options) {
|
|
954
|
+
return (options?.client ?? this.client).post({ url: "/jwt/refresh", ...options });
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Initiates a link for a user
|
|
958
|
+
*/
|
|
959
|
+
createInProgressLink(options) {
|
|
960
|
+
return (options?.client ?? this.client).post({ url: "/link", ...options });
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Deletes a github link for a user
|
|
964
|
+
*/
|
|
965
|
+
deleteGithubLink(options) {
|
|
966
|
+
return (options?.client ?? this.client).delete({ url: "/link/github", ...options });
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Initiates a link for a user
|
|
970
|
+
*/
|
|
971
|
+
initGithubLink(options) {
|
|
972
|
+
return (options.client ?? this.client).post({ url: "/link/github", ...options });
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Checks whether the authenticated user's GitHub link token is valid.
|
|
976
|
+
*/
|
|
977
|
+
checkGithubLinkStatus(options) {
|
|
978
|
+
return (options?.client ?? this.client).get({ url: "/link/github/status", ...options });
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Initiates a Gmail link for a user
|
|
982
|
+
*/
|
|
983
|
+
initGmailLink(options) {
|
|
984
|
+
return (options.client ?? this.client).post({ url: "/link/gmail", ...options });
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Checks whether the authenticated user's gmail link is valid.
|
|
988
|
+
*/
|
|
989
|
+
checkGmailLinkStatus(options) {
|
|
990
|
+
return (options?.client ?? this.client).get({ url: "/link/gmail/status", ...options });
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Initiates a Microsoft Outlook account link for an authenticated user.
|
|
994
|
+
*/
|
|
995
|
+
initOutlookLink(options) {
|
|
996
|
+
return (options?.client ?? this.client).post({ url: "/link/outlook", ...options });
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Completes the apple login flow
|
|
1000
|
+
*/
|
|
1001
|
+
appleLogin(options) {
|
|
1002
|
+
return (options.client ?? this.client).post({
|
|
1003
|
+
url: "/login/apple",
|
|
1004
|
+
...options,
|
|
1005
|
+
headers: {
|
|
1006
|
+
"Content-Type": "application/json",
|
|
1007
|
+
...options.headers
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Performs a password login
|
|
1013
|
+
*/
|
|
1014
|
+
passwordLogin(options) {
|
|
1015
|
+
return (options.client ?? this.client).post({
|
|
1016
|
+
url: "/login/password",
|
|
1017
|
+
...options,
|
|
1018
|
+
headers: {
|
|
1019
|
+
"Content-Type": "application/json",
|
|
1020
|
+
...options.headers
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Initiates a passwordless login
|
|
1026
|
+
*/
|
|
1027
|
+
passwordlessLogin(options) {
|
|
1028
|
+
return (options.client ?? this.client).post({
|
|
1029
|
+
url: "/login/passwordless",
|
|
1030
|
+
...options,
|
|
1031
|
+
headers: {
|
|
1032
|
+
"Content-Type": "application/json",
|
|
1033
|
+
...options.headers
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Initiates an SSO login
|
|
1039
|
+
*/
|
|
1040
|
+
ssoLogin(options) {
|
|
1041
|
+
return (options.client ?? this.client).get({ url: "/login/sso", ...options });
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Initiates a passwordless login
|
|
1045
|
+
*/
|
|
1046
|
+
logout(options) {
|
|
1047
|
+
return (options?.client ?? this.client).post({ url: "/logout", ...options });
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Creates a merge request used to verify the user's email address in order to merge their
|
|
1051
|
+
* accounts.
|
|
1052
|
+
* This is different than generate_email_link which is used to verify a new email address to add a
|
|
1053
|
+
* new profile to a user's account.
|
|
1054
|
+
*/
|
|
1055
|
+
createMergeRequest(options) {
|
|
1056
|
+
return (options.client ?? this.client).post({
|
|
1057
|
+
url: "/merge",
|
|
1058
|
+
...options,
|
|
1059
|
+
headers: {
|
|
1060
|
+
"Content-Type": "application/json",
|
|
1061
|
+
...options.headers
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Verifies the merge request
|
|
1067
|
+
*/
|
|
1068
|
+
verifyMergeRequest(options) {
|
|
1069
|
+
return (options.client ?? this.client).get({ url: "/merge/verify/{code}", ...options });
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Enrolls a mobile lead in the Loops nurture sequence, which sends the welcome
|
|
1073
|
+
* email inviting them to register on desktop. No-ops if the address was already
|
|
1074
|
+
* enrolled, and rejects blocked addresses.
|
|
1075
|
+
*/
|
|
1076
|
+
sendMobileWelcomeEmail(options) {
|
|
1077
|
+
return (options.client ?? this.client).post({
|
|
1078
|
+
url: "/mobile-welcome-email",
|
|
1079
|
+
...options,
|
|
1080
|
+
headers: {
|
|
1081
|
+
"Content-Type": "application/json",
|
|
1082
|
+
...options.headers
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Handles oauth redirect
|
|
1088
|
+
*/
|
|
1089
|
+
passwordlessCallback(options) {
|
|
1090
|
+
return (options.client ?? this.client).get({ url: "/oauth/passwordless/{code}", ...options });
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Handles oauth redirect
|
|
1094
|
+
*/
|
|
1095
|
+
oauthRedirect(options) {
|
|
1096
|
+
return (options?.client ?? this.client).get({ url: "/oauth/redirect", ...options });
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Custom OAuth2 callback
|
|
1100
|
+
*/
|
|
1101
|
+
oauth2Callback(options) {
|
|
1102
|
+
return (options.client ?? this.client).get({ url: "/oauth2/{provider}/callback", ...options });
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Gets all permissions
|
|
1106
|
+
*/
|
|
1107
|
+
getPermissions(options) {
|
|
1108
|
+
return (options?.client ?? this.client).get({ url: "/permissions", ...options });
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Gets a list of the users permissions
|
|
1112
|
+
*/
|
|
1113
|
+
getUserPermissions(options) {
|
|
1114
|
+
return (options?.client ?? this.client).get({ url: "/permissions/me", ...options });
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Handler for `GET /referral-code`.
|
|
1118
|
+
*
|
|
1119
|
+
* Returns the authenticated user's referral code.
|
|
1120
|
+
*/
|
|
1121
|
+
getReferralCode(options) {
|
|
1122
|
+
return (options?.client ?? this.client).get({ url: "/referral/code", ...options });
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Handler for `POST /referral/send`.
|
|
1126
|
+
*
|
|
1127
|
+
* Sends a referral code via email to a user
|
|
1128
|
+
*/
|
|
1129
|
+
sendReferralCode(options) {
|
|
1130
|
+
return (options.client ?? this.client).post({
|
|
1131
|
+
url: "/referral/send",
|
|
1132
|
+
...options,
|
|
1133
|
+
headers: {
|
|
1134
|
+
"Content-Type": "application/json",
|
|
1135
|
+
...options.headers
|
|
1136
|
+
}
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
/**
|
|
1140
|
+
* Refreshes a JWT token
|
|
1141
|
+
*/
|
|
1142
|
+
sessionCreation(options) {
|
|
1143
|
+
return (options?.client ?? this.client).post({ url: "/session", ...options });
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Performs a login via session code
|
|
1147
|
+
*/
|
|
1148
|
+
sessionLogin(options) {
|
|
1149
|
+
return (options.client ?? this.client).get({ url: "/session/login/{session_code}", ...options });
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* Deletes a team.
|
|
1153
|
+
* This will update all team members roles and cancel your subscription for the team.
|
|
1154
|
+
* This action is **irreversible** and you will not be able to recover the team afterwards.
|
|
1155
|
+
*/
|
|
1156
|
+
deleteTeam(options) {
|
|
1157
|
+
return (options?.client ?? this.client).delete({ url: "/team", ...options });
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Gets a team by ID.
|
|
1161
|
+
*/
|
|
1162
|
+
getTeam(options) {
|
|
1163
|
+
return (options?.client ?? this.client).get({ url: "/team", ...options });
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Updates a team.
|
|
1167
|
+
*/
|
|
1168
|
+
patchTeam(options) {
|
|
1169
|
+
return (options.client ?? this.client).patch({
|
|
1170
|
+
url: "/team",
|
|
1171
|
+
...options,
|
|
1172
|
+
headers: {
|
|
1173
|
+
"Content-Type": "application/json",
|
|
1174
|
+
...options.headers
|
|
1175
|
+
}
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Creates a new team.
|
|
1180
|
+
*/
|
|
1181
|
+
createTeam(options) {
|
|
1182
|
+
return (options.client ?? this.client).post({
|
|
1183
|
+
url: "/team",
|
|
1184
|
+
...options,
|
|
1185
|
+
headers: {
|
|
1186
|
+
"Content-Type": "application/json",
|
|
1187
|
+
...options.headers
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Toggles automatic domain joining for the team. When the team has no
|
|
1193
|
+
* auto-join domain, sets it to the team owner's email domain — rejected
|
|
1194
|
+
* with a 400 when that domain is a generic email provider domain (e.g.
|
|
1195
|
+
* gmail.com). When one is already set, removes it. New users whose email
|
|
1196
|
+
* domain matches a team's auto-join domain are added to that team on
|
|
1197
|
+
* signup. Requires the caller to be an Admin or Owner of the team.
|
|
1198
|
+
*/
|
|
1199
|
+
toggleTeamAutoJoinDomain(options) {
|
|
1200
|
+
return (options?.client ?? this.client).post({ url: "/team/auto-join-domain/toggle", ...options });
|
|
1201
|
+
}
|
|
1202
|
+
/**
|
|
1203
|
+
* Enables or disables CRM for the team. On enable with `backfill`
|
|
1204
|
+
* (the default), kicks off a best-effort backfill that enqueues a
|
|
1205
|
+
* `PopulateCrmForUser` message per team member (no-op if CRM is
|
|
1206
|
+
* already enabled); without `backfill` the CRM starts empty and fills
|
|
1207
|
+
* from new activity only. On disable,
|
|
1208
|
+
* flips the flag and purges the team's CRM data (cascading through
|
|
1209
|
+
* `crm_companies` → `crm_domains` / `crm_contacts` /
|
|
1210
|
+
* `crm_contact_sources`). Requires the caller to be an Admin or
|
|
1211
|
+
* Owner of the team.
|
|
1212
|
+
*/
|
|
1213
|
+
patchTeamCrmSettings(options) {
|
|
1214
|
+
return (options.client ?? this.client).patch({
|
|
1215
|
+
url: "/team/crm",
|
|
1216
|
+
...options,
|
|
1217
|
+
headers: {
|
|
1218
|
+
"Content-Type": "application/json",
|
|
1219
|
+
...options.headers
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* Invites a user to a team.
|
|
1225
|
+
*/
|
|
1226
|
+
inviteToTeam(options) {
|
|
1227
|
+
return (options.client ?? this.client).post({
|
|
1228
|
+
url: "/team/invite",
|
|
1229
|
+
...options,
|
|
1230
|
+
headers: {
|
|
1231
|
+
"Content-Type": "application/json",
|
|
1232
|
+
...options.headers
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* Deletes a team invite from a team.
|
|
1238
|
+
*/
|
|
1239
|
+
deleteTeamInviteHandler(options) {
|
|
1240
|
+
return (options.client ?? this.client).delete({ url: "/team/invite/{team_invite_id}", ...options });
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Gets all invites for a team.
|
|
1244
|
+
*/
|
|
1245
|
+
getTeamInvites(options) {
|
|
1246
|
+
return (options?.client ?? this.client).get({ url: "/team/invites", ...options });
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Rejects an invitation to join a team.
|
|
1250
|
+
*/
|
|
1251
|
+
rejectInvitation(options) {
|
|
1252
|
+
return (options.client ?? this.client).delete({ url: "/team/join/{team_invite_id}", ...options });
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Joins a team by accepting an invite.
|
|
1256
|
+
*/
|
|
1257
|
+
joinTeam(options) {
|
|
1258
|
+
return (options.client ?? this.client).get({ url: "/team/join/{team_invite_id}", ...options });
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Toggles whether non-admin members may invite users to the team. Teams
|
|
1262
|
+
* start with this on (any member can invite); turning it off restricts
|
|
1263
|
+
* inviting to team admins and owners. Requires the caller to be an Admin
|
|
1264
|
+
* or Owner of the team.
|
|
1265
|
+
*/
|
|
1266
|
+
toggleTeamNonAdminInvites(options) {
|
|
1267
|
+
return (options?.client ?? this.client).post({ url: "/team/non-admin-invites/toggle", ...options });
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Removes a user from a team.
|
|
1271
|
+
*/
|
|
1272
|
+
removeUserFromTeam(options) {
|
|
1273
|
+
return (options.client ?? this.client).delete({ url: "/team/remove/{remove_user_id}", ...options });
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Gets all teams for the authenticated user.
|
|
1277
|
+
*/
|
|
1278
|
+
getUserTeams(options) {
|
|
1279
|
+
return (options?.client ?? this.client).get({ url: "/team/user", ...options });
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Gets all of a user's invitations.
|
|
1283
|
+
*/
|
|
1284
|
+
getUserInvites(options) {
|
|
1285
|
+
return (options?.client ?? this.client).get({ url: "/team/user/invites", ...options });
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* Creates a new user.
|
|
1289
|
+
*/
|
|
1290
|
+
createUser(options) {
|
|
1291
|
+
return (options.client ?? this.client).post({
|
|
1292
|
+
url: "/user",
|
|
1293
|
+
...options,
|
|
1294
|
+
headers: {
|
|
1295
|
+
"Content-Type": "application/json",
|
|
1296
|
+
...options.headers
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Retrieves user names in bulk
|
|
1302
|
+
*/
|
|
1303
|
+
getUserNames(options) {
|
|
1304
|
+
return (options.client ?? this.client).post({
|
|
1305
|
+
url: "/user/get_names",
|
|
1306
|
+
...options,
|
|
1307
|
+
headers: {
|
|
1308
|
+
"Content-Type": "application/json",
|
|
1309
|
+
...options.headers
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
/**
|
|
1314
|
+
* Gets names for passed user profile ids, falling back to the requesting user's email contact names
|
|
1315
|
+
*/
|
|
1316
|
+
getUserNamesWithEmail(options) {
|
|
1317
|
+
return (options.client ?? this.client).post({
|
|
1318
|
+
url: "/user/get_names_with_email",
|
|
1319
|
+
...options,
|
|
1320
|
+
headers: {
|
|
1321
|
+
"Content-Type": "application/json",
|
|
1322
|
+
...options.headers
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Updates the user's group.
|
|
1328
|
+
*/
|
|
1329
|
+
patchUserGroup(options) {
|
|
1330
|
+
return (options.client ?? this.client).patch({
|
|
1331
|
+
url: "/user/group",
|
|
1332
|
+
...options,
|
|
1333
|
+
headers: {
|
|
1334
|
+
"Content-Type": "application/json",
|
|
1335
|
+
...options.headers
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Gets the calling user's info which matches what was given in the **deprecated**
|
|
1341
|
+
* getUserPermissions query in our graphql api.
|
|
1342
|
+
* This will eventually be removed and optimized to use smaller calls that grab
|
|
1343
|
+
* what is needed for various parts of the UI.
|
|
1344
|
+
*/
|
|
1345
|
+
getLegacyUserPermissions(options) {
|
|
1346
|
+
return (options?.client ?? this.client).get({ url: "/user/legacy_user_permissions", ...options });
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Returns whether or not a given idp link exists for a user
|
|
1350
|
+
*/
|
|
1351
|
+
getUserLinkExists(options) {
|
|
1352
|
+
return (options.client ?? this.client).get({ url: "/user/link_exists", ...options });
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Deletes the user who calls this endpoint
|
|
1356
|
+
*/
|
|
1357
|
+
deleteUser(options) {
|
|
1358
|
+
return (options?.client ?? this.client).delete({ url: "/user/me", ...options });
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Gets the calling user's info
|
|
1362
|
+
*/
|
|
1363
|
+
getUserInfo(options) {
|
|
1364
|
+
return (options?.client ?? this.client).get({ url: "/user/me", ...options });
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Retrieves the name of a particular user.
|
|
1368
|
+
*/
|
|
1369
|
+
getUserName(options) {
|
|
1370
|
+
return (options?.client ?? this.client).get({ url: "/user/name", ...options });
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Sets the name of a particular user
|
|
1374
|
+
*/
|
|
1375
|
+
putUserName(options) {
|
|
1376
|
+
return (options?.client ?? this.client).put({ url: "/user/name", ...options });
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Updates the user's onboarding.
|
|
1380
|
+
*/
|
|
1381
|
+
patchUserOnboarding(options) {
|
|
1382
|
+
return (options.client ?? this.client).patch({
|
|
1383
|
+
url: "/user/onboarding",
|
|
1384
|
+
...options,
|
|
1385
|
+
headers: {
|
|
1386
|
+
"Content-Type": "application/json",
|
|
1387
|
+
...options.headers
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
/**
|
|
1392
|
+
* Retrieves the users organization if present.
|
|
1393
|
+
* Returns NO_CONTENT if the user is a not part of an organization.
|
|
1394
|
+
*/
|
|
1395
|
+
getUserOrganization(options) {
|
|
1396
|
+
return (options?.client ?? this.client).get({ url: "/user/organization", ...options });
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Sets the profile picture URL for a particular user
|
|
1400
|
+
*/
|
|
1401
|
+
putProfilePicture(options) {
|
|
1402
|
+
return (options.client ?? this.client).put({ url: "/user/profile_picture", ...options });
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* Retrieves profile picture URLs for a list of users
|
|
1406
|
+
*/
|
|
1407
|
+
postProfilePictures(options) {
|
|
1408
|
+
return (options.client ?? this.client).post({
|
|
1409
|
+
url: "/user/profile_pictures",
|
|
1410
|
+
...options,
|
|
1411
|
+
headers: {
|
|
1412
|
+
"Content-Type": "application/json",
|
|
1413
|
+
...options.headers
|
|
1414
|
+
}
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Retrieves the users quota.
|
|
1419
|
+
* Returns NO_CONTENT if the user is a premium user with no quota.
|
|
1420
|
+
*/
|
|
1421
|
+
getUserQuota(options) {
|
|
1422
|
+
return (options?.client ?? this.client).get({ url: "/user/quota", ...options });
|
|
1423
|
+
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Creates a Stripe checkout session for the user to subscribe.
|
|
1426
|
+
*/
|
|
1427
|
+
createCheckoutSessionV2(options) {
|
|
1428
|
+
return (options.client ?? this.client).post({
|
|
1429
|
+
url: "/user/stripe/checkoutv2",
|
|
1430
|
+
...options,
|
|
1431
|
+
headers: {
|
|
1432
|
+
"Content-Type": "application/json",
|
|
1433
|
+
...options.headers
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Creates a Stripe billing portal session.
|
|
1439
|
+
*/
|
|
1440
|
+
createPortalSession(options) {
|
|
1441
|
+
return (options.client ?? this.client).post({
|
|
1442
|
+
url: "/user/stripe/portal",
|
|
1443
|
+
...options,
|
|
1444
|
+
headers: {
|
|
1445
|
+
"Content-Type": "application/json",
|
|
1446
|
+
...options.headers
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Updates the user's tutorialComplete flag.
|
|
1452
|
+
*/
|
|
1453
|
+
patchUserTutorial(options) {
|
|
1454
|
+
return (options.client ?? this.client).patch({
|
|
1455
|
+
url: "/user/tutorial",
|
|
1456
|
+
...options,
|
|
1457
|
+
headers: {
|
|
1458
|
+
"Content-Type": "application/json",
|
|
1459
|
+
...options.headers
|
|
1460
|
+
}
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
};
|
|
1464
|
+
|
|
1465
|
+
export {
|
|
1466
|
+
Sdk
|
|
1467
|
+
};
|