@stack0/sdk 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +200 -0
- package/dist/cdn/index.d.mts +185 -2
- package/dist/cdn/index.d.ts +185 -2
- package/dist/cdn/index.js +138 -0
- package/dist/cdn/index.js.map +1 -1
- package/dist/cdn/index.mjs +138 -0
- package/dist/cdn/index.mjs.map +1 -1
- package/dist/extraction/index.d.mts +1 -1
- package/dist/extraction/index.d.ts +1 -1
- package/dist/http-client-DjrRWvXA.d.mts +24 -0
- package/dist/http-client-DjrRWvXA.d.ts +24 -0
- package/dist/index.d.mts +534 -3
- package/dist/index.d.ts +534 -3
- package/dist/index.js +449 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +449 -1
- package/dist/index.mjs.map +1 -1
- package/dist/mail/index.d.mts +1 -1
- package/dist/mail/index.d.ts +1 -1
- package/dist/screenshots/index.d.mts +1 -1
- package/dist/screenshots/index.d.ts +1 -1
- package/dist/webdata/index.d.mts +1 -1
- package/dist/webdata/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/http-client-Wr9lXo9_.d.mts +0 -10
- package/dist/http-client-Wr9lXo9_.d.ts +0 -10
package/dist/index.js
CHANGED
|
@@ -385,6 +385,144 @@ var CDN = class {
|
|
|
385
385
|
}
|
|
386
386
|
return folder;
|
|
387
387
|
}
|
|
388
|
+
// ============================================================================
|
|
389
|
+
// Video Transcoding Methods
|
|
390
|
+
// ============================================================================
|
|
391
|
+
/**
|
|
392
|
+
* Start a video transcoding job
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```typescript
|
|
396
|
+
* const job = await cdn.transcode({
|
|
397
|
+
* projectSlug: 'my-project',
|
|
398
|
+
* assetId: 'video-asset-id',
|
|
399
|
+
* outputFormat: 'hls',
|
|
400
|
+
* variants: [
|
|
401
|
+
* { quality: '720p', codec: 'h264' },
|
|
402
|
+
* { quality: '1080p', codec: 'h264' },
|
|
403
|
+
* ],
|
|
404
|
+
* webhookUrl: 'https://your-app.com/webhook',
|
|
405
|
+
* });
|
|
406
|
+
* console.log(`Job started: ${job.id}`);
|
|
407
|
+
* ```
|
|
408
|
+
*/
|
|
409
|
+
async transcode(request) {
|
|
410
|
+
const response = await this.http.post("/cdn/video/transcode", request);
|
|
411
|
+
return this.convertJobDates(response);
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Get a transcoding job by ID
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* const job = await cdn.getJob('job-id');
|
|
419
|
+
* console.log(`Status: ${job.status}, Progress: ${job.progress}%`);
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
async getJob(jobId) {
|
|
423
|
+
const response = await this.http.get(`/cdn/video/jobs/${jobId}`);
|
|
424
|
+
return this.convertJobDates(response);
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* List transcoding jobs with filters
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```typescript
|
|
431
|
+
* const { jobs, total } = await cdn.listJobs({
|
|
432
|
+
* projectSlug: 'my-project',
|
|
433
|
+
* status: 'processing',
|
|
434
|
+
* limit: 20,
|
|
435
|
+
* });
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
async listJobs(request) {
|
|
439
|
+
const params = new URLSearchParams();
|
|
440
|
+
params.set("projectSlug", request.projectSlug);
|
|
441
|
+
if (request.assetId) params.set("assetId", request.assetId);
|
|
442
|
+
if (request.status) params.set("status", request.status);
|
|
443
|
+
if (request.limit) params.set("limit", request.limit.toString());
|
|
444
|
+
if (request.offset) params.set("offset", request.offset.toString());
|
|
445
|
+
const response = await this.http.get(`/cdn/video/jobs?${params.toString()}`);
|
|
446
|
+
return {
|
|
447
|
+
...response,
|
|
448
|
+
jobs: response.jobs.map((job) => this.convertJobDates(job))
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Cancel a pending or processing transcoding job
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```typescript
|
|
456
|
+
* await cdn.cancelJob('job-id');
|
|
457
|
+
* ```
|
|
458
|
+
*/
|
|
459
|
+
async cancelJob(jobId) {
|
|
460
|
+
return this.http.post(`/cdn/video/jobs/${jobId}/cancel`, {});
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Get streaming URLs for a transcoded video
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* ```typescript
|
|
467
|
+
* const urls = await cdn.getStreamingUrls('asset-id');
|
|
468
|
+
* console.log(`HLS URL: ${urls.hlsUrl}`);
|
|
469
|
+
* console.log(`MP4 720p: ${urls.mp4Urls.find(u => u.quality === '720p')?.url}`);
|
|
470
|
+
* ```
|
|
471
|
+
*/
|
|
472
|
+
async getStreamingUrls(assetId) {
|
|
473
|
+
return this.http.get(`/cdn/video/stream/${assetId}`);
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Generate a thumbnail from a video at a specific timestamp
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```typescript
|
|
480
|
+
* const thumbnail = await cdn.getThumbnail({
|
|
481
|
+
* assetId: 'video-asset-id',
|
|
482
|
+
* timestamp: 10.5, // 10.5 seconds into the video
|
|
483
|
+
* width: 320,
|
|
484
|
+
* format: 'webp',
|
|
485
|
+
* });
|
|
486
|
+
* console.log(`Thumbnail URL: ${thumbnail.url}`);
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
async getThumbnail(request) {
|
|
490
|
+
const params = new URLSearchParams();
|
|
491
|
+
params.set("timestamp", request.timestamp.toString());
|
|
492
|
+
if (request.width) params.set("width", request.width.toString());
|
|
493
|
+
if (request.format) params.set("format", request.format);
|
|
494
|
+
return this.http.get(
|
|
495
|
+
`/cdn/video/thumbnail/${request.assetId}?${params.toString()}`
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Extract audio from a video file
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```typescript
|
|
503
|
+
* const { jobId } = await cdn.extractAudio({
|
|
504
|
+
* projectSlug: 'my-project',
|
|
505
|
+
* assetId: 'video-asset-id',
|
|
506
|
+
* format: 'mp3',
|
|
507
|
+
* bitrate: 192,
|
|
508
|
+
* });
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
async extractAudio(request) {
|
|
512
|
+
return this.http.post("/cdn/video/extract-audio", request);
|
|
513
|
+
}
|
|
514
|
+
convertJobDates(job) {
|
|
515
|
+
if (typeof job.createdAt === "string") {
|
|
516
|
+
job.createdAt = new Date(job.createdAt);
|
|
517
|
+
}
|
|
518
|
+
if (job.startedAt && typeof job.startedAt === "string") {
|
|
519
|
+
job.startedAt = new Date(job.startedAt);
|
|
520
|
+
}
|
|
521
|
+
if (job.completedAt && typeof job.completedAt === "string") {
|
|
522
|
+
job.completedAt = new Date(job.completedAt);
|
|
523
|
+
}
|
|
524
|
+
return job;
|
|
525
|
+
}
|
|
388
526
|
};
|
|
389
527
|
|
|
390
528
|
// src/screenshots/client.ts
|
|
@@ -1717,12 +1855,321 @@ var Webdata = class {
|
|
|
1717
1855
|
}
|
|
1718
1856
|
};
|
|
1719
1857
|
|
|
1858
|
+
// src/integrations/client.ts
|
|
1859
|
+
var CRM = class {
|
|
1860
|
+
http;
|
|
1861
|
+
constructor(http) {
|
|
1862
|
+
this.http = http;
|
|
1863
|
+
}
|
|
1864
|
+
// Contacts
|
|
1865
|
+
async listContacts(connectionId, options) {
|
|
1866
|
+
const params = new URLSearchParams({ connectionId });
|
|
1867
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
1868
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
1869
|
+
if (options?.sortBy) params.set("sortBy", options.sortBy);
|
|
1870
|
+
if (options?.sortOrder) params.set("sortOrder", options.sortOrder);
|
|
1871
|
+
return this.http.get(`/integrations/crm/contacts?${params}`);
|
|
1872
|
+
}
|
|
1873
|
+
async getContact(connectionId, id) {
|
|
1874
|
+
return this.http.get(`/integrations/crm/contacts/${id}?connectionId=${connectionId}`);
|
|
1875
|
+
}
|
|
1876
|
+
async createContact(connectionId, data) {
|
|
1877
|
+
return this.http.post("/integrations/crm/contacts", { connectionId, data });
|
|
1878
|
+
}
|
|
1879
|
+
async updateContact(connectionId, id, data) {
|
|
1880
|
+
return this.http.patch(`/integrations/crm/contacts/${id}`, { connectionId, data });
|
|
1881
|
+
}
|
|
1882
|
+
async deleteContact(connectionId, id) {
|
|
1883
|
+
return this.http.delete(`/integrations/crm/contacts/${id}?connectionId=${connectionId}`);
|
|
1884
|
+
}
|
|
1885
|
+
// Companies
|
|
1886
|
+
async listCompanies(connectionId, options) {
|
|
1887
|
+
const params = new URLSearchParams({ connectionId });
|
|
1888
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
1889
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
1890
|
+
if (options?.sortBy) params.set("sortBy", options.sortBy);
|
|
1891
|
+
if (options?.sortOrder) params.set("sortOrder", options.sortOrder);
|
|
1892
|
+
return this.http.get(`/integrations/crm/companies?${params}`);
|
|
1893
|
+
}
|
|
1894
|
+
async getCompany(connectionId, id) {
|
|
1895
|
+
return this.http.get(`/integrations/crm/companies/${id}?connectionId=${connectionId}`);
|
|
1896
|
+
}
|
|
1897
|
+
async createCompany(connectionId, data) {
|
|
1898
|
+
return this.http.post("/integrations/crm/companies", { connectionId, data });
|
|
1899
|
+
}
|
|
1900
|
+
async updateCompany(connectionId, id, data) {
|
|
1901
|
+
return this.http.patch(`/integrations/crm/companies/${id}`, { connectionId, data });
|
|
1902
|
+
}
|
|
1903
|
+
async deleteCompany(connectionId, id) {
|
|
1904
|
+
return this.http.delete(`/integrations/crm/companies/${id}?connectionId=${connectionId}`);
|
|
1905
|
+
}
|
|
1906
|
+
// Deals
|
|
1907
|
+
async listDeals(connectionId, options) {
|
|
1908
|
+
const params = new URLSearchParams({ connectionId });
|
|
1909
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
1910
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
1911
|
+
if (options?.sortBy) params.set("sortBy", options.sortBy);
|
|
1912
|
+
if (options?.sortOrder) params.set("sortOrder", options.sortOrder);
|
|
1913
|
+
return this.http.get(`/integrations/crm/deals?${params}`);
|
|
1914
|
+
}
|
|
1915
|
+
async getDeal(connectionId, id) {
|
|
1916
|
+
return this.http.get(`/integrations/crm/deals/${id}?connectionId=${connectionId}`);
|
|
1917
|
+
}
|
|
1918
|
+
async createDeal(connectionId, data) {
|
|
1919
|
+
return this.http.post("/integrations/crm/deals", { connectionId, data });
|
|
1920
|
+
}
|
|
1921
|
+
async updateDeal(connectionId, id, data) {
|
|
1922
|
+
return this.http.patch(`/integrations/crm/deals/${id}`, { connectionId, data });
|
|
1923
|
+
}
|
|
1924
|
+
async deleteDeal(connectionId, id) {
|
|
1925
|
+
return this.http.delete(`/integrations/crm/deals/${id}?connectionId=${connectionId}`);
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
var Storage = class {
|
|
1929
|
+
http;
|
|
1930
|
+
constructor(http) {
|
|
1931
|
+
this.http = http;
|
|
1932
|
+
}
|
|
1933
|
+
// Files
|
|
1934
|
+
async listFiles(connectionId, folderId, options) {
|
|
1935
|
+
const params = new URLSearchParams({ connectionId });
|
|
1936
|
+
if (folderId) params.set("folderId", folderId);
|
|
1937
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
1938
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
1939
|
+
return this.http.get(`/integrations/storage/files?${params}`);
|
|
1940
|
+
}
|
|
1941
|
+
async getFile(connectionId, id) {
|
|
1942
|
+
return this.http.get(`/integrations/storage/files/${id}?connectionId=${connectionId}`);
|
|
1943
|
+
}
|
|
1944
|
+
async uploadFile(connectionId, input) {
|
|
1945
|
+
const base64Data = input.data instanceof ArrayBuffer ? btoa(String.fromCharCode(...new Uint8Array(input.data))) : btoa(String.fromCharCode(...input.data));
|
|
1946
|
+
return this.http.post("/integrations/storage/files", {
|
|
1947
|
+
connectionId,
|
|
1948
|
+
name: input.name,
|
|
1949
|
+
mimeType: input.mimeType,
|
|
1950
|
+
data: base64Data,
|
|
1951
|
+
folderId: input.folderId
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
async deleteFile(connectionId, id) {
|
|
1955
|
+
return this.http.delete(`/integrations/storage/files/${id}?connectionId=${connectionId}`);
|
|
1956
|
+
}
|
|
1957
|
+
async downloadFile(connectionId, id) {
|
|
1958
|
+
const response = await this.http.get(
|
|
1959
|
+
`/integrations/storage/files/${id}/download?connectionId=${connectionId}`
|
|
1960
|
+
);
|
|
1961
|
+
const binaryString = atob(response.data);
|
|
1962
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
1963
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
1964
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
1965
|
+
}
|
|
1966
|
+
return {
|
|
1967
|
+
data: bytes.buffer,
|
|
1968
|
+
mimeType: response.mimeType,
|
|
1969
|
+
filename: response.filename
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
// Folders
|
|
1973
|
+
async listFolders(connectionId, parentId, options) {
|
|
1974
|
+
const params = new URLSearchParams({ connectionId });
|
|
1975
|
+
if (parentId) params.set("parentId", parentId);
|
|
1976
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
1977
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
1978
|
+
return this.http.get(`/integrations/storage/folders?${params}`);
|
|
1979
|
+
}
|
|
1980
|
+
async getFolder(connectionId, id) {
|
|
1981
|
+
return this.http.get(`/integrations/storage/folders/${id}?connectionId=${connectionId}`);
|
|
1982
|
+
}
|
|
1983
|
+
async createFolder(connectionId, data) {
|
|
1984
|
+
return this.http.post("/integrations/storage/folders", { connectionId, ...data });
|
|
1985
|
+
}
|
|
1986
|
+
async deleteFolder(connectionId, id) {
|
|
1987
|
+
return this.http.delete(`/integrations/storage/folders/${id}?connectionId=${connectionId}`);
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
var Communication = class {
|
|
1991
|
+
http;
|
|
1992
|
+
constructor(http) {
|
|
1993
|
+
this.http = http;
|
|
1994
|
+
}
|
|
1995
|
+
// Channels
|
|
1996
|
+
async listChannels(connectionId, options) {
|
|
1997
|
+
const params = new URLSearchParams({ connectionId });
|
|
1998
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
1999
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
2000
|
+
return this.http.get(`/integrations/communication/channels?${params}`);
|
|
2001
|
+
}
|
|
2002
|
+
async getChannel(connectionId, id) {
|
|
2003
|
+
return this.http.get(`/integrations/communication/channels/${id}?connectionId=${connectionId}`);
|
|
2004
|
+
}
|
|
2005
|
+
// Messages
|
|
2006
|
+
async listMessages(connectionId, channelId, options) {
|
|
2007
|
+
const params = new URLSearchParams({ connectionId, channelId });
|
|
2008
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
2009
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
2010
|
+
return this.http.get(`/integrations/communication/messages?${params}`);
|
|
2011
|
+
}
|
|
2012
|
+
async sendMessage(connectionId, input) {
|
|
2013
|
+
return this.http.post("/integrations/communication/messages", { connectionId, ...input });
|
|
2014
|
+
}
|
|
2015
|
+
// Users
|
|
2016
|
+
async listUsers(connectionId, options) {
|
|
2017
|
+
const params = new URLSearchParams({ connectionId });
|
|
2018
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
2019
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
2020
|
+
return this.http.get(`/integrations/communication/users?${params}`);
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
var Productivity = class {
|
|
2024
|
+
http;
|
|
2025
|
+
constructor(http) {
|
|
2026
|
+
this.http = http;
|
|
2027
|
+
}
|
|
2028
|
+
// Documents
|
|
2029
|
+
async listDocuments(connectionId, parentId, options) {
|
|
2030
|
+
const params = new URLSearchParams({ connectionId });
|
|
2031
|
+
if (parentId) params.set("parentId", parentId);
|
|
2032
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
2033
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
2034
|
+
return this.http.get(`/integrations/productivity/documents?${params}`);
|
|
2035
|
+
}
|
|
2036
|
+
async getDocument(connectionId, id) {
|
|
2037
|
+
return this.http.get(`/integrations/productivity/documents/${id}?connectionId=${connectionId}`);
|
|
2038
|
+
}
|
|
2039
|
+
async createDocument(connectionId, data) {
|
|
2040
|
+
return this.http.post("/integrations/productivity/documents", { connectionId, ...data });
|
|
2041
|
+
}
|
|
2042
|
+
async updateDocument(connectionId, id, data) {
|
|
2043
|
+
return this.http.patch(`/integrations/productivity/documents/${id}`, { connectionId, ...data });
|
|
2044
|
+
}
|
|
2045
|
+
// Tables
|
|
2046
|
+
async listTables(connectionId, options) {
|
|
2047
|
+
const params = new URLSearchParams({ connectionId });
|
|
2048
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
2049
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
2050
|
+
return this.http.get(`/integrations/productivity/tables?${params}`);
|
|
2051
|
+
}
|
|
2052
|
+
async getTable(connectionId, id) {
|
|
2053
|
+
return this.http.get(`/integrations/productivity/tables/${id}?connectionId=${connectionId}`);
|
|
2054
|
+
}
|
|
2055
|
+
// Table Rows
|
|
2056
|
+
async listTableRows(connectionId, tableId, options) {
|
|
2057
|
+
const params = new URLSearchParams({ connectionId });
|
|
2058
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
2059
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
2060
|
+
return this.http.get(`/integrations/productivity/tables/${tableId}/rows?${params}`);
|
|
2061
|
+
}
|
|
2062
|
+
async getTableRow(connectionId, tableId, rowId) {
|
|
2063
|
+
return this.http.get(
|
|
2064
|
+
`/integrations/productivity/tables/${tableId}/rows/${rowId}?connectionId=${connectionId}`
|
|
2065
|
+
);
|
|
2066
|
+
}
|
|
2067
|
+
async createTableRow(connectionId, tableId, data) {
|
|
2068
|
+
return this.http.post(`/integrations/productivity/tables/${tableId}/rows`, {
|
|
2069
|
+
connectionId,
|
|
2070
|
+
...data
|
|
2071
|
+
});
|
|
2072
|
+
}
|
|
2073
|
+
async updateTableRow(connectionId, tableId, rowId, data) {
|
|
2074
|
+
return this.http.patch(`/integrations/productivity/tables/${tableId}/rows/${rowId}`, {
|
|
2075
|
+
connectionId,
|
|
2076
|
+
...data
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2079
|
+
async deleteTableRow(connectionId, tableId, rowId) {
|
|
2080
|
+
return this.http.delete(
|
|
2081
|
+
`/integrations/productivity/tables/${tableId}/rows/${rowId}?connectionId=${connectionId}`
|
|
2082
|
+
);
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
var Integrations = class {
|
|
2086
|
+
http;
|
|
2087
|
+
crm;
|
|
2088
|
+
storage;
|
|
2089
|
+
communication;
|
|
2090
|
+
productivity;
|
|
2091
|
+
constructor(config) {
|
|
2092
|
+
this.http = new HttpClient(config);
|
|
2093
|
+
this.crm = new CRM(this.http);
|
|
2094
|
+
this.storage = new Storage(this.http);
|
|
2095
|
+
this.communication = new Communication(this.http);
|
|
2096
|
+
this.productivity = new Productivity(this.http);
|
|
2097
|
+
}
|
|
2098
|
+
// ============================================================================
|
|
2099
|
+
// CONNECTORS
|
|
2100
|
+
// ============================================================================
|
|
2101
|
+
/**
|
|
2102
|
+
* List all available connectors
|
|
2103
|
+
*/
|
|
2104
|
+
async listConnectors(category) {
|
|
2105
|
+
const params = category ? `?category=${category}` : "";
|
|
2106
|
+
return this.http.get(`/integrations/connectors${params}`);
|
|
2107
|
+
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Get a specific connector
|
|
2110
|
+
*/
|
|
2111
|
+
async getConnector(slug) {
|
|
2112
|
+
return this.http.get(`/integrations/connectors/${slug}`);
|
|
2113
|
+
}
|
|
2114
|
+
// ============================================================================
|
|
2115
|
+
// CONNECTIONS
|
|
2116
|
+
// ============================================================================
|
|
2117
|
+
/**
|
|
2118
|
+
* List all connections
|
|
2119
|
+
*/
|
|
2120
|
+
async listConnections(options) {
|
|
2121
|
+
const params = new URLSearchParams();
|
|
2122
|
+
if (options?.connectorId) params.set("connectorId", options.connectorId);
|
|
2123
|
+
if (options?.status) params.set("status", options.status);
|
|
2124
|
+
const queryString = params.toString();
|
|
2125
|
+
return this.http.get(`/integrations/connections${queryString ? `?${queryString}` : ""}`);
|
|
2126
|
+
}
|
|
2127
|
+
/**
|
|
2128
|
+
* Get a specific connection
|
|
2129
|
+
*/
|
|
2130
|
+
async getConnection(id) {
|
|
2131
|
+
return this.http.get(`/integrations/connections/${id}`);
|
|
2132
|
+
}
|
|
2133
|
+
/**
|
|
2134
|
+
* Create a new connection (initiates OAuth flow)
|
|
2135
|
+
* Returns the OAuth authorization URL to redirect the user to
|
|
2136
|
+
*/
|
|
2137
|
+
async createConnection(connectorSlug, options) {
|
|
2138
|
+
return this.http.post("/integrations/connections", {
|
|
2139
|
+
connectorSlug,
|
|
2140
|
+
...options
|
|
2141
|
+
});
|
|
2142
|
+
}
|
|
2143
|
+
/**
|
|
2144
|
+
* Delete a connection
|
|
2145
|
+
*/
|
|
2146
|
+
async deleteConnection(id) {
|
|
2147
|
+
return this.http.delete(`/integrations/connections/${id}`);
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Test a connection's credentials
|
|
2151
|
+
*/
|
|
2152
|
+
async testConnection(id) {
|
|
2153
|
+
return this.http.post(`/integrations/connections/${id}/test`, {});
|
|
2154
|
+
}
|
|
2155
|
+
// ============================================================================
|
|
2156
|
+
// PASSTHROUGH
|
|
2157
|
+
// ============================================================================
|
|
2158
|
+
/**
|
|
2159
|
+
* Make a raw passthrough request to the provider API
|
|
2160
|
+
*/
|
|
2161
|
+
async passthrough(request) {
|
|
2162
|
+
return this.http.post("/integrations/passthrough", request);
|
|
2163
|
+
}
|
|
2164
|
+
};
|
|
2165
|
+
|
|
1720
2166
|
// src/index.ts
|
|
1721
2167
|
var Stack0 = class {
|
|
1722
2168
|
mail;
|
|
1723
2169
|
cdn;
|
|
1724
2170
|
screenshots;
|
|
1725
2171
|
extraction;
|
|
2172
|
+
integrations;
|
|
1726
2173
|
/**
|
|
1727
2174
|
* @deprecated Use `screenshots` and `extraction` instead. Will be removed in a future version.
|
|
1728
2175
|
*/
|
|
@@ -1736,6 +2183,7 @@ var Stack0 = class {
|
|
|
1736
2183
|
this.cdn = new CDN(clientConfig);
|
|
1737
2184
|
this.screenshots = new Screenshots(clientConfig);
|
|
1738
2185
|
this.extraction = new Extraction(clientConfig);
|
|
2186
|
+
this.integrations = new Integrations(clientConfig);
|
|
1739
2187
|
this.webdata = new Webdata(clientConfig);
|
|
1740
2188
|
}
|
|
1741
2189
|
};
|
|
@@ -1743,6 +2191,7 @@ var src_default = Stack0;
|
|
|
1743
2191
|
|
|
1744
2192
|
exports.CDN = CDN;
|
|
1745
2193
|
exports.Extraction = Extraction;
|
|
2194
|
+
exports.Integrations = Integrations;
|
|
1746
2195
|
exports.Mail = Mail;
|
|
1747
2196
|
exports.Screenshots = Screenshots;
|
|
1748
2197
|
exports.Stack0 = Stack0;
|