@myapihq/sdk 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -9,3 +9,4 @@ export * as pixel from './pixel';
9
9
  export * as storage from './storage';
10
10
  export * as webhook from './webhook';
11
11
  export * as workflow from './workflow';
12
+ export * as url from './url';
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/url.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export interface ShortenResponse {
2
+ short_code: string;
3
+ short_url: string;
4
+ }
5
+ export declare function shortenUrl(apiKey: string, orgId: string, url: string): Promise<ShortenResponse>;
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, { org_id: orgId, name, description });
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
  }
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myapihq/sdk",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "TypeScript SDK for the MyAPI ecosystem",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@ export * as pixel from './pixel';
10
10
  export * as storage from './storage';
11
11
  export * as webhook from './webhook';
12
12
  export * as workflow from './workflow';
13
+ export * as url from './url';
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, { org_id: orgId, name, description });
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
  }