@stack0/sdk 0.5.9 → 0.5.12
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/crawl/index.d.mts +206 -0
- package/dist/crawl/index.d.ts +206 -0
- package/dist/crawl/index.js +179 -0
- package/dist/crawl/index.js.map +1 -0
- package/dist/crawl/index.mjs +176 -0
- package/dist/crawl/index.mjs.map +1 -0
- package/dist/documents/index.d.mts +84 -0
- package/dist/documents/index.d.ts +84 -0
- package/dist/documents/index.js +144 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/index.mjs +142 -0
- package/dist/documents/index.mjs.map +1 -0
- package/dist/index.d.mts +213 -6
- package/dist/index.d.ts +213 -6
- package/dist/index.js +431 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +426 -1
- package/dist/index.mjs.map +1 -1
- package/dist/mail/index.d.mts +147 -1
- package/dist/mail/index.d.ts +147 -1
- package/dist/mail/index.js +67 -0
- package/dist/mail/index.js.map +1 -1
- package/dist/mail/index.mjs +67 -1
- package/dist/mail/index.mjs.map +1 -1
- package/dist/map/index.d.mts +93 -0
- package/dist/map/index.d.ts +93 -0
- package/dist/map/index.js +151 -0
- package/dist/map/index.js.map +1 -0
- package/dist/map/index.mjs +148 -0
- package/dist/map/index.mjs.map +1 -0
- package/package.json +20 -2
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// src/lib/http-client.ts
|
|
2
|
+
var HttpClient = class {
|
|
3
|
+
apiKey;
|
|
4
|
+
baseUrl;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.apiKey = config.apiKey;
|
|
7
|
+
this.baseUrl = config.baseUrl || "https://api.stack0.dev/v1";
|
|
8
|
+
}
|
|
9
|
+
getHeaders(includeContentType = true) {
|
|
10
|
+
const headers = {
|
|
11
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
12
|
+
};
|
|
13
|
+
if (includeContentType) {
|
|
14
|
+
headers["Content-Type"] = "application/json";
|
|
15
|
+
}
|
|
16
|
+
return headers;
|
|
17
|
+
}
|
|
18
|
+
async request(method, path, body) {
|
|
19
|
+
const url = `${this.baseUrl}${path}`;
|
|
20
|
+
const bodyString = body === void 0 ? void 0 : JSON.stringify(body);
|
|
21
|
+
const hasBody = bodyString !== void 0;
|
|
22
|
+
try {
|
|
23
|
+
const response = await fetch(url, {
|
|
24
|
+
method,
|
|
25
|
+
headers: this.getHeaders(hasBody),
|
|
26
|
+
body: hasBody ? bodyString : void 0
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
await this.handleErrorResponse(response);
|
|
30
|
+
}
|
|
31
|
+
const data = await response.json();
|
|
32
|
+
return data;
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (error instanceof Error && "statusCode" in error) {
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
throw this.createError("Network error", error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async handleErrorResponse(response) {
|
|
41
|
+
let errorBody;
|
|
42
|
+
try {
|
|
43
|
+
errorBody = await response.json();
|
|
44
|
+
} catch {
|
|
45
|
+
errorBody = { message: response.statusText };
|
|
46
|
+
}
|
|
47
|
+
const error = new Error(errorBody?.message || `HTTP ${response.status}`);
|
|
48
|
+
error.statusCode = response.status;
|
|
49
|
+
error.code = errorBody?.code ?? "";
|
|
50
|
+
error.response = errorBody;
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
createError(message, cause) {
|
|
54
|
+
const error = new Error(message);
|
|
55
|
+
error.cause = cause;
|
|
56
|
+
return error;
|
|
57
|
+
}
|
|
58
|
+
async get(path) {
|
|
59
|
+
return this.request("GET", path);
|
|
60
|
+
}
|
|
61
|
+
async post(path, body) {
|
|
62
|
+
return this.request("POST", path, body);
|
|
63
|
+
}
|
|
64
|
+
async put(path, body) {
|
|
65
|
+
return this.request("PUT", path, body);
|
|
66
|
+
}
|
|
67
|
+
async delete(path) {
|
|
68
|
+
return this.request("DELETE", path);
|
|
69
|
+
}
|
|
70
|
+
async deleteWithBody(path, body) {
|
|
71
|
+
return this.request("DELETE", path, body);
|
|
72
|
+
}
|
|
73
|
+
async patch(path, body) {
|
|
74
|
+
return this.request("PATCH", path, body);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/documents/client.ts
|
|
79
|
+
var Documents = class {
|
|
80
|
+
http;
|
|
81
|
+
constructor(config) {
|
|
82
|
+
this.http = new HttpClient(config);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Parse a document from a URL or a previously-uploaded file URL.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const { id } = await stack0.documents.parse({
|
|
90
|
+
* url: 'https://example.com/whitepaper.pdf',
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
async parse(request) {
|
|
95
|
+
return this.http.post("/webdata/documents", request);
|
|
96
|
+
}
|
|
97
|
+
async get(request) {
|
|
98
|
+
const params = new URLSearchParams();
|
|
99
|
+
if (request.environment) params.set("environment", request.environment);
|
|
100
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
101
|
+
const q = params.toString();
|
|
102
|
+
return this.http.get(`/webdata/documents/${request.id}${q ? `?${q}` : ""}`);
|
|
103
|
+
}
|
|
104
|
+
async list(request = {}) {
|
|
105
|
+
const params = new URLSearchParams();
|
|
106
|
+
if (request.environment) params.set("environment", request.environment);
|
|
107
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
108
|
+
if (request.status) params.set("status", request.status);
|
|
109
|
+
if (request.limit) params.set("limit", String(request.limit));
|
|
110
|
+
if (request.cursor) params.set("cursor", request.cursor);
|
|
111
|
+
const q = params.toString();
|
|
112
|
+
return this.http.get(`/webdata/documents${q ? `?${q}` : ""}`);
|
|
113
|
+
}
|
|
114
|
+
async delete(request) {
|
|
115
|
+
const params = new URLSearchParams();
|
|
116
|
+
if (request.environment) params.set("environment", request.environment);
|
|
117
|
+
if (request.projectId) params.set("projectId", request.projectId);
|
|
118
|
+
const q = params.toString();
|
|
119
|
+
return this.http.deleteWithBody(
|
|
120
|
+
`/webdata/documents/${request.id}${q ? `?${q}` : ""}`,
|
|
121
|
+
request
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
async parseAndWait(request, options = {}) {
|
|
125
|
+
const { pollInterval = 2e3, timeout = 18e4 } = options;
|
|
126
|
+
const { id } = await this.parse(request);
|
|
127
|
+
const start = Date.now();
|
|
128
|
+
while (Date.now() - start < timeout) {
|
|
129
|
+
const doc = await this.get({ id, environment: request.environment, projectId: request.projectId });
|
|
130
|
+
if (doc.status === "completed" || doc.status === "failed") {
|
|
131
|
+
if (doc.status === "failed") throw new Error(doc.error || "Document parsing failed");
|
|
132
|
+
return doc;
|
|
133
|
+
}
|
|
134
|
+
await new Promise((r) => setTimeout(r, pollInterval));
|
|
135
|
+
}
|
|
136
|
+
throw new Error("Document parsing timed out");
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export { Documents };
|
|
141
|
+
//# sourceMappingURL=index.mjs.map
|
|
142
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/http-client.ts","../../src/documents/client.ts"],"names":[],"mappings":";AAUO,IAAM,aAAN,MAAiB;AAAA,EACd,MAAA;AAAA,EACA,OAAA;AAAA,EAER,YAAY,MAAA,EAA0B;AACpC,IAAA,IAAA,CAAK,SAAS,MAAA,CAAO,MAAA;AACrB,IAAA,IAAA,CAAK,OAAA,GAAU,OAAO,OAAA,IAAW,2BAAA;AAAA,EACnC;AAAA,EAEQ,UAAA,CAAW,qBAAqB,IAAA,EAA8B;AACpE,IAAA,MAAM,OAAA,GAAkC;AAAA,MACtC,aAAA,EAAe,CAAA,OAAA,EAAU,IAAA,CAAK,MAAM,CAAA;AAAA,KACtC;AACA,IAAA,IAAI,kBAAA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,MAAM,EAAE,EAAA,EAAG,GAAI,MAAM,IAAA,CAAK,MAAM,OAAO,CAAA;AACvC,IAAA,MAAM,KAAA,GAAQ,KAAK,GAAA,EAAI;AACvB,IAAA,OAAO,IAAA,CAAK,GAAA,EAAI,GAAI,KAAA,GAAQ,OAAA,EAAS;AACnC,MAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,GAAA,CAAI,EAAE,EAAA,EAAI,WAAA,EAAa,OAAA,CAAQ,WAAA,EAAa,SAAA,EAAW,OAAA,CAAQ,SAAA,EAAW,CAAA;AACjG,MAAA,IAAI,GAAA,CAAI,MAAA,KAAW,WAAA,IAAe,GAAA,CAAI,WAAW,QAAA,EAAU;AACzD,QAAA,IAAI,GAAA,CAAI,WAAW,QAAA,EAAU,MAAM,IAAI,KAAA,CAAM,GAAA,CAAI,SAAS,yBAAyB,CAAA;AACnF,QAAA,OAAO,GAAA;AAAA,MACT;AACA,MAAA,MAAM,IAAI,OAAA,CAAQ,CAAC,MAAM,UAAA,CAAW,CAAA,EAAG,YAAY,CAAC,CAAA;AAAA,IACtD;AACA,IAAA,MAAM,IAAI,MAAM,4BAA4B,CAAA;AAAA,EAC9C;AACF","file":"index.mjs","sourcesContent":["/**\n * HTTP client for Stack0 API\n * Handles authentication, request/response formatting, and error handling\n */\n\nexport interface HttpClientConfig {\n apiKey: string;\n baseUrl?: string;\n}\n\nexport class HttpClient {\n private apiKey: string;\n private baseUrl: string;\n\n constructor(config: HttpClientConfig) {\n this.apiKey = config.apiKey;\n this.baseUrl = config.baseUrl || \"https://api.stack0.dev/v1\";\n }\n\n private getHeaders(includeContentType = true): Record<string, string> {\n const headers: Record<string, string> = {\n Authorization: `Bearer ${this.apiKey}`,\n };\n if (includeContentType) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n return headers;\n }\n\n async request<T>(method: string, path: string, body?: unknown): Promise<T> {\n const url = `${this.baseUrl}${path}`;\n const bodyString = body === undefined ? undefined : JSON.stringify(body);\n const hasBody = bodyString !== undefined;\n\n try {\n const response = await fetch(url, {\n method,\n headers: this.getHeaders(hasBody),\n body: hasBody ? bodyString : undefined,\n });\n\n if (!response.ok) {\n await this.handleErrorResponse(response);\n }\n\n const data = await response.json();\n return data as T;\n } catch (error) {\n if (error instanceof Error && \"statusCode\" in error) {\n throw error; // Re-throw our custom errors\n }\n throw this.createError(\"Network error\", error);\n }\n }\n\n private async handleErrorResponse(response: Response): Promise<never> {\n let errorBody: { message: string } | undefined;\n try {\n errorBody = (await response.json()) as { message: string };\n } catch {\n errorBody = { message: response.statusText };\n }\n\n const error = new Error(errorBody?.message || `HTTP ${response.status}`) as Error & {\n statusCode: number;\n code: string;\n response: unknown;\n };\n error.statusCode = response.status;\n error.code = (errorBody as unknown as { code: string } | undefined)?.code ?? \"\";\n error.response = errorBody;\n throw error;\n }\n\n private createError(message: string, cause?: unknown): Error {\n const error = new Error(message) as Error & { cause: unknown };\n error.cause = cause;\n return error;\n }\n\n async get<T>(path: string): Promise<T> {\n return this.request<T>(\"GET\", path);\n }\n\n async post<T>(path: string, body: unknown): Promise<T> {\n return this.request<T>(\"POST\", path, body);\n }\n\n async put<T>(path: string, body: unknown): Promise<T> {\n return this.request<T>(\"PUT\", path, body);\n }\n\n async delete<T>(path: string): Promise<T> {\n return this.request<T>(\"DELETE\", path);\n }\n\n async deleteWithBody<T>(path: string, body: unknown): Promise<T> {\n return this.request<T>(\"DELETE\", path, body);\n }\n\n async patch<T>(path: string, body: unknown): Promise<T> {\n return this.request<T>(\"PATCH\", path, body);\n }\n}\n","/**\n * Stack0 Documents Client\n * Parse PDF and DOCX documents into clean markdown.\n */\n\nimport { HttpClient, type HttpClientConfig } from \"../lib/http-client\";\nimport type {\n CreateDocumentRequest,\n CreateDocumentResponse,\n GetDocumentRequest,\n ListDocumentsRequest,\n ListDocumentsResponse,\n WebdataDocument,\n} from \"./types\";\n\nexport class Documents {\n private http: HttpClient;\n\n constructor(config: HttpClientConfig) {\n this.http = new HttpClient(config);\n }\n\n /**\n * Parse a document from a URL or a previously-uploaded file URL.\n *\n * @example\n * ```typescript\n * const { id } = await stack0.documents.parse({\n * url: 'https://example.com/whitepaper.pdf',\n * });\n * ```\n */\n async parse(request: CreateDocumentRequest): Promise<CreateDocumentResponse> {\n return this.http.post<CreateDocumentResponse>(\"/webdata/documents\", request);\n }\n\n async get(request: GetDocumentRequest): Promise<WebdataDocument> {\n const params = new URLSearchParams();\n if (request.environment) params.set(\"environment\", request.environment);\n if (request.projectId) params.set(\"projectId\", request.projectId);\n const q = params.toString();\n return this.http.get<WebdataDocument>(`/webdata/documents/${request.id}${q ? `?${q}` : \"\"}`);\n }\n\n async list(request: ListDocumentsRequest = {}): Promise<ListDocumentsResponse> {\n const params = new URLSearchParams();\n if (request.environment) params.set(\"environment\", request.environment);\n if (request.projectId) params.set(\"projectId\", request.projectId);\n if (request.status) params.set(\"status\", request.status);\n if (request.limit) params.set(\"limit\", String(request.limit));\n if (request.cursor) params.set(\"cursor\", request.cursor);\n const q = params.toString();\n return this.http.get<ListDocumentsResponse>(`/webdata/documents${q ? `?${q}` : \"\"}`);\n }\n\n async delete(request: GetDocumentRequest): Promise<{ success: boolean }> {\n const params = new URLSearchParams();\n if (request.environment) params.set(\"environment\", request.environment);\n if (request.projectId) params.set(\"projectId\", request.projectId);\n const q = params.toString();\n return this.http.deleteWithBody<{ success: boolean }>(\n `/webdata/documents/${request.id}${q ? `?${q}` : \"\"}`,\n request,\n );\n }\n\n async parseAndWait(\n request: CreateDocumentRequest,\n options: { pollInterval?: number; timeout?: number } = {},\n ): Promise<WebdataDocument> {\n const { pollInterval = 2000, timeout = 180_000 } = options;\n const { id } = await this.parse(request);\n const start = Date.now();\n while (Date.now() - start < timeout) {\n const doc = await this.get({ id, environment: request.environment, projectId: request.projectId });\n if (doc.status === \"completed\" || doc.status === \"failed\") {\n if (doc.status === \"failed\") throw new Error(doc.error || \"Document parsing failed\");\n return doc;\n }\n await new Promise((r) => setTimeout(r, pollInterval));\n }\n throw new Error(\"Document parsing timed out\");\n }\n}\n"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Mail } from './mail/index.mjs';
|
|
2
|
-
export { AddContactToSequenceRequest, AddContactsToAudienceRequest, AddContactsToAudienceResponse, AddDomainRequest, AddDomainResponse, ArchiveSequenceResponse, Attachment, Audience, AudienceContact, Audiences, BatchTrackEventsRequest, BatchTrackEventsResponse, Campaign, CampaignStatsResponse, CampaignStatus, Campaigns, CancelCampaignResponse, CancelEmailResponse, ConnectionType, ContactStatus, Contacts, CreateAudienceRequest, CreateCampaignRequest, CreateConnectionRequest, CreateContactRequest, CreateEventRequest, CreateNodeRequest, CreateSequenceRequest, CreateTemplateRequest, DeleteAudienceResponse, DeleteCampaignResponse, DeleteConnectionResponse, DeleteContactResponse, DeleteDomainResponse, DeleteEventResponse, DeleteNodeResponse, DeleteSequenceResponse, DeleteTemplateResponse, DnsRecord, Domain, DomainStatus, Domains, Email, EmailAddress, EmailAnalyticsResponse, EmailRecipient, EmailStatus, EventAnalyticsResponse, EventOccurrence, EventPropertiesSchema, EventProperty, Events, GetDnsRecordsResponse, GetEmailResponse, HourlyAnalyticsDataPoint, HourlyAnalyticsResponse, ImportContactsRequest, ImportContactsResponse, ListAudienceContactsRequest, ListAudienceContactsResponse, ListAudiencesRequest, ListAudiencesResponse, ListCampaignsRequest, ListCampaignsResponse, ListContactsRequest, ListContactsResponse, ListDomainsRequest, ListDomainsResponse, ListEmailsRequest, ListEmailsResponse, ListEventOccurrencesRequest, ListEventOccurrencesResponse, ListEventsRequest, ListEventsResponse, ListSendersRequest, ListSendersResponse, ListSequenceEntriesRequest, ListSequenceEntriesResponse, ListSequencesRequest, ListSequencesResponse, ListTemplatesRequest, ListTemplatesResponse, MailContact, MailEvent, PauseCampaignResponse, PauseSequenceResponse, PreviewTemplateRequest, PreviewTemplateResponse, PublishSequenceResponse, RemoveContactFromSequenceRequest, RemoveContactFromSequenceResponse, RemoveContactsFromAudienceRequest, RemoveContactsFromAudienceResponse, ResendEmailResponse, ResumeSequenceResponse, SendBatchEmailRequest, SendBatchEmailResponse, SendBroadcastEmailRequest, SendBroadcastEmailResponse, SendCampaignRequest, SendCampaignResponse, SendEmailRequest, SendEmailResponse, Sender, Sequence, SequenceAnalyticsResponse, SequenceConnection, SequenceEntry, SequenceEntryStatus, SequenceNode, SequenceNodeType, SequenceStatus, SequenceTriggerFrequency, SequenceTriggerType, SequenceWithNodes, Sequences, SetDefaultDomainResponse, SetNodeBranchRequest, SetNodeEmailRequest, SetNodeExperimentRequest, SetNodeFilterRequest, SetNodeTimerRequest, Template, Templates, TimeSeriesAnalyticsRequest, TimeSeriesAnalyticsResponse, TimeSeriesDataPoint, TrackEventRequest, TrackEventResponse, UpdateAudienceRequest, UpdateCampaignRequest, UpdateContactRequest, UpdateEventRequest, UpdateNodePositionRequest, UpdateNodeRequest, UpdateSequenceRequest, UpdateTemplateRequest, VerifyDomainResponse } from './mail/index.mjs';
|
|
1
|
+
import { Mail as Mail$1 } from './mail/index.mjs';
|
|
2
|
+
export { AddContactToSequenceRequest, AddContactsToAudienceRequest, AddContactsToAudienceResponse, AddDomainRequest, AddDomainResponse, ArchiveSequenceResponse, Attachment, Audience, AudienceContact, Audiences, BatchTrackEventsRequest, BatchTrackEventsResponse, Campaign, CampaignStatsResponse, CampaignStatus, Campaigns, CancelCampaignResponse, CancelEmailResponse, ConnectionType, ContactStatus, Contacts, CreateAudienceRequest, CreateCampaignRequest, CreateConnectionRequest, CreateContactRequest, CreateEventRequest, CreateMailboxRequest, CreateNodeRequest, CreateSequenceRequest, CreateTemplateRequest, DeleteAudienceResponse, DeleteCampaignResponse, DeleteConnectionResponse, DeleteContactResponse, DeleteDomainResponse, DeleteEventResponse, DeleteNodeResponse, DeleteSequenceResponse, DeleteTemplateResponse, DnsRecord, Domain, DomainStatus, Domains, Email, EmailAddress, EmailAnalyticsResponse, EmailRecipient, EmailStatus, EventAnalyticsResponse, EventOccurrence, EventPropertiesSchema, EventProperty, Events, GetDnsRecordsResponse, GetEmailResponse, HourlyAnalyticsDataPoint, HourlyAnalyticsResponse, ImportContactsRequest, ImportContactsResponse, InboundAttachment, InboundEmailAddress, InboundMessage, InboundWebhookPayload, ListAudienceContactsRequest, ListAudienceContactsResponse, ListAudiencesRequest, ListAudiencesResponse, ListCampaignsRequest, ListCampaignsResponse, ListContactsRequest, ListContactsResponse, ListDomainsRequest, ListDomainsResponse, ListEmailsRequest, ListEmailsResponse, ListEventOccurrencesRequest, ListEventOccurrencesResponse, ListEventsRequest, ListEventsResponse, ListInboundMessagesRequest, ListInboundMessagesResponse, ListMailboxesRequest, ListMailboxesResponse, ListSendersRequest, ListSendersResponse, ListSequenceEntriesRequest, ListSequenceEntriesResponse, ListSequencesRequest, ListSequencesResponse, ListTemplatesRequest, ListTemplatesResponse, MailContact, MailEvent, Mailbox, Mailboxes, PauseCampaignResponse, PauseSequenceResponse, PreviewTemplateRequest, PreviewTemplateResponse, PublishSequenceResponse, RemoveContactFromSequenceRequest, RemoveContactFromSequenceResponse, RemoveContactsFromAudienceRequest, RemoveContactsFromAudienceResponse, ResendEmailResponse, ResumeSequenceResponse, SendBatchEmailRequest, SendBatchEmailResponse, SendBroadcastEmailRequest, SendBroadcastEmailResponse, SendCampaignRequest, SendCampaignResponse, SendEmailRequest, SendEmailResponse, Sender, Sequence, SequenceAnalyticsResponse, SequenceConnection, SequenceEntry, SequenceEntryStatus, SequenceNode, SequenceNodeType, SequenceStatus, SequenceTriggerFrequency, SequenceTriggerType, SequenceWithNodes, Sequences, SetDefaultDomainResponse, SetNodeBranchRequest, SetNodeEmailRequest, SetNodeExperimentRequest, SetNodeFilterRequest, SetNodeTimerRequest, Template, Templates, TimeSeriesAnalyticsRequest, TimeSeriesAnalyticsResponse, TimeSeriesDataPoint, TrackEventRequest, TrackEventResponse, UpdateAudienceRequest, UpdateCampaignRequest, UpdateContactRequest, UpdateEventRequest, UpdateMailboxRequest, UpdateNodePositionRequest, UpdateNodeRequest, UpdateSequenceRequest, UpdateTemplateRequest, VerifyDomainResponse } from './mail/index.mjs';
|
|
3
3
|
import { CDN } from './cdn/index.mjs';
|
|
4
4
|
export { Asset, AssetStatus, AssetType, AudioTrackInput, BundleDownloadUrlRequest, BundleDownloadUrlResponse, BundleStatus, CancelImportResponse, CancelMergeJobRequest, CdnEnvironment, CdnStorageBreakdownItem, CdnStorageBreakdownRequest, CdnStorageBreakdownResponse, CdnUsageDataPoint, CdnUsageHistoryRequest, CdnUsageHistoryResponse, CdnUsageRequest, CdnUsageResponse, ConfirmUploadRequest, ConfirmUploadResponse, CreateBundleRequest, CreateBundleResponse, CreateFolderRequest, CreateImportRequest, CreateImportResponse, CreateMergeJobRequest, DeleteAssetRequest, DeleteAssetsRequest, DeleteAssetsResponse, DownloadBundle, ExtractAudioRequest, ExtractAudioResponse, Folder, FolderListItem, FolderTreeNode, GenerateGifRequest, GetAssetRequest, GetFolderByPathRequest, GetFolderRequest, GetFolderTreeRequest, GetMergeJobRequest, GifStatus, ImageWatermarkConfig, ImageWatermarkPosition, ImageWatermarkSizingMode, ImportAuthType, ImportError, ImportFile, ImportFileStatus, ImportJob, ImportJobStatus, ImportJobSummary, ImportPathMode, ListAssetsRequest, ListAssetsResponse, ListBundlesRequest, ListBundlesResponse, ListFoldersRequest, ListFoldersResponse, ListGifsRequest, ListImportFilesRequest, ListImportFilesResponse, ListImportsRequest, ListImportsResponse, ListJobsRequest, ListJobsResponse, ListMergeJobsRequest, ListMergeJobsResponse, ListPrivateFilesRequest, ListPrivateFilesResponse, ListThumbnailsRequest, ListThumbnailsResponse, MergeInputItem, MergeJob, MergeJobWithOutput, MergeOutputConfig, MergeOutputFormat, MergeQuality, MergeStatus, MoveAssetsRequest, MoveAssetsResponse, MoveFolderRequest, MoveFolderResponse, MovePrivateFilesRequest, MovePrivateFilesResponse, PrivateDownloadUrlRequest, PrivateDownloadUrlResponse, PrivateFile, PrivateFileStatus, PrivateUploadUrlRequest, PrivateUploadUrlResponse, RegenerateThumbnailRequest, RegenerateThumbnailResponse, RetryImportResponse, StreamingUrls, TextOverlay, TextOverlayShadow, TextOverlayStroke, ThumbnailRequest, ThumbnailResponse, TranscodeJob, TranscodeVideoRequest, TranscodingStatus, TransformOptions, TrimOptions, UpdateAssetRequest, UpdateFolderRequest, UpdatePrivateFileRequest, UploadFromUrlRequest, UploadUrlRequest, UploadUrlResponse, VideoCodec, VideoGif, VideoOutputFormat, VideoQuality, VideoThumbnail, VideoVariant, WatermarkOptions } from './cdn/index.mjs';
|
|
5
5
|
import { Screenshots } from './screenshots/index.mjs';
|
|
@@ -7,6 +7,12 @@ export { BatchScreenshotJob, Clip, CreateBatchScreenshotsRequest, CreateScreensh
|
|
|
7
7
|
import { Extraction } from './extraction/index.mjs';
|
|
8
8
|
export { BatchExtractionJob, CreateBatchExtractionsRequest, CreateExtractionRequest, CreateExtractionResponse, CreateExtractionScheduleRequest, DailyUsageItem, ExtractionBatchJobsResponse, ExtractionMode, ExtractionResult, ExtractionSchedule, ExtractionSchedulesResponse, ExtractionStatus, ExtractionUsage, GetDailyUsageResponse, GetExtractionRequest, GetUsageRequest, ListExtractionsRequest, ListExtractionsResponse, PageMetadata, UpdateExtractionScheduleRequest } from './extraction/index.mjs';
|
|
9
9
|
import { Webdata } from './webdata/index.mjs';
|
|
10
|
+
import { Crawl as Crawl$ } from './crawl/index.mjs';
|
|
11
|
+
export { CancelCrawlRequest, CrawlPage, CrawlStatus, CreateCrawlRequest, CreateCrawlResponse, GetCrawlRequest, ListCrawlPagesRequest, ListCrawlPagesResponse, ListCrawlsRequest, ListCrawlsResponse, ProxyType, ScrapeAction, ScrapeActionType, ScrapeFormat, ScrapeOptions } from './crawl/index.mjs';
|
|
12
|
+
import { Map as Map$ } from './map/index.mjs';
|
|
13
|
+
export { CreateMapRequest, CreateMapResponse, GetMapRequest, ListMapsRequest, ListMapsResponse, MapStatus, WebdataMap } from './map/index.mjs';
|
|
14
|
+
import { Documents } from './documents/index.mjs';
|
|
15
|
+
export { CreateDocumentRequest, CreateDocumentResponse, DocumentStatus, GetDocumentRequest, ListDocumentsRequest, ListDocumentsResponse, WebdataDocument } from './documents/index.mjs';
|
|
10
16
|
import { H as HttpClient, a as HttpClientConfig } from './http-client-Cgie_Rv6.mjs';
|
|
11
17
|
import { E as Environment$1 } from './shared-types-CjKSP5Xc.mjs';
|
|
12
18
|
export { B as BatchJobStatus, C as CreateBatchResponse, e as CreateScheduleResponse, G as GetBatchJobRequest, c as GetScheduleRequest, L as ListBatchJobsRequest, d as ListSchedulesRequest, P as PaginatedRequest, a as PaginatedResponse, b as ScheduleFrequency, S as Stack0Error } from './shared-types-CjKSP5Xc.mjs';
|
|
@@ -27,7 +33,7 @@ interface ListOptions {
|
|
|
27
33
|
sortOrder?: "asc" | "desc";
|
|
28
34
|
filters?: Record<string, unknown>;
|
|
29
35
|
}
|
|
30
|
-
type ConnectorCategory = "crm" | "storage" | "communication" | "productivity";
|
|
36
|
+
type ConnectorCategory = "crm" | "storage" | "communication" | "productivity" | "calendar" | "email";
|
|
31
37
|
interface Connector {
|
|
32
38
|
id: string;
|
|
33
39
|
slug: string;
|
|
@@ -43,7 +49,7 @@ interface Connection {
|
|
|
43
49
|
connectorId: string;
|
|
44
50
|
connectorSlug: string;
|
|
45
51
|
name?: string;
|
|
46
|
-
status: "pending" | "connected" | "error" | "disconnected";
|
|
52
|
+
status: "pending" | "connected" | "error" | "disconnected" | "expired";
|
|
47
53
|
externalAccountId?: string;
|
|
48
54
|
externalAccountName?: string;
|
|
49
55
|
lastSyncedAt?: Date;
|
|
@@ -342,6 +348,129 @@ interface CreateTableRowInput {
|
|
|
342
348
|
cells: Record<string, unknown>;
|
|
343
349
|
}
|
|
344
350
|
type UpdateTableRowInput = CreateTableRowInput;
|
|
351
|
+
interface CalendarAttendee {
|
|
352
|
+
email: string;
|
|
353
|
+
name?: string;
|
|
354
|
+
status?: "accepted" | "declined" | "tentative" | "needsAction";
|
|
355
|
+
organizer?: boolean;
|
|
356
|
+
}
|
|
357
|
+
interface Calendar {
|
|
358
|
+
id: string;
|
|
359
|
+
name: string;
|
|
360
|
+
description?: string;
|
|
361
|
+
isPrimary?: boolean;
|
|
362
|
+
timeZone?: string;
|
|
363
|
+
createdAt?: Date;
|
|
364
|
+
updatedAt?: Date;
|
|
365
|
+
remoteData?: unknown;
|
|
366
|
+
}
|
|
367
|
+
interface CalendarEvent {
|
|
368
|
+
id: string;
|
|
369
|
+
title: string;
|
|
370
|
+
description?: string;
|
|
371
|
+
startTime: Date;
|
|
372
|
+
endTime: Date;
|
|
373
|
+
isAllDay?: boolean;
|
|
374
|
+
location?: string;
|
|
375
|
+
attendees?: CalendarAttendee[];
|
|
376
|
+
organizer?: CalendarAttendee;
|
|
377
|
+
status?: "confirmed" | "tentative" | "cancelled";
|
|
378
|
+
webUrl?: string;
|
|
379
|
+
calendarId?: string;
|
|
380
|
+
recurrence?: string[];
|
|
381
|
+
createdAt?: Date;
|
|
382
|
+
updatedAt?: Date;
|
|
383
|
+
remoteData?: unknown;
|
|
384
|
+
}
|
|
385
|
+
interface CreateCalendarEventInput {
|
|
386
|
+
title: string;
|
|
387
|
+
description?: string;
|
|
388
|
+
startTime: Date;
|
|
389
|
+
endTime: Date;
|
|
390
|
+
isAllDay?: boolean;
|
|
391
|
+
location?: string;
|
|
392
|
+
attendees?: {
|
|
393
|
+
email: string;
|
|
394
|
+
name?: string;
|
|
395
|
+
}[];
|
|
396
|
+
recurrence?: string[];
|
|
397
|
+
}
|
|
398
|
+
type UpdateCalendarEventInput = Partial<CreateCalendarEventInput>;
|
|
399
|
+
interface ListEventsOptions extends ListOptions {
|
|
400
|
+
timeMin?: Date;
|
|
401
|
+
timeMax?: Date;
|
|
402
|
+
query?: string;
|
|
403
|
+
}
|
|
404
|
+
interface EmailAttachment {
|
|
405
|
+
id?: string;
|
|
406
|
+
filename: string;
|
|
407
|
+
mimeType: string;
|
|
408
|
+
size?: number;
|
|
409
|
+
}
|
|
410
|
+
interface EmailMessage {
|
|
411
|
+
id: string;
|
|
412
|
+
threadId?: string;
|
|
413
|
+
subject?: string;
|
|
414
|
+
from?: string;
|
|
415
|
+
to?: string[];
|
|
416
|
+
cc?: string[];
|
|
417
|
+
bcc?: string[];
|
|
418
|
+
body?: string;
|
|
419
|
+
bodyHtml?: string;
|
|
420
|
+
snippet?: string;
|
|
421
|
+
labels?: string[];
|
|
422
|
+
attachments?: EmailAttachment[];
|
|
423
|
+
isRead?: boolean;
|
|
424
|
+
isStarred?: boolean;
|
|
425
|
+
date?: Date;
|
|
426
|
+
createdAt?: Date;
|
|
427
|
+
updatedAt?: Date;
|
|
428
|
+
remoteData?: unknown;
|
|
429
|
+
}
|
|
430
|
+
interface EmailThread {
|
|
431
|
+
id: string;
|
|
432
|
+
subject?: string;
|
|
433
|
+
snippet?: string;
|
|
434
|
+
messageCount?: number;
|
|
435
|
+
messages?: EmailMessage[];
|
|
436
|
+
lastMessageDate?: Date;
|
|
437
|
+
createdAt?: Date;
|
|
438
|
+
updatedAt?: Date;
|
|
439
|
+
remoteData?: unknown;
|
|
440
|
+
}
|
|
441
|
+
interface EmailLabel {
|
|
442
|
+
id: string;
|
|
443
|
+
name: string;
|
|
444
|
+
type?: "system" | "user";
|
|
445
|
+
messagesTotal?: number;
|
|
446
|
+
messagesUnread?: number;
|
|
447
|
+
}
|
|
448
|
+
interface SendEmailInput {
|
|
449
|
+
to: string[];
|
|
450
|
+
cc?: string[];
|
|
451
|
+
bcc?: string[];
|
|
452
|
+
subject: string;
|
|
453
|
+
body: string;
|
|
454
|
+
bodyHtml?: string;
|
|
455
|
+
replyToMessageId?: string;
|
|
456
|
+
}
|
|
457
|
+
interface ListEmailMessagesOptions extends ListOptions {
|
|
458
|
+
query?: string;
|
|
459
|
+
labelIds?: string[];
|
|
460
|
+
}
|
|
461
|
+
interface CreateConnectionSessionRequest {
|
|
462
|
+
endUserId: string;
|
|
463
|
+
connectorSlug: string;
|
|
464
|
+
redirectUrl: string;
|
|
465
|
+
projectId?: string;
|
|
466
|
+
environment?: IntegrationEnvironment;
|
|
467
|
+
name?: string;
|
|
468
|
+
}
|
|
469
|
+
interface CreateConnectionSessionResponse {
|
|
470
|
+
authUrl: string;
|
|
471
|
+
sessionId: string;
|
|
472
|
+
state: string;
|
|
473
|
+
}
|
|
345
474
|
interface PassthroughRequest {
|
|
346
475
|
connectionId: string;
|
|
347
476
|
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
@@ -357,6 +486,7 @@ interface InitiateOAuthRequest {
|
|
|
357
486
|
environment?: IntegrationEnvironment;
|
|
358
487
|
name?: string;
|
|
359
488
|
redirectUrl: string;
|
|
489
|
+
endUserId?: string;
|
|
360
490
|
}
|
|
361
491
|
interface InitiateOAuthResponse {
|
|
362
492
|
authUrl: string;
|
|
@@ -467,6 +597,7 @@ interface ListConnectionsRequest {
|
|
|
467
597
|
environment?: IntegrationEnvironment;
|
|
468
598
|
connectorSlug?: string;
|
|
469
599
|
status?: Connection["status"];
|
|
600
|
+
endUserId?: string;
|
|
470
601
|
limit?: number;
|
|
471
602
|
}
|
|
472
603
|
interface ListConnectionsResponse {
|
|
@@ -564,6 +695,34 @@ declare class Productivity {
|
|
|
564
695
|
success: boolean;
|
|
565
696
|
}>;
|
|
566
697
|
}
|
|
698
|
+
/**
|
|
699
|
+
* Calendar operations client
|
|
700
|
+
*/
|
|
701
|
+
declare class CalendarClient {
|
|
702
|
+
private http;
|
|
703
|
+
constructor(http: HttpClient);
|
|
704
|
+
listCalendars(connectionId: string, options?: ListOptions): Promise<PaginatedResult<Calendar>>;
|
|
705
|
+
listEvents(connectionId: string, calendarId: string, options?: ListEventsOptions): Promise<PaginatedResult<CalendarEvent>>;
|
|
706
|
+
getEvent(connectionId: string, calendarId: string, eventId: string): Promise<CalendarEvent>;
|
|
707
|
+
createEvent(connectionId: string, calendarId: string, data: CreateCalendarEventInput): Promise<CalendarEvent>;
|
|
708
|
+
updateEvent(connectionId: string, calendarId: string, eventId: string, data: UpdateCalendarEventInput): Promise<CalendarEvent>;
|
|
709
|
+
deleteEvent(connectionId: string, calendarId: string, eventId: string): Promise<{
|
|
710
|
+
success: boolean;
|
|
711
|
+
}>;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Mail (Email) operations client
|
|
715
|
+
*/
|
|
716
|
+
declare class Mail {
|
|
717
|
+
private http;
|
|
718
|
+
constructor(http: HttpClient);
|
|
719
|
+
listMessages(connectionId: string, options?: ListEmailMessagesOptions): Promise<PaginatedResult<EmailMessage>>;
|
|
720
|
+
getMessage(connectionId: string, messageId: string): Promise<EmailMessage>;
|
|
721
|
+
sendMessage(connectionId: string, data: SendEmailInput): Promise<EmailMessage>;
|
|
722
|
+
listThreads(connectionId: string, options?: ListEmailMessagesOptions): Promise<PaginatedResult<EmailThread>>;
|
|
723
|
+
getThread(connectionId: string, threadId: string): Promise<EmailThread>;
|
|
724
|
+
listLabels(connectionId: string): Promise<EmailLabel[]>;
|
|
725
|
+
}
|
|
567
726
|
/**
|
|
568
727
|
* Stack0 Integrations SDK Client
|
|
569
728
|
*
|
|
@@ -606,6 +765,8 @@ declare class Integrations {
|
|
|
606
765
|
storage: Storage;
|
|
607
766
|
communication: Communication;
|
|
608
767
|
productivity: Productivity;
|
|
768
|
+
calendar: CalendarClient;
|
|
769
|
+
mail: Mail;
|
|
609
770
|
constructor(config: HttpClientConfig);
|
|
610
771
|
/**
|
|
611
772
|
* List all available connectors
|
|
@@ -645,6 +806,20 @@ declare class Integrations {
|
|
|
645
806
|
* ```
|
|
646
807
|
*/
|
|
647
808
|
initiateOAuth(request: InitiateOAuthRequest): Promise<InitiateOAuthResponse>;
|
|
809
|
+
/**
|
|
810
|
+
* Create a connection session for an end user
|
|
811
|
+
*
|
|
812
|
+
* @example
|
|
813
|
+
* ```typescript
|
|
814
|
+
* const { authUrl, sessionId } = await integrations.createConnectionSession({
|
|
815
|
+
* endUserId: 'user_123',
|
|
816
|
+
* connectorSlug: 'google-calendar',
|
|
817
|
+
* redirectUrl: 'https://yourapp.com/oauth/callback',
|
|
818
|
+
* });
|
|
819
|
+
* // Redirect user to authUrl
|
|
820
|
+
* ```
|
|
821
|
+
*/
|
|
822
|
+
createConnectionSession(request: CreateConnectionSessionRequest): Promise<CreateConnectionSessionResponse>;
|
|
648
823
|
/**
|
|
649
824
|
* Complete OAuth flow with callback data
|
|
650
825
|
*
|
|
@@ -2476,6 +2651,26 @@ declare class Memory {
|
|
|
2476
2651
|
* ```
|
|
2477
2652
|
*/
|
|
2478
2653
|
|
|
2654
|
+
interface Project {
|
|
2655
|
+
id: string;
|
|
2656
|
+
name: string;
|
|
2657
|
+
slug: string;
|
|
2658
|
+
description?: string | null;
|
|
2659
|
+
iconUrl?: string | null;
|
|
2660
|
+
organizationId: string;
|
|
2661
|
+
createdAt: Date | string;
|
|
2662
|
+
updatedAt?: Date | string | null;
|
|
2663
|
+
}
|
|
2664
|
+
interface CreateProjectRequest {
|
|
2665
|
+
name: string;
|
|
2666
|
+
description?: string;
|
|
2667
|
+
}
|
|
2668
|
+
interface UpdateProjectRequest {
|
|
2669
|
+
id: string;
|
|
2670
|
+
name?: string;
|
|
2671
|
+
description?: string;
|
|
2672
|
+
iconUrl?: string | null;
|
|
2673
|
+
}
|
|
2479
2674
|
interface Stack0Config extends HttpClientConfig {
|
|
2480
2675
|
apiKey: string;
|
|
2481
2676
|
baseUrl?: string;
|
|
@@ -2490,10 +2685,14 @@ interface Stack0Config extends HttpClientConfig {
|
|
|
2490
2685
|
* Provides access to all Stack0 services
|
|
2491
2686
|
*/
|
|
2492
2687
|
declare class Stack0 {
|
|
2493
|
-
|
|
2688
|
+
private http;
|
|
2689
|
+
mail: Mail$1;
|
|
2494
2690
|
cdn: CDN;
|
|
2495
2691
|
screenshots: Screenshots;
|
|
2496
2692
|
extraction: Extraction;
|
|
2693
|
+
crawl: Crawl$;
|
|
2694
|
+
map: Map$;
|
|
2695
|
+
documents: Documents;
|
|
2497
2696
|
integrations: Integrations;
|
|
2498
2697
|
marketing: Marketing;
|
|
2499
2698
|
workflows: Workflows;
|
|
@@ -2503,6 +2702,14 @@ declare class Stack0 {
|
|
|
2503
2702
|
*/
|
|
2504
2703
|
webdata: Webdata;
|
|
2505
2704
|
constructor(config: Stack0Config);
|
|
2705
|
+
listProjects(): Promise<Project[]>;
|
|
2706
|
+
getProject(id: string): Promise<Project>;
|
|
2707
|
+
getProjectBySlug(slug: string): Promise<Project>;
|
|
2708
|
+
createProject(request: CreateProjectRequest): Promise<Project>;
|
|
2709
|
+
updateProject(request: UpdateProjectRequest): Promise<Project>;
|
|
2710
|
+
deleteProject(id: string): Promise<{
|
|
2711
|
+
success: boolean;
|
|
2712
|
+
}>;
|
|
2506
2713
|
}
|
|
2507
2714
|
|
|
2508
|
-
export { type Agent, type AgentSettings, type AnalyticsOverviewRequest, type AnalyticsOverviewResponse, type ApprovalStatus, type ApproveContentRequest, type AssetJob, type AssetJobStatus, type AssetJobType, CDN, type CalendarEntry, type CancelAssetJobResponse, type CancelCalendarEntryResponse, type CancelRunRequest, type Channel, type CollectionResponse, type CollectionStats, type CommunicationUser, type CompactRequest, type CompactionJob, type Company, type Connection, type Connector, type ConnectorCategory, type Contact, type Content, type ContentPerformanceItem, type ContentPerformanceRequest, type ContentPerformanceResponse, type ContentStatus, type ContentType, type CreateAgentRequest, type CreateAssetJobRequest, type CreateCollectionRequest, type CreateCompanyInput, type CreateContactInput, type CreateContentRequest, type CreateDealInput, type CreateScriptRequest, type CreateScriptVersionRequest, type CreateWorkflowRequest, type CreateWorkflowResponse, type CurrentUsageResponse, type Deal, type DeleteManyRequest, type DeleteScriptResponse, type DeleteWorkflowRequest, type DiscoverTrendsRequest, type DiscoverTrendsResponse, type DismissOpportunityRequest, type Entity, type EntityRelation, type EntityType, type Environment, Extraction, type GenerateOpportunitiesRequest, type GenerateOpportunitiesResponse, type GetCurrentUsageRequest, type GetEntityParams, type GetRunRequest, type GetSettingsRequest, type GetTotalUsageRequest, type GetUsageHistoryRequest, type GetWorkflowRequest, type Address as IntegrationAddress, type ColumnType as IntegrationColumnType, type CreateDocumentInput as IntegrationCreateDocumentInput, type CreateFolderInput as IntegrationCreateFolderInput, type CreateTableRowInput as IntegrationCreateTableRowInput, type Document as IntegrationDocument, type IntegrationEmailAddress, type File as IntegrationFile, type FilePermission as IntegrationFilePermission, type IntegrationFolder, type MessageAttachment as IntegrationMessageAttachment, type MessageReaction as IntegrationMessageReaction, type PhoneNumber as IntegrationPhoneNumber, type SelectOption as IntegrationSelectOption, type Table as IntegrationTable, type TableColumn as IntegrationTableColumn, type TableRow as IntegrationTableRow, type UpdateDocumentInput as IntegrationUpdateDocumentInput, type UpdateTableRowInput as IntegrationUpdateTableRowInput, Integrations, type ListOptions as IntegrationsListOptions, type PaginatedResult as IntegrationsPaginatedResult, type ListAgentsParams, type ListAssetJobsRequest, type ListAssetJobsResponse, type ListCalendarEntriesRequest, type ListCalendarEntriesResponse, type ListContentRequest, type ListContentResponse, type ListEntitiesParams, type ListEntitiesResult, type ListMemoriesParams, type ListOpportunitiesRequest, type ListOpportunitiesResponse, type ListRunsRequest, type ListRunsResponse, type ListScriptsRequest, type ListScriptsResponse, type ListTrendsRequest, type ListTrendsResponse, type ListWorkflowsRequest, type ListWorkflowsResponse, Mail, type MarkPublishedRequest, Marketing, type MarketingEnvironment, type MarketingSettings, type MarketingUsage, Memory, MemoryAgents, MemoryCollections, MemoryEntities, type MemoryResponse, type MemoryType, type Message, type Opportunity, type OpportunityConversionRequest, type OpportunityConversionResponse, type PassthroughRequest, type Provider, type RecallRequest, type RecallResult, type RecordUsageRequest, type RejectContentRequest, type ResponseFormat, type RetryAssetJobResponse, type RetryConfig, type RunStatus, type RunWorkflowRequest, type RunWorkflowResponse, type ScheduleContentRequest, Screenshots, type Script, type ScriptSlide, type SearchRequest, type SearchResult, type SendMessageInput, Stack0, type Stack0Config, type StepConfig, type StepDefinition, type StepRunStatus, type StepState, type StepType, type StoreBatchRequest, type StoreMemoryRequest, type TotalUsageResponse, type Trend, type TrendAnalyticsRequest, type TrendAnalyticsResponse, type TrendStatus, type UpdateAgentRequest, type UpdateAssetJobStatusRequest, type UpdateCalendarEntryRequest, type UpdateCollectionRequest, type UpdateCompanyInput, type UpdateContactInput, type UpdateContentRequest, type UpdateDealInput, type UpdateMemoryRequest, type UpdateScriptRequest, type UpdateSettingsRequest, type UpdateSettingsResponse, type UpdateTrendStatusRequest, type UpdateTrendStatusResponse, type UpdateWorkflowRequest, type UploadFileInput, type UsageHistoryResponse, type VariableDefinition, Webdata, type WebhookConfig, type Workflow, type WorkflowRun, Workflows, Stack0 as default };
|
|
2715
|
+
export { type Agent, type AgentSettings, type AnalyticsOverviewRequest, type AnalyticsOverviewResponse, type ApprovalStatus, type ApproveContentRequest, type AssetJob, type AssetJobStatus, type AssetJobType, CDN, type Calendar, type CalendarAttendee, type CalendarEntry, type CalendarEvent, type CancelAssetJobResponse, type CancelCalendarEntryResponse, type CancelRunRequest, type Channel, type CollectionResponse, type CollectionStats, type CommunicationUser, type CompactRequest, type CompactionJob, type Company, type Connection, type Connector, type ConnectorCategory, type Contact, type Content, type ContentPerformanceItem, type ContentPerformanceRequest, type ContentPerformanceResponse, type ContentStatus, type ContentType, Crawl$ as Crawl, Crawl$, type CreateAgentRequest, type CreateAssetJobRequest, type CreateCalendarEventInput, type CreateCollectionRequest, type CreateCompanyInput, type CreateConnectionSessionRequest, type CreateConnectionSessionResponse, type CreateContactInput, type CreateContentRequest, type CreateDealInput, type CreateProjectRequest, type CreateScriptRequest, type CreateScriptVersionRequest, type CreateWorkflowRequest, type CreateWorkflowResponse, type CurrentUsageResponse, type Deal, type DeleteManyRequest, type DeleteScriptResponse, type DeleteWorkflowRequest, type DiscoverTrendsRequest, type DiscoverTrendsResponse, type DismissOpportunityRequest, Documents, type EmailAttachment, type EmailLabel, type EmailMessage, type EmailThread, type Entity, type EntityRelation, type EntityType, type Environment, Extraction, type GenerateOpportunitiesRequest, type GenerateOpportunitiesResponse, type GetCurrentUsageRequest, type GetEntityParams, type GetRunRequest, type GetSettingsRequest, type GetTotalUsageRequest, type GetUsageHistoryRequest, type GetWorkflowRequest, type Address as IntegrationAddress, type ColumnType as IntegrationColumnType, type CreateDocumentInput as IntegrationCreateDocumentInput, type CreateFolderInput as IntegrationCreateFolderInput, type CreateTableRowInput as IntegrationCreateTableRowInput, type Document as IntegrationDocument, type IntegrationEmailAddress, type File as IntegrationFile, type FilePermission as IntegrationFilePermission, type IntegrationFolder, type MessageAttachment as IntegrationMessageAttachment, type MessageReaction as IntegrationMessageReaction, type PhoneNumber as IntegrationPhoneNumber, type SelectOption as IntegrationSelectOption, type SendEmailInput as IntegrationSendEmailInput, type Table as IntegrationTable, type TableColumn as IntegrationTableColumn, type TableRow as IntegrationTableRow, type UpdateDocumentInput as IntegrationUpdateDocumentInput, type UpdateTableRowInput as IntegrationUpdateTableRowInput, Integrations, type ListOptions as IntegrationsListOptions, type PaginatedResult as IntegrationsPaginatedResult, type ListAgentsParams, type ListAssetJobsRequest, type ListAssetJobsResponse, type ListCalendarEntriesRequest, type ListCalendarEntriesResponse, type ListContentRequest, type ListContentResponse, type ListEmailMessagesOptions, type ListEntitiesParams, type ListEntitiesResult, type ListEventsOptions, type ListMemoriesParams, type ListOpportunitiesRequest, type ListOpportunitiesResponse, type ListRunsRequest, type ListRunsResponse, type ListScriptsRequest, type ListScriptsResponse, type ListTrendsRequest, type ListTrendsResponse, type ListWorkflowsRequest, type ListWorkflowsResponse, Mail$1 as Mail, Map$ as Map, Map$, type MarkPublishedRequest, Marketing, type MarketingEnvironment, type MarketingSettings, type MarketingUsage, Memory, MemoryAgents, MemoryCollections, MemoryEntities, type MemoryResponse, type MemoryType, type Message, type Opportunity, type OpportunityConversionRequest, type OpportunityConversionResponse, type PassthroughRequest, type Project, type Provider, type RecallRequest, type RecallResult, type RecordUsageRequest, type RejectContentRequest, type ResponseFormat, type RetryAssetJobResponse, type RetryConfig, type RunStatus, type RunWorkflowRequest, type RunWorkflowResponse, type ScheduleContentRequest, Screenshots, type Script, type ScriptSlide, type SearchRequest, type SearchResult, type SendMessageInput, Stack0, type Stack0Config, type StepConfig, type StepDefinition, type StepRunStatus, type StepState, type StepType, type StoreBatchRequest, type StoreMemoryRequest, type TotalUsageResponse, type Trend, type TrendAnalyticsRequest, type TrendAnalyticsResponse, type TrendStatus, type UpdateAgentRequest, type UpdateAssetJobStatusRequest, type UpdateCalendarEntryRequest, type UpdateCalendarEventInput, type UpdateCollectionRequest, type UpdateCompanyInput, type UpdateContactInput, type UpdateContentRequest, type UpdateDealInput, type UpdateMemoryRequest, type UpdateProjectRequest, type UpdateScriptRequest, type UpdateSettingsRequest, type UpdateSettingsResponse, type UpdateTrendStatusRequest, type UpdateTrendStatusResponse, type UpdateWorkflowRequest, type UploadFileInput, type UsageHistoryResponse, type VariableDefinition, Webdata, type WebhookConfig, type Workflow, type WorkflowRun, Workflows, Stack0 as default };
|