@myapihq/sdk 1.0.6 → 1.0.7

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.d.ts CHANGED
@@ -11,21 +11,22 @@ export interface DomainSettings {
11
11
  ai_bots_protection: string;
12
12
  is_robots_txt_managed: boolean;
13
13
  }
14
- export declare function checkDomain(apiKey: string, domain: string): Promise<{
14
+ export declare function checkDomain(apiKey: string, orgId: string, domain: string): Promise<{
15
15
  available: boolean;
16
16
  price_cents: number;
17
17
  }>;
18
- export declare function registerDomain(apiKey: string, domain: string, years?: number): Promise<DomainRecord>;
19
- export declare function importDomain(apiKey: string, payload: {
18
+ export declare function registerDomain(apiKey: string, orgId: string, domain: string, years?: number): Promise<DomainRecord>;
19
+ export declare function importDomain(apiKey: string, orgId: string, payload: {
20
20
  domain: string;
21
21
  namecheap_api_user?: string;
22
22
  namecheap_api_key?: string;
23
23
  }): Promise<DomainRecord>;
24
- export declare function listDomains(apiKey: string): Promise<DomainRecord[]>;
25
- export declare function getDomainStatus(apiKey: string, domain: string): Promise<DomainRecord>;
26
- export declare function renewDomain(apiKey: string, domain: string, years?: number): Promise<DomainRecord>;
27
- export declare function getDomainSettings(apiKey: string, domain: string): Promise<DomainSettings>;
28
- export declare function updateDomainSettings(apiKey: string, domain: string, payload: {
24
+ export declare function listDomains(apiKey: string, orgId: string, filter?: 'all' | 'unassigned' | 'org'): Promise<DomainRecord[]>;
25
+ export declare function getDomainStatus(apiKey: string, orgId: string, domain: string): Promise<DomainRecord>;
26
+ export declare function renewDomain(apiKey: string, orgId: string, domain: string, years?: number): Promise<DomainRecord>;
27
+ export declare function assignDomain(apiKey: string, orgId: string, domain: string, targetOrgId: string): Promise<DomainRecord>;
28
+ export declare function getDomainSettings(apiKey: string, orgId: string, domain: string): Promise<DomainSettings>;
29
+ export declare function updateDomainSettings(apiKey: string, orgId: string, domain: string, payload: {
29
30
  security_level?: 'essentially_off' | 'medium' | 'high' | 'under_attack';
30
31
  browser_check?: 'on' | 'off';
31
32
  purge_cache?: boolean;
package/dist/domain.js CHANGED
@@ -6,31 +6,36 @@ exports.importDomain = importDomain;
6
6
  exports.listDomains = listDomains;
7
7
  exports.getDomainStatus = getDomainStatus;
8
8
  exports.renewDomain = renewDomain;
9
+ exports.assignDomain = assignDomain;
9
10
  exports.getDomainSettings = getDomainSettings;
10
11
  exports.updateDomainSettings = updateDomainSettings;
11
12
  const client_1 = require("./client");
12
13
  const BASE_URL = 'https://api.mydomainapi.com';
13
- async function checkDomain(apiKey, domain) {
14
- return (0, client_1.request)('GET', `${BASE_URL}/domain/check/${encodeURIComponent(domain)}`, apiKey);
14
+ async function checkDomain(apiKey, orgId, domain) {
15
+ return (0, client_1.request)('GET', `${BASE_URL}/domain/orgs/${orgId}/check/available/${encodeURIComponent(domain)}`, apiKey);
15
16
  }
16
- async function registerDomain(apiKey, domain, years) {
17
- return (0, client_1.request)('POST', `${BASE_URL}/domain/register`, apiKey, { domain, years });
17
+ async function registerDomain(apiKey, orgId, domain, years) {
18
+ return (0, client_1.request)('POST', `${BASE_URL}/domain/orgs/${orgId}/register`, apiKey, { domain, years });
18
19
  }
19
- async function importDomain(apiKey, payload) {
20
- return (0, client_1.request)('POST', `${BASE_URL}/domain/import`, apiKey, payload);
20
+ async function importDomain(apiKey, orgId, payload) {
21
+ return (0, client_1.request)('POST', `${BASE_URL}/domain/orgs/${orgId}/import`, apiKey, payload);
21
22
  }
22
- async function listDomains(apiKey) {
23
- return (0, client_1.request)('GET', `${BASE_URL}/domain/list/me`, apiKey);
23
+ async function listDomains(apiKey, orgId, filter) {
24
+ const query = filter ? `?filter=${filter}` : '';
25
+ return (0, client_1.request)('GET', `${BASE_URL}/domain/orgs/${orgId}/list${query}`, apiKey);
24
26
  }
25
- async function getDomainStatus(apiKey, domain) {
26
- return (0, client_1.request)('GET', `${BASE_URL}/domain/status/${encodeURIComponent(domain)}`, apiKey);
27
+ async function getDomainStatus(apiKey, orgId, domain) {
28
+ return (0, client_1.request)('GET', `${BASE_URL}/domain/orgs/${orgId}/${encodeURIComponent(domain)}/status`, apiKey);
27
29
  }
28
- async function renewDomain(apiKey, domain, years) {
29
- return (0, client_1.request)('POST', `${BASE_URL}/domain/renew/${encodeURIComponent(domain)}`, apiKey, { years });
30
+ async function renewDomain(apiKey, orgId, domain, years) {
31
+ return (0, client_1.request)('POST', `${BASE_URL}/domain/orgs/${orgId}/${encodeURIComponent(domain)}/renew`, apiKey, { years });
30
32
  }
31
- async function getDomainSettings(apiKey, domain) {
32
- return (0, client_1.request)('GET', `${BASE_URL}/domain/settings/${encodeURIComponent(domain)}`, apiKey);
33
+ async function assignDomain(apiKey, orgId, domain, targetOrgId) {
34
+ return (0, client_1.request)('POST', `${BASE_URL}/domain/orgs/${orgId}/${encodeURIComponent(domain)}/assign`, apiKey, { org_id: targetOrgId });
33
35
  }
34
- async function updateDomainSettings(apiKey, domain, payload) {
35
- return (0, client_1.request)('POST', `${BASE_URL}/domain/settings/${encodeURIComponent(domain)}`, apiKey, payload);
36
+ async function getDomainSettings(apiKey, orgId, domain) {
37
+ return (0, client_1.request)('GET', `${BASE_URL}/domain/orgs/${orgId}/${encodeURIComponent(domain)}/settings`, apiKey);
38
+ }
39
+ async function updateDomainSettings(apiKey, orgId, domain, payload) {
40
+ return (0, client_1.request)('POST', `${BASE_URL}/domain/orgs/${orgId}/${encodeURIComponent(domain)}/settings`, apiKey, payload);
36
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myapihq/sdk",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
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
@@ -17,38 +17,43 @@ export interface DomainSettings {
17
17
  is_robots_txt_managed: boolean;
18
18
  }
19
19
 
20
- export async function checkDomain(apiKey: string, domain: string): Promise<{ available: boolean; price_cents: number }> {
21
- return request('GET', `${BASE_URL}/domain/check/${encodeURIComponent(domain)}`, apiKey);
20
+ export async function checkDomain(apiKey: string, orgId: string, domain: string): Promise<{ available: boolean; price_cents: number }> {
21
+ return request('GET', `${BASE_URL}/domain/orgs/${orgId}/check/available/${encodeURIComponent(domain)}`, apiKey);
22
22
  }
23
23
 
24
- export async function registerDomain(apiKey: string, domain: string, years?: number): Promise<DomainRecord> {
25
- return request('POST', `${BASE_URL}/domain/register`, apiKey, { domain, years });
24
+ export async function registerDomain(apiKey: string, orgId: string, domain: string, years?: number): Promise<DomainRecord> {
25
+ return request('POST', `${BASE_URL}/domain/orgs/${orgId}/register`, apiKey, { domain, years });
26
26
  }
27
27
 
28
- export async function importDomain(apiKey: string, payload: { domain: string; namecheap_api_user?: string; namecheap_api_key?: string; }): Promise<DomainRecord> {
29
- return request('POST', `${BASE_URL}/domain/import`, apiKey, payload);
28
+ export async function importDomain(apiKey: string, orgId: string, payload: { domain: string; namecheap_api_user?: string; namecheap_api_key?: string; }): Promise<DomainRecord> {
29
+ return request('POST', `${BASE_URL}/domain/orgs/${orgId}/import`, apiKey, payload);
30
30
  }
31
31
 
32
- export async function listDomains(apiKey: string): Promise<DomainRecord[]> {
33
- return request('GET', `${BASE_URL}/domain/list/me`, apiKey);
32
+ export async function listDomains(apiKey: string, orgId: string, filter?: 'all' | 'unassigned' | 'org'): Promise<DomainRecord[]> {
33
+ const query = filter ? `?filter=${filter}` : '';
34
+ return request('GET', `${BASE_URL}/domain/orgs/${orgId}/list${query}`, apiKey);
34
35
  }
35
36
 
36
- export async function getDomainStatus(apiKey: string, domain: string): Promise<DomainRecord> {
37
- return request('GET', `${BASE_URL}/domain/status/${encodeURIComponent(domain)}`, apiKey);
37
+ export async function getDomainStatus(apiKey: string, orgId: string, domain: string): Promise<DomainRecord> {
38
+ return request('GET', `${BASE_URL}/domain/orgs/${orgId}/${encodeURIComponent(domain)}/status`, apiKey);
38
39
  }
39
40
 
40
- export async function renewDomain(apiKey: string, domain: string, years?: number): Promise<DomainRecord> {
41
- return request('POST', `${BASE_URL}/domain/renew/${encodeURIComponent(domain)}`, apiKey, { years });
41
+ export async function renewDomain(apiKey: string, orgId: string, domain: string, years?: number): Promise<DomainRecord> {
42
+ return request('POST', `${BASE_URL}/domain/orgs/${orgId}/${encodeURIComponent(domain)}/renew`, apiKey, { years });
42
43
  }
43
44
 
44
- export async function getDomainSettings(apiKey: string, domain: string): Promise<DomainSettings> {
45
- return request('GET', `${BASE_URL}/domain/settings/${encodeURIComponent(domain)}`, apiKey);
45
+ export async function assignDomain(apiKey: string, orgId: string, domain: string, targetOrgId: string): Promise<DomainRecord> {
46
+ return request('POST', `${BASE_URL}/domain/orgs/${orgId}/${encodeURIComponent(domain)}/assign`, apiKey, { org_id: targetOrgId });
46
47
  }
47
48
 
48
- export async function updateDomainSettings(apiKey: string, domain: string, payload: {
49
+ export async function getDomainSettings(apiKey: string, orgId: string, domain: string): Promise<DomainSettings> {
50
+ return request('GET', `${BASE_URL}/domain/orgs/${orgId}/${encodeURIComponent(domain)}/settings`, apiKey);
51
+ }
52
+
53
+ export async function updateDomainSettings(apiKey: string, orgId: string, domain: string, payload: {
49
54
  security_level?: 'essentially_off' | 'medium' | 'high' | 'under_attack';
50
55
  browser_check?: 'on' | 'off';
51
56
  purge_cache?: boolean;
52
57
  }): Promise<DomainSettings> {
53
- return request('POST', `${BASE_URL}/domain/settings/${encodeURIComponent(domain)}`, apiKey, payload);
58
+ return request('POST', `${BASE_URL}/domain/orgs/${orgId}/${encodeURIComponent(domain)}/settings`, apiKey, payload);
54
59
  }