@myapihq/sdk 1.0.13 → 1.0.15
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/image.d.ts +4 -3
- package/dist/image.js +10 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/pixel.d.ts +4 -4
- package/dist/pixel.js +8 -8
- package/dist/url.d.ts +5 -0
- package/dist/url.js +8 -0
- package/dist/webhook.d.ts +3 -3
- package/dist/webhook.js +7 -7
- package/dist/workflow.d.ts +9 -10
- package/dist/workflow.js +18 -18
- package/package.json +1 -1
- package/src/image.ts +10 -6
- package/src/index.ts +1 -0
- package/src/pixel.ts +8 -8
- package/src/url.ts +12 -0
- package/src/webhook.ts +7 -7
- package/src/workflow.ts +18 -19
package/dist/image.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface ImageJob {
|
|
|
7
7
|
aspect_ratio: string;
|
|
8
8
|
created_at: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function generateImage(apiKey: string, payload: {
|
|
10
|
+
export declare function generateImage(apiKey: string, orgId: string, payload: {
|
|
11
11
|
prompt: string;
|
|
12
12
|
aspect_ratio?: '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
|
|
13
13
|
style?: string;
|
|
@@ -17,5 +17,6 @@ export declare function generateImage(apiKey: string, payload: {
|
|
|
17
17
|
job_id: string;
|
|
18
18
|
status: string;
|
|
19
19
|
}>;
|
|
20
|
-
export declare function getImageJob(apiKey: string, jobId: string): Promise<ImageJob>;
|
|
21
|
-
export declare function listImages(apiKey: string): Promise<ImageJob[]>;
|
|
20
|
+
export declare function getImageJob(apiKey: string, orgId: string, jobId: string): Promise<ImageJob>;
|
|
21
|
+
export declare function listImages(apiKey: string, orgId: string): Promise<ImageJob[]>;
|
|
22
|
+
export declare function deleteImage(apiKey: string, orgId: string, jobId: string): Promise<void>;
|
package/dist/image.js
CHANGED
|
@@ -3,14 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generateImage = generateImage;
|
|
4
4
|
exports.getImageJob = getImageJob;
|
|
5
5
|
exports.listImages = listImages;
|
|
6
|
+
exports.deleteImage = deleteImage;
|
|
6
7
|
const client_1 = require("./client");
|
|
7
8
|
const BASE_URL = 'https://api.myimageapi.com';
|
|
8
|
-
async function generateImage(apiKey, payload) {
|
|
9
|
-
return (0, client_1.request)('POST', `${BASE_URL}/image/generate`, apiKey, payload);
|
|
9
|
+
async function generateImage(apiKey, orgId, payload) {
|
|
10
|
+
return (0, client_1.request)('POST', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/generate`, apiKey, payload);
|
|
10
11
|
}
|
|
11
|
-
async function getImageJob(apiKey, jobId) {
|
|
12
|
-
return (0, client_1.request)('GET', `${BASE_URL}/image/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
12
|
+
async function getImageJob(apiKey, orgId, jobId) {
|
|
13
|
+
return (0, client_1.request)('GET', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
13
14
|
}
|
|
14
|
-
async function listImages(apiKey) {
|
|
15
|
-
return (0, client_1.request)('GET', `${BASE_URL}/image/list`, apiKey);
|
|
15
|
+
async function listImages(apiKey, orgId) {
|
|
16
|
+
return (0, client_1.request)('GET', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/list`, apiKey);
|
|
17
|
+
}
|
|
18
|
+
async function deleteImage(apiKey, orgId, jobId) {
|
|
19
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/images/${encodeURIComponent(jobId)}`, apiKey);
|
|
16
20
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.workflow = exports.webhook = exports.storage = exports.pixel = exports.image = exports.funnel = exports.email = exports.domain = exports.hq = void 0;
|
|
39
|
+
exports.url = exports.workflow = exports.webhook = exports.storage = exports.pixel = exports.image = exports.funnel = exports.email = exports.domain = exports.hq = void 0;
|
|
40
40
|
// AUTO-GENERATED by scripts/generate-indexes.js — do not edit manually
|
|
41
41
|
__exportStar(require("./types"), exports);
|
|
42
42
|
__exportStar(require("./client"), exports);
|
|
@@ -49,3 +49,4 @@ exports.pixel = __importStar(require("./pixel"));
|
|
|
49
49
|
exports.storage = __importStar(require("./storage"));
|
|
50
50
|
exports.webhook = __importStar(require("./webhook"));
|
|
51
51
|
exports.workflow = __importStar(require("./workflow"));
|
|
52
|
+
exports.url = __importStar(require("./url"));
|
package/dist/pixel.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface PixelEvent {
|
|
|
20
20
|
campaign_id?: string;
|
|
21
21
|
ts: string;
|
|
22
22
|
}
|
|
23
|
-
export declare function getInteractions(apiKey: string, params: {
|
|
23
|
+
export declare function getInteractions(apiKey: string, orgId: string, params: {
|
|
24
24
|
website?: string;
|
|
25
25
|
domain?: string;
|
|
26
26
|
campaign_id?: string;
|
|
@@ -29,7 +29,7 @@ export declare function getInteractions(apiKey: string, params: {
|
|
|
29
29
|
limit?: number;
|
|
30
30
|
offset?: number;
|
|
31
31
|
}): Promise<InteractionsResponse>;
|
|
32
|
-
export declare function getVisits(apiKey: string, params: {
|
|
32
|
+
export declare function getVisits(apiKey: string, orgId: string, params: {
|
|
33
33
|
website: string;
|
|
34
34
|
from?: string;
|
|
35
35
|
to?: string;
|
|
@@ -41,7 +41,7 @@ export declare function getVisits(apiKey: string, params: {
|
|
|
41
41
|
limit: number;
|
|
42
42
|
offset: number;
|
|
43
43
|
}>;
|
|
44
|
-
export declare function getEvents(apiKey: string, params: {
|
|
44
|
+
export declare function getEvents(apiKey: string, orgId: string, params: {
|
|
45
45
|
campaign_id?: string;
|
|
46
46
|
domain?: string;
|
|
47
47
|
from?: string;
|
|
@@ -54,7 +54,7 @@ export declare function getEvents(apiKey: string, params: {
|
|
|
54
54
|
limit: number;
|
|
55
55
|
offset: number;
|
|
56
56
|
}>;
|
|
57
|
-
export declare function getIdentity(apiKey: string, pixelId: string): Promise<{
|
|
57
|
+
export declare function getIdentity(apiKey: string, orgId: string, pixelId: string): Promise<{
|
|
58
58
|
uuid: string;
|
|
59
59
|
is_resolved: boolean;
|
|
60
60
|
nodes: Record<string, {
|
package/dist/pixel.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.getEvents = getEvents;
|
|
|
6
6
|
exports.getIdentity = getIdentity;
|
|
7
7
|
const client_1 = require("./client");
|
|
8
8
|
const BASE_URL = 'https://api.mypixelapi.com';
|
|
9
|
-
async function getInteractions(apiKey, params) {
|
|
9
|
+
async function getInteractions(apiKey, orgId, params) {
|
|
10
10
|
const qs = new URLSearchParams();
|
|
11
11
|
for (const [key, val] of Object.entries(params)) {
|
|
12
12
|
if (val !== undefined && val !== null) {
|
|
@@ -14,10 +14,10 @@ async function getInteractions(apiKey, params) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
const queryString = qs.toString();
|
|
17
|
-
const url = `${BASE_URL}/pixel/interactions${queryString ? `?${queryString}` : ''}`;
|
|
17
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/interactions${queryString ? `?${queryString}` : ''}`;
|
|
18
18
|
return (0, client_1.request)('GET', url, apiKey);
|
|
19
19
|
}
|
|
20
|
-
async function getVisits(apiKey, params) {
|
|
20
|
+
async function getVisits(apiKey, orgId, params) {
|
|
21
21
|
const qs = new URLSearchParams();
|
|
22
22
|
for (const [key, val] of Object.entries(params)) {
|
|
23
23
|
if (val !== undefined && val !== null) {
|
|
@@ -25,10 +25,10 @@ async function getVisits(apiKey, params) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
const queryString = qs.toString();
|
|
28
|
-
const url = `${BASE_URL}/pixel/visits${queryString ? `?${queryString}` : ''}`;
|
|
28
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/visits${queryString ? `?${queryString}` : ''}`;
|
|
29
29
|
return (0, client_1.request)('GET', url, apiKey);
|
|
30
30
|
}
|
|
31
|
-
async function getEvents(apiKey, params) {
|
|
31
|
+
async function getEvents(apiKey, orgId, params) {
|
|
32
32
|
const qs = new URLSearchParams();
|
|
33
33
|
for (const [key, val] of Object.entries(params)) {
|
|
34
34
|
if (val !== undefined && val !== null) {
|
|
@@ -36,9 +36,9 @@ async function getEvents(apiKey, params) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
const queryString = qs.toString();
|
|
39
|
-
const url = `${BASE_URL}/pixel/events${queryString ? `?${queryString}` : ''}`;
|
|
39
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/events${queryString ? `?${queryString}` : ''}`;
|
|
40
40
|
return (0, client_1.request)('GET', url, apiKey);
|
|
41
41
|
}
|
|
42
|
-
async function getIdentity(apiKey, pixelId) {
|
|
43
|
-
return (0, client_1.request)('GET', `${BASE_URL}/pixel/identity/${encodeURIComponent(pixelId)}`, apiKey);
|
|
42
|
+
async function getIdentity(apiKey, orgId, pixelId) {
|
|
43
|
+
return (0, client_1.request)('GET', `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}`, apiKey);
|
|
44
44
|
}
|
package/dist/url.d.ts
ADDED
package/dist/url.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shortenUrl = shortenUrl;
|
|
4
|
+
const client_1 = require("./client");
|
|
5
|
+
const BASE_URL = 'https://api.myurlto.com';
|
|
6
|
+
async function shortenUrl(apiKey, orgId, url) {
|
|
7
|
+
return (0, client_1.request)('POST', `${BASE_URL}/url/orgs/${encodeURIComponent(orgId)}/shorten`, apiKey, { url });
|
|
8
|
+
}
|
package/dist/webhook.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ export interface Delivery {
|
|
|
15
15
|
created_at: string;
|
|
16
16
|
}
|
|
17
17
|
export declare function createEndpoint(apiKey: string, orgId: string, name: string, description?: string): Promise<WebhookEndpoint>;
|
|
18
|
-
export declare function listEndpoints(apiKey: string): Promise<WebhookEndpoint[]>;
|
|
19
|
-
export declare function deleteEndpoint(apiKey: string, endpointId: string): Promise<void>;
|
|
20
|
-
export declare function getDelivery(apiKey: string, deliveryId: string): Promise<Delivery>;
|
|
18
|
+
export declare function listEndpoints(apiKey: string, orgId: string): Promise<WebhookEndpoint[]>;
|
|
19
|
+
export declare function deleteEndpoint(apiKey: string, orgId: string, endpointId: string): Promise<void>;
|
|
20
|
+
export declare function getDelivery(apiKey: string, orgId: string, deliveryId: string): Promise<Delivery>;
|
package/dist/webhook.js
CHANGED
|
@@ -7,14 +7,14 @@ exports.getDelivery = getDelivery;
|
|
|
7
7
|
const client_1 = require("./client");
|
|
8
8
|
const BASE_URL = 'https://api.mywebhookapi.com';
|
|
9
9
|
async function createEndpoint(apiKey, orgId, name, description) {
|
|
10
|
-
return (0, client_1.request)('POST', `${BASE_URL}/webhook/endpoints`, apiKey, {
|
|
10
|
+
return (0, client_1.request)('POST', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/endpoints`, apiKey, { name, description });
|
|
11
11
|
}
|
|
12
|
-
async function listEndpoints(apiKey) {
|
|
13
|
-
return (0, client_1.request)('GET', `${BASE_URL}/webhook/endpoints`, apiKey);
|
|
12
|
+
async function listEndpoints(apiKey, orgId) {
|
|
13
|
+
return (0, client_1.request)('GET', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/endpoints`, apiKey);
|
|
14
14
|
}
|
|
15
|
-
async function deleteEndpoint(apiKey, endpointId) {
|
|
16
|
-
return (0, client_1.request)('DELETE', `${BASE_URL}/webhook/endpoints/${encodeURIComponent(endpointId)}`, apiKey);
|
|
15
|
+
async function deleteEndpoint(apiKey, orgId, endpointId) {
|
|
16
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/endpoints/${encodeURIComponent(endpointId)}`, apiKey);
|
|
17
17
|
}
|
|
18
|
-
async function getDelivery(apiKey, deliveryId) {
|
|
19
|
-
return (0, client_1.request)('GET', `${BASE_URL}/webhook/deliveries/${encodeURIComponent(deliveryId)}`, apiKey);
|
|
18
|
+
async function getDelivery(apiKey, orgId, deliveryId) {
|
|
19
|
+
return (0, client_1.request)('GET', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/deliveries/${encodeURIComponent(deliveryId)}`, apiKey);
|
|
20
20
|
}
|
package/dist/workflow.d.ts
CHANGED
|
@@ -32,25 +32,24 @@ export interface WorkflowRun {
|
|
|
32
32
|
finished_at?: string;
|
|
33
33
|
created_at: string;
|
|
34
34
|
}
|
|
35
|
-
export declare function createWorkflow(apiKey: string, payload: {
|
|
36
|
-
org_id: string;
|
|
35
|
+
export declare function createWorkflow(apiKey: string, orgId: string, payload: {
|
|
37
36
|
name: string;
|
|
38
37
|
trigger_config: {
|
|
39
38
|
endpoint_id: string;
|
|
40
39
|
};
|
|
41
40
|
steps: WorkflowStep[];
|
|
42
41
|
}): Promise<Workflow>;
|
|
43
|
-
export declare function listWorkflows(apiKey: string): Promise<Workflow[]>;
|
|
44
|
-
export declare function getWorkflow(apiKey: string, workflowId: string): Promise<Workflow>;
|
|
45
|
-
export declare function updateWorkflow(apiKey: string, workflowId: string, payload: {
|
|
42
|
+
export declare function listWorkflows(apiKey: string, orgId: string): Promise<Workflow[]>;
|
|
43
|
+
export declare function getWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<Workflow>;
|
|
44
|
+
export declare function updateWorkflow(apiKey: string, orgId: string, workflowId: string, payload: {
|
|
46
45
|
name?: string;
|
|
47
46
|
trigger_config?: {
|
|
48
47
|
endpoint_id: string;
|
|
49
48
|
};
|
|
50
49
|
steps?: WorkflowStep[];
|
|
51
50
|
}): Promise<Workflow>;
|
|
52
|
-
export declare function enableWorkflow(apiKey: string, workflowId: string): Promise<void>;
|
|
53
|
-
export declare function disableWorkflow(apiKey: string, workflowId: string): Promise<void>;
|
|
54
|
-
export declare function deleteWorkflow(apiKey: string, workflowId: string): Promise<void>;
|
|
55
|
-
export declare function listWorkflowRuns(apiKey: string, workflowId: string): Promise<WorkflowRun[]>;
|
|
56
|
-
export declare function getWorkflowRun(apiKey: string, runId: string): Promise<WorkflowRun>;
|
|
51
|
+
export declare function enableWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<void>;
|
|
52
|
+
export declare function disableWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<void>;
|
|
53
|
+
export declare function deleteWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<void>;
|
|
54
|
+
export declare function listWorkflowRuns(apiKey: string, orgId: string, workflowId: string): Promise<WorkflowRun[]>;
|
|
55
|
+
export declare function getWorkflowRun(apiKey: string, orgId: string, runId: string): Promise<WorkflowRun>;
|
package/dist/workflow.js
CHANGED
|
@@ -11,30 +11,30 @@ exports.listWorkflowRuns = listWorkflowRuns;
|
|
|
11
11
|
exports.getWorkflowRun = getWorkflowRun;
|
|
12
12
|
const client_1 = require("./client");
|
|
13
13
|
const BASE_URL = 'https://api.myworkflowapi.com';
|
|
14
|
-
async function createWorkflow(apiKey, payload) {
|
|
15
|
-
return (0, client_1.request)('POST', `${BASE_URL}/workflow/workflows`, apiKey, payload);
|
|
14
|
+
async function createWorkflow(apiKey, orgId, payload) {
|
|
15
|
+
return (0, client_1.request)('POST', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows`, apiKey, payload);
|
|
16
16
|
}
|
|
17
|
-
async function listWorkflows(apiKey) {
|
|
18
|
-
return (0, client_1.request)('GET', `${BASE_URL}/workflow/workflows`, apiKey);
|
|
17
|
+
async function listWorkflows(apiKey, orgId) {
|
|
18
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows`, apiKey);
|
|
19
19
|
}
|
|
20
|
-
async function getWorkflow(apiKey, workflowId) {
|
|
21
|
-
return (0, client_1.request)('GET', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
20
|
+
async function getWorkflow(apiKey, orgId, workflowId) {
|
|
21
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
22
22
|
}
|
|
23
|
-
async function updateWorkflow(apiKey, workflowId, payload) {
|
|
24
|
-
return (0, client_1.request)('PATCH', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey, payload);
|
|
23
|
+
async function updateWorkflow(apiKey, orgId, workflowId, payload) {
|
|
24
|
+
return (0, client_1.request)('PATCH', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}`, apiKey, payload);
|
|
25
25
|
}
|
|
26
|
-
async function enableWorkflow(apiKey, workflowId) {
|
|
27
|
-
return (0, client_1.request)('POST', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/enable`, apiKey);
|
|
26
|
+
async function enableWorkflow(apiKey, orgId, workflowId) {
|
|
27
|
+
return (0, client_1.request)('POST', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/enable`, apiKey);
|
|
28
28
|
}
|
|
29
|
-
async function disableWorkflow(apiKey, workflowId) {
|
|
30
|
-
return (0, client_1.request)('POST', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/disable`, apiKey);
|
|
29
|
+
async function disableWorkflow(apiKey, orgId, workflowId) {
|
|
30
|
+
return (0, client_1.request)('POST', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/disable`, apiKey);
|
|
31
31
|
}
|
|
32
|
-
async function deleteWorkflow(apiKey, workflowId) {
|
|
33
|
-
return (0, client_1.request)('DELETE', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
32
|
+
async function deleteWorkflow(apiKey, orgId, workflowId) {
|
|
33
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
34
34
|
}
|
|
35
|
-
async function listWorkflowRuns(apiKey, workflowId) {
|
|
36
|
-
return (0, client_1.request)('GET', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/runs`, apiKey);
|
|
35
|
+
async function listWorkflowRuns(apiKey, orgId, workflowId) {
|
|
36
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/runs`, apiKey);
|
|
37
37
|
}
|
|
38
|
-
async function getWorkflowRun(apiKey, runId) {
|
|
39
|
-
return (0, client_1.request)('GET', `${BASE_URL}/workflow/runs/${encodeURIComponent(runId)}`, apiKey);
|
|
38
|
+
async function getWorkflowRun(apiKey, orgId, runId) {
|
|
39
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/runs/${encodeURIComponent(runId)}`, apiKey);
|
|
40
40
|
}
|
package/package.json
CHANGED
package/src/image.ts
CHANGED
|
@@ -12,20 +12,24 @@ export interface ImageJob {
|
|
|
12
12
|
created_at: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export async function generateImage(apiKey: string, payload: {
|
|
15
|
+
export async function generateImage(apiKey: string, orgId: string, payload: {
|
|
16
16
|
prompt: string;
|
|
17
17
|
aspect_ratio?: '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
|
|
18
18
|
style?: string;
|
|
19
19
|
colors?: string;
|
|
20
20
|
has_text?: boolean;
|
|
21
21
|
}): Promise<{ job_id: string; status: string }> {
|
|
22
|
-
return request('POST', `${BASE_URL}/image/generate`, apiKey, payload);
|
|
22
|
+
return request('POST', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/generate`, apiKey, payload);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export async function getImageJob(apiKey: string, jobId: string): Promise<ImageJob> {
|
|
26
|
-
return request('GET', `${BASE_URL}/image/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
25
|
+
export async function getImageJob(apiKey: string, orgId: string, jobId: string): Promise<ImageJob> {
|
|
26
|
+
return request('GET', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/jobs/${encodeURIComponent(jobId)}`, apiKey);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export async function listImages(apiKey: string): Promise<ImageJob[]> {
|
|
30
|
-
return request('GET', `${BASE_URL}/image/list`, apiKey);
|
|
29
|
+
export async function listImages(apiKey: string, orgId: string): Promise<ImageJob[]> {
|
|
30
|
+
return request('GET', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/list`, apiKey);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function deleteImage(apiKey: string, orgId: string, jobId: string): Promise<void> {
|
|
34
|
+
return request('DELETE', `${BASE_URL}/image/orgs/${encodeURIComponent(orgId)}/images/${encodeURIComponent(jobId)}`, apiKey);
|
|
31
35
|
}
|
package/src/index.ts
CHANGED
package/src/pixel.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface InteractionsResponse {
|
|
|
12
12
|
export interface Visit { type: 'visit'; pixel_id: string; from_url: string; to_url: string; ts: string }
|
|
13
13
|
export interface PixelEvent { type: 'event'; pixel_id: string; event_type: 'sent' | 'open' | 'click' | 'page_visit'; url?: string; campaign_id?: string; ts: string }
|
|
14
14
|
|
|
15
|
-
export async function getInteractions(apiKey: string, params: {
|
|
15
|
+
export async function getInteractions(apiKey: string, orgId: string, params: {
|
|
16
16
|
website?: string;
|
|
17
17
|
domain?: string;
|
|
18
18
|
campaign_id?: string;
|
|
@@ -28,11 +28,11 @@ export async function getInteractions(apiKey: string, params: {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
const queryString = qs.toString();
|
|
31
|
-
const url = `${BASE_URL}/pixel/interactions${queryString ? `?${queryString}` : ''}`;
|
|
31
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/interactions${queryString ? `?${queryString}` : ''}`;
|
|
32
32
|
return request('GET', url, apiKey);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export async function getVisits(apiKey: string, params: { website: string; from?: string; to?: string; limit?: number; offset?: number }): Promise<{ visits: Visit[]; total: number; limit: number; offset: number }> {
|
|
35
|
+
export async function getVisits(apiKey: string, orgId: string, params: { website: string; from?: string; to?: string; limit?: number; offset?: number }): Promise<{ visits: Visit[]; total: number; limit: number; offset: number }> {
|
|
36
36
|
const qs = new URLSearchParams();
|
|
37
37
|
for (const [key, val] of Object.entries(params)) {
|
|
38
38
|
if (val !== undefined && val !== null) {
|
|
@@ -40,11 +40,11 @@ export async function getVisits(apiKey: string, params: { website: string; from?
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
const queryString = qs.toString();
|
|
43
|
-
const url = `${BASE_URL}/pixel/visits${queryString ? `?${queryString}` : ''}`;
|
|
43
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/visits${queryString ? `?${queryString}` : ''}`;
|
|
44
44
|
return request('GET', url, apiKey);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export async function getEvents(apiKey: string, params: { campaign_id?: string; domain?: string; from?: string; to?: string; limit?: number; offset?: number }): Promise<{ events: PixelEvent[]; total: number; limit: number; offset: number }> {
|
|
47
|
+
export async function getEvents(apiKey: string, orgId: string, params: { campaign_id?: string; domain?: string; from?: string; to?: string; limit?: number; offset?: number }): Promise<{ events: PixelEvent[]; total: number; limit: number; offset: number }> {
|
|
48
48
|
const qs = new URLSearchParams();
|
|
49
49
|
for (const [key, val] of Object.entries(params)) {
|
|
50
50
|
if (val !== undefined && val !== null) {
|
|
@@ -52,10 +52,10 @@ export async function getEvents(apiKey: string, params: { campaign_id?: string;
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
const queryString = qs.toString();
|
|
55
|
-
const url = `${BASE_URL}/pixel/events${queryString ? `?${queryString}` : ''}`;
|
|
55
|
+
const url = `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/events${queryString ? `?${queryString}` : ''}`;
|
|
56
56
|
return request('GET', url, apiKey);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export async function getIdentity(apiKey: string, pixelId: string): Promise<{ uuid: string; is_resolved: boolean; nodes: Record<string, { type: string; probability: number }>; latency_ms: number }> {
|
|
60
|
-
return request('GET', `${BASE_URL}/pixel/identity/${encodeURIComponent(pixelId)}`, apiKey);
|
|
59
|
+
export async function getIdentity(apiKey: string, orgId: string, pixelId: string): Promise<{ uuid: string; is_resolved: boolean; nodes: Record<string, { type: string; probability: number }>; latency_ms: number }> {
|
|
60
|
+
return request('GET', `${BASE_URL}/pixel/orgs/${encodeURIComponent(orgId)}/identity/${encodeURIComponent(pixelId)}`, apiKey);
|
|
61
61
|
}
|
package/src/url.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { request } from './client';
|
|
2
|
+
|
|
3
|
+
const BASE_URL = 'https://api.myurlto.com';
|
|
4
|
+
|
|
5
|
+
export interface ShortenResponse {
|
|
6
|
+
short_code: string;
|
|
7
|
+
short_url: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function shortenUrl(apiKey: string, orgId: string, url: string): Promise<ShortenResponse> {
|
|
11
|
+
return request('POST', `${BASE_URL}/url/orgs/${encodeURIComponent(orgId)}/shorten`, apiKey, { url });
|
|
12
|
+
}
|
package/src/webhook.ts
CHANGED
|
@@ -6,17 +6,17 @@ export interface WebhookEndpoint { id: string; org_id: string; name: string; slu
|
|
|
6
6
|
export interface Delivery { id: string; endpoint_id: string; payload: unknown; headers: Record<string, string>; status: string; created_at: string }
|
|
7
7
|
|
|
8
8
|
export async function createEndpoint(apiKey: string, orgId: string, name: string, description?: string): Promise<WebhookEndpoint> {
|
|
9
|
-
return request('POST', `${BASE_URL}/webhook/endpoints`, apiKey, {
|
|
9
|
+
return request('POST', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/endpoints`, apiKey, { name, description });
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export async function listEndpoints(apiKey: string): Promise<WebhookEndpoint[]> {
|
|
13
|
-
return request('GET', `${BASE_URL}/webhook/endpoints`, apiKey);
|
|
12
|
+
export async function listEndpoints(apiKey: string, orgId: string): Promise<WebhookEndpoint[]> {
|
|
13
|
+
return request('GET', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/endpoints`, apiKey);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export async function deleteEndpoint(apiKey: string, endpointId: string): Promise<void> {
|
|
17
|
-
return request('DELETE', `${BASE_URL}/webhook/endpoints/${encodeURIComponent(endpointId)}`, apiKey);
|
|
16
|
+
export async function deleteEndpoint(apiKey: string, orgId: string, endpointId: string): Promise<void> {
|
|
17
|
+
return request('DELETE', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/endpoints/${encodeURIComponent(endpointId)}`, apiKey);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export async function getDelivery(apiKey: string, deliveryId: string): Promise<Delivery> {
|
|
21
|
-
return request('GET', `${BASE_URL}/webhook/deliveries/${encodeURIComponent(deliveryId)}`, apiKey);
|
|
20
|
+
export async function getDelivery(apiKey: string, orgId: string, deliveryId: string): Promise<Delivery> {
|
|
21
|
+
return request('GET', `${BASE_URL}/webhook/orgs/${encodeURIComponent(orgId)}/deliveries/${encodeURIComponent(deliveryId)}`, apiKey);
|
|
22
22
|
}
|
package/src/workflow.ts
CHANGED
|
@@ -9,43 +9,42 @@ export type WorkflowStep =
|
|
|
9
9
|
export interface Workflow { id: string; org_id: string; name: string; status: 'enabled' | 'disabled'; trigger_config: { endpoint_id: string }; steps: WorkflowStep[]; created_at: string }
|
|
10
10
|
export interface WorkflowRun { id: string; workflow_id: string; trigger_payload: unknown; status: 'pending' | 'running' | 'completed' | 'failed'; error?: string; attempt: number; started_at: string; finished_at?: string; created_at: string }
|
|
11
11
|
|
|
12
|
-
export async function createWorkflow(apiKey: string, payload: {
|
|
13
|
-
org_id: string;
|
|
12
|
+
export async function createWorkflow(apiKey: string, orgId: string, payload: {
|
|
14
13
|
name: string;
|
|
15
14
|
trigger_config: { endpoint_id: string };
|
|
16
15
|
steps: WorkflowStep[];
|
|
17
16
|
}): Promise<Workflow> {
|
|
18
|
-
return request('POST', `${BASE_URL}/workflow/workflows`, apiKey, payload);
|
|
17
|
+
return request('POST', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows`, apiKey, payload);
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
export async function listWorkflows(apiKey: string): Promise<Workflow[]> {
|
|
22
|
-
return request('GET', `${BASE_URL}/workflow/workflows`, apiKey);
|
|
20
|
+
export async function listWorkflows(apiKey: string, orgId: string): Promise<Workflow[]> {
|
|
21
|
+
return request('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows`, apiKey);
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
export async function getWorkflow(apiKey: string, workflowId: string): Promise<Workflow> {
|
|
26
|
-
return request('GET', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
24
|
+
export async function getWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<Workflow> {
|
|
25
|
+
return request('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
export async function updateWorkflow(apiKey: string, workflowId: string, payload: { name?: string; trigger_config?: { endpoint_id: string }; steps?: WorkflowStep[] }): Promise<Workflow> {
|
|
30
|
-
return request('PATCH', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey, payload);
|
|
28
|
+
export async function updateWorkflow(apiKey: string, orgId: string, workflowId: string, payload: { name?: string; trigger_config?: { endpoint_id: string }; steps?: WorkflowStep[] }): Promise<Workflow> {
|
|
29
|
+
return request('PATCH', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}`, apiKey, payload);
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
export async function enableWorkflow(apiKey: string, workflowId: string): Promise<void> {
|
|
34
|
-
return request('POST', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/enable`, apiKey);
|
|
32
|
+
export async function enableWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<void> {
|
|
33
|
+
return request('POST', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/enable`, apiKey);
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
export async function disableWorkflow(apiKey: string, workflowId: string): Promise<void> {
|
|
38
|
-
return request('POST', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/disable`, apiKey);
|
|
36
|
+
export async function disableWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<void> {
|
|
37
|
+
return request('POST', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/disable`, apiKey);
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
export async function deleteWorkflow(apiKey: string, workflowId: string): Promise<void> {
|
|
42
|
-
return request('DELETE', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
40
|
+
export async function deleteWorkflow(apiKey: string, orgId: string, workflowId: string): Promise<void> {
|
|
41
|
+
return request('DELETE', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
43
42
|
}
|
|
44
43
|
|
|
45
|
-
export async function listWorkflowRuns(apiKey: string, workflowId: string): Promise<WorkflowRun[]> {
|
|
46
|
-
return request('GET', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/runs`, apiKey);
|
|
44
|
+
export async function listWorkflowRuns(apiKey: string, orgId: string, workflowId: string): Promise<WorkflowRun[]> {
|
|
45
|
+
return request('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/workflows/${encodeURIComponent(workflowId)}/runs`, apiKey);
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
export async function getWorkflowRun(apiKey: string, runId: string): Promise<WorkflowRun> {
|
|
50
|
-
return request('GET', `${BASE_URL}/workflow/runs/${encodeURIComponent(runId)}`, apiKey);
|
|
48
|
+
export async function getWorkflowRun(apiKey: string, orgId: string, runId: string): Promise<WorkflowRun> {
|
|
49
|
+
return request('GET', `${BASE_URL}/workflow/orgs/${encodeURIComponent(orgId)}/runs/${encodeURIComponent(runId)}`, apiKey);
|
|
51
50
|
}
|