@myapihq/sdk 1.0.10 → 1.0.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/domain.js CHANGED
@@ -28,7 +28,8 @@ async function getDomainStatus(apiKey, orgId, domain) {
28
28
  return (0, client_1.request)('GET', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/status`, apiKey);
29
29
  }
30
30
  async function assignDomain(apiKey, orgId, domain, targetOrgId) {
31
- return (0, client_1.request)('POST', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/assign`, apiKey, { org_id: targetOrgId });
31
+ const org_id_payload = targetOrgId === 'null' ? null : targetOrgId;
32
+ return (0, client_1.request)('POST', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/assign`, apiKey, { org_id: org_id_payload });
32
33
  }
33
34
  async function unassignDomain(apiKey, orgId, domain) {
34
35
  return (0, client_1.request)('POST', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/assign`, apiKey, { org_id: null });
package/dist/funnel.d.ts CHANGED
@@ -18,14 +18,22 @@ export interface VerifyTest {
18
18
  details: string;
19
19
  }
20
20
  export declare function createFunnel(apiKey: string, orgId: string, domain: string): Promise<Funnel>;
21
- export declare function pushPage(apiKey: string, funnelId: string, slug: string, html: string): Promise<{
21
+ export declare function getFunnel(apiKey: string, orgId: string, funnelId: string): Promise<Funnel>;
22
+ export declare function listFunnels(apiKey: string, orgId: string): Promise<Funnel[]>;
23
+ export declare function deleteFunnel(apiKey: string, orgId: string, funnelId: string): Promise<void>;
24
+ export declare function previewFunnel(apiKey: string, orgId: string, funnelId: string): Promise<{
25
+ preview_url: string;
26
+ }>;
27
+ export declare function publishFunnel(apiKey: string, orgId: string, funnelId: string): Promise<{
28
+ status: string;
29
+ }>;
30
+ export declare function getPublishStatus(apiKey: string, orgId: string, funnelId: string): Promise<{
31
+ status: string;
32
+ }>;
33
+ export declare function pushPage(apiKey: string, orgId: string, funnelId: string, slug: string, html: string): Promise<{
22
34
  status: string;
23
- key: string;
24
35
  }>;
25
- export declare function verifyFunnel(apiKey: string, funnelId: string, opts?: {
36
+ export declare function verifyFunnel(apiKey: string, orgId: string, funnelId: string, opts?: {
26
37
  html?: string;
27
38
  slug?: string;
28
39
  }): Promise<VerifyResult>;
29
- export declare function listFunnels(apiKey: string): Promise<Funnel[]>;
30
- export declare function getFunnel(apiKey: string, funnelId: string): Promise<Funnel>;
31
- export declare function deleteFunnel(apiKey: string, funnelId: string): Promise<void>;
package/dist/funnel.js CHANGED
@@ -1,28 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createFunnel = createFunnel;
4
- exports.pushPage = pushPage;
5
- exports.verifyFunnel = verifyFunnel;
6
- exports.listFunnels = listFunnels;
7
4
  exports.getFunnel = getFunnel;
5
+ exports.listFunnels = listFunnels;
8
6
  exports.deleteFunnel = deleteFunnel;
7
+ exports.previewFunnel = previewFunnel;
8
+ exports.publishFunnel = publishFunnel;
9
+ exports.getPublishStatus = getPublishStatus;
10
+ exports.pushPage = pushPage;
11
+ exports.verifyFunnel = verifyFunnel;
9
12
  const client_1 = require("./client");
10
13
  const BASE_URL = 'https://api.myfunnelapi.com';
11
14
  async function createFunnel(apiKey, orgId, domain) {
12
- return (0, client_1.request)('POST', `${BASE_URL}/funnel/funnels/create-raw`, apiKey, { org_id: orgId, domain });
15
+ return (0, client_1.request)('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/create-raw`, apiKey, { domain });
16
+ }
17
+ async function getFunnel(apiKey, orgId, funnelId) {
18
+ return (0, client_1.request)('GET', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}`, apiKey);
19
+ }
20
+ async function listFunnels(apiKey, orgId) {
21
+ return (0, client_1.request)('GET', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels`, apiKey);
22
+ }
23
+ async function deleteFunnel(apiKey, orgId, funnelId) {
24
+ return (0, client_1.request)('DELETE', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}`, apiKey);
13
25
  }
14
- async function pushPage(apiKey, funnelId, slug, html) {
15
- return (0, client_1.request)('POST', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, { slug, html });
26
+ async function previewFunnel(apiKey, orgId, funnelId) {
27
+ return (0, client_1.request)('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/preview`, apiKey);
16
28
  }
17
- async function verifyFunnel(apiKey, funnelId, opts) {
18
- return (0, client_1.request)('POST', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}/verify`, apiKey, opts || {});
29
+ async function publishFunnel(apiKey, orgId, funnelId) {
30
+ return (0, client_1.request)('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/publish`, apiKey);
19
31
  }
20
- async function listFunnels(apiKey) {
21
- return (0, client_1.request)('GET', `${BASE_URL}/funnel/funnels`, apiKey);
32
+ async function getPublishStatus(apiKey, orgId, funnelId) {
33
+ return (0, client_1.request)('GET', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/publish/status`, apiKey);
22
34
  }
23
- async function getFunnel(apiKey, funnelId) {
24
- return (0, client_1.request)('GET', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}`, apiKey);
35
+ async function pushPage(apiKey, orgId, funnelId, slug, html) {
36
+ return (0, client_1.request)('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, { slug, html });
25
37
  }
26
- async function deleteFunnel(apiKey, funnelId) {
27
- return (0, client_1.request)('DELETE', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}`, apiKey);
38
+ async function verifyFunnel(apiKey, orgId, funnelId, opts) {
39
+ return (0, client_1.request)('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/verify`, apiKey, opts || {});
28
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myapihq/sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "TypeScript SDK for the MyAPI ecosystem",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/domain.ts CHANGED
@@ -39,7 +39,8 @@ export async function getDomainStatus(apiKey: string, orgId: string, domain: str
39
39
  }
40
40
 
41
41
  export async function assignDomain(apiKey: string, orgId: string, domain: string, targetOrgId: string): Promise<DomainRecord> {
42
- return request('POST', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/assign`, apiKey, { org_id: targetOrgId });
42
+ const org_id_payload = targetOrgId === 'null' ? null : targetOrgId;
43
+ return request('POST', `${BASE_URL}/domain/orgs/${encodeURIComponent(orgId)}/${encodeURIComponent(domain)}/assign`, apiKey, { org_id: org_id_payload });
43
44
  }
44
45
 
45
46
  export async function unassignDomain(apiKey: string, orgId: string, domain: string): Promise<DomainRecord> {
package/src/funnel.ts CHANGED
@@ -10,20 +10,30 @@ export interface VerifyResult {
10
10
  export interface VerifyTest { type: 'link' | 'webhook'; url: string; passed: boolean; details: string }
11
11
 
12
12
  export async function createFunnel(apiKey: string, orgId: string, domain: string): Promise<Funnel> {
13
- return request('POST', `${BASE_URL}/funnel/funnels/create-raw`, apiKey, { org_id: orgId, domain });
13
+ return request('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/create-raw`, apiKey, { domain });
14
14
  }
15
- export async function pushPage(apiKey: string, funnelId: string, slug: string, html: string): Promise<{ status: string; key: string }> {
16
- return request('POST', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, { slug, html });
15
+ export async function getFunnel(apiKey: string, orgId: string, funnelId: string): Promise<Funnel> {
16
+ return request('GET', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}`, apiKey);
17
17
  }
18
- export async function verifyFunnel(apiKey: string, funnelId: string, opts?: { html?: string; slug?: string }): Promise<VerifyResult> {
19
- return request('POST', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}/verify`, apiKey, opts || {});
18
+ export async function listFunnels(apiKey: string, orgId: string): Promise<Funnel[]> {
19
+ return request('GET', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels`, apiKey);
20
20
  }
21
- export async function listFunnels(apiKey: string): Promise<Funnel[]> {
22
- return request('GET', `${BASE_URL}/funnel/funnels`, apiKey);
21
+ export async function deleteFunnel(apiKey: string, orgId: string, funnelId: string): Promise<void> {
22
+ return request('DELETE', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}`, apiKey);
23
23
  }
24
- export async function getFunnel(apiKey: string, funnelId: string): Promise<Funnel> {
25
- return request('GET', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}`, apiKey);
24
+
25
+ export async function previewFunnel(apiKey: string, orgId: string, funnelId: string): Promise<{ preview_url: string }> {
26
+ return request('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/preview`, apiKey);
27
+ }
28
+ export async function publishFunnel(apiKey: string, orgId: string, funnelId: string): Promise<{ status: string }> {
29
+ return request('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/publish`, apiKey);
30
+ }
31
+ export async function getPublishStatus(apiKey: string, orgId: string, funnelId: string): Promise<{ status: string }> {
32
+ return request('GET', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/publish/status`, apiKey);
33
+ }
34
+ export async function pushPage(apiKey: string, orgId: string, funnelId: string, slug: string, html: string): Promise<{ status: string }> {
35
+ return request('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/push-page`, apiKey, { slug, html });
26
36
  }
27
- export async function deleteFunnel(apiKey: string, funnelId: string): Promise<void> {
28
- return request('DELETE', `${BASE_URL}/funnel/funnels/${encodeURIComponent(funnelId)}`, apiKey);
37
+ export async function verifyFunnel(apiKey: string, orgId: string, funnelId: string, opts?: { html?: string; slug?: string }): Promise<VerifyResult> {
38
+ return request('POST', `${BASE_URL}/funnel/orgs/${encodeURIComponent(orgId)}/funnels/${encodeURIComponent(funnelId)}/verify`, apiKey, opts || {});
29
39
  }