namecheap-ts 1.0.2 → 1.0.4
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 +101 -9
- package/dist/index.d.mts +116 -12
- package/dist/index.d.ts +125 -2
- package/dist/index.js +358 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +214 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/dist/api/api-client.d.ts +0 -8
- package/dist/api/api-client.js +0 -51
- package/dist/api/errors.d.ts +0 -7
- package/dist/api/errors.js +0 -18
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -8
- package/dist/commands.d.ts +0 -62
- package/dist/commands.js +0 -73
- package/dist/exceptions/InvalidDomainNameException.d.ts +0 -3
- package/dist/exceptions/InvalidDomainNameException.js +0 -10
- package/dist/exceptions/InvalidTLDException.d.ts +0 -3
- package/dist/exceptions/InvalidTLDException.js +0 -10
- package/dist/exceptions/index.d.ts +0 -1
- package/dist/exceptions/index.js +0 -17
- package/dist/namecheap.d.ts +0 -25
- package/dist/namecheap.js +0 -64
- package/dist/types.d.ts +0 -7
- package/dist/types.js +0 -10
package/README.md
CHANGED
|
@@ -2,21 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
A TypeScript package that provides a simple and intuitive interface to interact with Namecheap API.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
You can install the package using npm. Run the following command in your terminal:
|
|
6
8
|
|
|
7
9
|
```shell
|
|
8
10
|
npm install namecheap-ts
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
You can use the package to perform various operations such as domain registration, DNS management, SSL certificate management, and more. Here's an example of how to use the package to check whether the domain name is available or not:
|
|
12
16
|
|
|
13
17
|
```typescript
|
|
14
18
|
import Namecheap, { INamecheapConfig } from "namecheap-ts";
|
|
15
19
|
const config: INamecheapConfig = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
apiKey: "api-key",
|
|
21
|
+
apiUser: "api-user",
|
|
22
|
+
username: "user-name",
|
|
23
|
+
clientIp: "client-ip",
|
|
20
24
|
};
|
|
21
25
|
|
|
22
26
|
const api = new Namecheap(config, true);
|
|
@@ -24,14 +28,102 @@ const api = new Namecheap(config, true);
|
|
|
24
28
|
const payload = { DomainList: "mezoishere.net" };
|
|
25
29
|
const { data } = await api.call("namecheap.domains.check", payload);
|
|
26
30
|
|
|
27
|
-
const isAvailabe = data
|
|
31
|
+
const isAvailabe = data.DomainCheckResult.$.Available;
|
|
28
32
|
console.log(isAvailable);
|
|
29
33
|
```
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
## API
|
|
36
|
+
|
|
37
|
+
The `Namecheap` class is the main entry point for interacting with the Namecheap API.
|
|
38
|
+
|
|
39
|
+
#### `constructor(config: INamecheapConfig, sandbox?: boolean)`
|
|
40
|
+
|
|
41
|
+
Create a new instance of the `Namecheap` class.
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
const namecheap = new Namecheap(config, true);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### `call(command: Command, payload: Payload): Promise<IReponse>`
|
|
48
|
+
|
|
49
|
+
Call a command on the Namecheap API.
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { Commands } from "namecheap-ts";
|
|
53
|
+
const response = await namecheap.call(Commands.DOMAINS_CHECK, {
|
|
54
|
+
DomainList: "example.com",
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
console.log(response);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### `checkDomain(domainName: string): Promise<ICheckDomainResponse>`
|
|
61
|
+
|
|
62
|
+
Check if a domain is available and if it'is premium.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const { data } = await namecheap.checkDomain("example.com");
|
|
66
|
+
|
|
67
|
+
console.log({ availabe: data.availabe, premium: data.premium });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### `getDomainPrice(domainName: string, action: DomainPriceAction): Promise<IReponse>`
|
|
71
|
+
|
|
72
|
+
Get the prices list of a domain.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { DomainPriceAction } from "namecheap-ts";
|
|
76
|
+
const response = await namecheap.getDomainPrice(
|
|
77
|
+
"example.com",
|
|
78
|
+
DomainPriceAction.REGISTER
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
console.log(response);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### `registerDomain(payload: Payload): Promise<IRegisterDomainResponse>`
|
|
85
|
+
|
|
86
|
+
Register domain in namecheap.
|
|
32
87
|
|
|
33
88
|
```typescript
|
|
34
|
-
const
|
|
89
|
+
const payload = {
|
|
90
|
+
DomainName: "mezoishere.co",
|
|
91
|
+
Years: 2,
|
|
92
|
+
// ...etc other attributes
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const response = await namecheap.registerDomain(payload);
|
|
96
|
+
|
|
97
|
+
console.log(response);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### `addFundsRequest(payload: AddFundsRequestPayload): Promise<IAddFundsRequestResponse>`
|
|
101
|
+
|
|
102
|
+
Add funds to the user account.
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
const payload = {
|
|
106
|
+
username: "username",
|
|
107
|
+
paymentType: "creditcard",
|
|
108
|
+
amount: 10,
|
|
109
|
+
returnURL: "the return url after payment is done",
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const response = await namecheap.addFundsRequest(payload);
|
|
113
|
+
|
|
114
|
+
console.log(response);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### `getFundsStatus(tokenId: string): Promise<IGetFundsStatusResponse>`
|
|
118
|
+
|
|
119
|
+
Check the status of a specific funds request.
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
const tokenId = "the-token-id-of-the-created-funds-request"
|
|
123
|
+
|
|
124
|
+
const response = await namecheap.getFundsStatus(tokentId);
|
|
125
|
+
|
|
126
|
+
console.log(response);
|
|
35
127
|
```
|
|
36
128
|
|
|
37
129
|
You can refer to the official Namecheap API documentation for more information on the available methods and parameters. [The documentation is available at ¹](https://www.namecheap.com/support/api/intro/).
|
package/dist/index.d.mts
CHANGED
|
@@ -1,21 +1,125 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
declare enum Commands {
|
|
2
|
+
DOMAINS_GETLIST = "namecheap.domains.getList",
|
|
3
|
+
DOMAINS_GETCONTACTS = "namecheap.domains.getContacts",
|
|
4
|
+
DOMAINS_CREATE = "namecheap.domains.create",
|
|
5
|
+
DOMAINS_GETTLDLIST = "namecheap.domains.getTldList",
|
|
6
|
+
DOMAINS_SETCONTACTS = "namecheap.domains.setContacts",
|
|
7
|
+
DOMAINS_CHECK = "namecheap.domains.check",
|
|
8
|
+
DOMAINS_REACTIVATE = "namecheap.domains.reactivate",
|
|
9
|
+
DOMAINS_RENEW = "namecheap.domains.renew",
|
|
10
|
+
DOMAINS_GETREGISTRARLOCK = "namecheap.domains.getRegistrarLock",
|
|
11
|
+
DOMAINS_SETREGISTRARLOCK = "namecheap.domains.setRegistrarLock",
|
|
12
|
+
DOMAINS_GETINFO = "namecheap.domains.getInfo",
|
|
13
|
+
DOMAINS_DNS_SETDEFAULT = "namecheap.domains.dns.setDefault",
|
|
14
|
+
DOMAINS_DNS_SETCUSTOM = "namecheap.domains.dns.setCustom",
|
|
15
|
+
DOMAINS_DNS_GETLIST = "namecheap.domains.dns.getList",
|
|
16
|
+
DOMAINS_DNS_GETHOSTS = "namecheap.domains.dns.getHosts",
|
|
17
|
+
DOMAINS_DNS_GETEMAILFORWARDING = "namecheap.domains.dns.getEmailForwarding",
|
|
18
|
+
DOMAINS_DNS_SETEMAILFORWARDING = "namecheap.domains.dns.setEmailForwarding",
|
|
19
|
+
DOMAINS_DNS_SETHOSTS = "namecheap.domains.dns.setHosts",
|
|
20
|
+
DOMAINS_NS_CREATE = "namecheap.domains.ns.create",
|
|
21
|
+
DOMAINS_NS_DELETE = "namecheap.domains.ns.delete",
|
|
22
|
+
DOMAINS_NS_GETINFO = "namecheap.domains.ns.getInfo",
|
|
23
|
+
DOMAINS_NS_UPDATE = "namecheap.domains.ns.update",
|
|
24
|
+
DOMAINS_TRANSFER_CREATE = "namecheap.domains.transfer.create",
|
|
25
|
+
DOMAINS_TRANSFER_GETSTATUS = "namecheap.domains.transfer.getStatus",
|
|
26
|
+
DOMAINS_TRANSFER_UPDATESTATUS = "namecheap.domains.transfer.updateStatus",
|
|
27
|
+
DOMAINS_TRANSFER_GETLIST = "namecheap.domains.transfer.getList",
|
|
28
|
+
SSL_CREATE = "namecheap.ssl.create",
|
|
29
|
+
SSL_GETLIST = "namecheap.ssl.getList",
|
|
30
|
+
SSL_PARSECSR = "namecheap.ssl.parseCSR",
|
|
31
|
+
SSL_GETAPPROVEREMAILLIST = "namecheap.ssl.getApproverEmailList",
|
|
32
|
+
SSL_ACTIVATE = "namecheap.ssl.activate",
|
|
33
|
+
SSL_RESENDAPPROVEREMAIL = "namecheap.ssl.resendApproverEmail",
|
|
34
|
+
SSL_GETINFO = "namecheap.ssl.getInfo",
|
|
35
|
+
SSL_RENEW = "namecheap.ssl.renew",
|
|
36
|
+
SSL_REISSUE = "namecheap.ssl.reissue",
|
|
37
|
+
SSL_RESENDFULFILLMENTEMAIL = "namecheap.ssl.resendfulfillmentemail",
|
|
38
|
+
SSL_PURCHASEMORESANS = "namecheap.ssl.purchasemoresans",
|
|
39
|
+
SSL_REVOKECERTIFICATE = "namecheap.ssl.revokecertificate",
|
|
40
|
+
SSL_EDITDCVMETHOD = "namecheap.ssl.editDCVMethod",
|
|
41
|
+
USERS_GETPRICING = "namecheap.users.getPricing",
|
|
42
|
+
USERS_GETBALANCES = "namecheap.users.getBalances",
|
|
43
|
+
USERS_CHANGEPASSWORD = "namecheap.users.changePassword",
|
|
44
|
+
USERS_UPDATE = "namecheap.users.update",
|
|
45
|
+
USERS_CREATEADDFUNDSREQUEST = "namecheap.users.createaddfundsrequest",
|
|
46
|
+
USERS_GETADDFUNDSSTATUS = "namecheap.users.getAddFundsStatus",
|
|
47
|
+
USERS_CREATE = "namecheap.users.create",
|
|
48
|
+
USERS_LOGIN = "namecheap.users.login",
|
|
49
|
+
USERS_RESETPASSWORD = "namecheap.users.resetPassword",
|
|
50
|
+
USERS_ADDRESS_CREATE = "namecheap.users.address.create",
|
|
51
|
+
USERS_ADDRESS_DELETE = "namecheap.users.address.delete",
|
|
52
|
+
USERS_ADDRESS_GETINFO = "namecheap.users.address.getInfo",
|
|
53
|
+
USERS_ADDRESS_GETLIST = "namecheap.users.address.getList",
|
|
54
|
+
USERS_ADDRESS_SETDEFAULT = "namecheap.users.address.setDefault",
|
|
55
|
+
USERS_ADDRESS_UPDATE = "namecheap.users.address.update",
|
|
56
|
+
WHOISGUARD_CHANGEEMAILADDRESS = "Namecheap.Whoisguard.changeemailaddress",
|
|
57
|
+
WHOISGUARD_ENABLE = "Namecheap.Whoisguard.enable",
|
|
58
|
+
WHOISGUARD_DISABLE = "Namecheap.Whoisguard.disable",
|
|
59
|
+
WHOISGUARD_GETLIST = "Namecheap.Whoisguard.getList",
|
|
60
|
+
WHOISGUARD_RENEW = "Namecheap.Whoisguard.renew"
|
|
9
61
|
}
|
|
10
|
-
|
|
11
|
-
|
|
62
|
+
type Command = `${Commands}`;
|
|
63
|
+
|
|
64
|
+
type Payload = Record<string, string | number>;
|
|
65
|
+
interface IReponse<T = any> {
|
|
66
|
+
data: T;
|
|
12
67
|
status: number;
|
|
13
68
|
}
|
|
69
|
+
type ICheckDomainResponse = IReponse<{
|
|
70
|
+
availabe: boolean;
|
|
71
|
+
premium: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
type IRegisterDomainResponse = IReponse<{
|
|
74
|
+
domain: string;
|
|
75
|
+
registered: boolean;
|
|
76
|
+
chargedAmount: number;
|
|
77
|
+
domainID: string;
|
|
78
|
+
orderID: string;
|
|
79
|
+
transactionID: string;
|
|
80
|
+
whoisguardEnable: boolean;
|
|
81
|
+
freePositiveSSL: boolean;
|
|
82
|
+
nonRealTimeDomain: boolean;
|
|
83
|
+
}>;
|
|
84
|
+
type IAddFundsRequestResponse = IReponse<{
|
|
85
|
+
tokenId: string;
|
|
86
|
+
returnURL: string;
|
|
87
|
+
redirectURL: string;
|
|
88
|
+
}>;
|
|
89
|
+
type IGetFundsStatusResponse = IReponse<{
|
|
90
|
+
status: string;
|
|
91
|
+
amount: number;
|
|
92
|
+
}>;
|
|
93
|
+
declare enum DomainPriceActions {
|
|
94
|
+
REGISTER = "REGISTER",
|
|
95
|
+
RENEW = "RENEW",
|
|
96
|
+
REACTIVATE = "REACTIVATE",
|
|
97
|
+
TRANSFER = "TRANSFER"
|
|
98
|
+
}
|
|
99
|
+
type DomainPriceAction = `${DomainPriceActions}`;
|
|
100
|
+
type AddFundsRequestPayload = {
|
|
101
|
+
username: string;
|
|
102
|
+
paymentType: "creditcard";
|
|
103
|
+
amount: number;
|
|
104
|
+
returnURL: string;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
interface INamecheapConfig {
|
|
108
|
+
apiUser: string;
|
|
109
|
+
apiKey: string;
|
|
110
|
+
username: string;
|
|
111
|
+
clientIp: string;
|
|
112
|
+
}
|
|
14
113
|
declare class Namecheap {
|
|
15
114
|
private readonly config;
|
|
16
115
|
private readonly apiClient;
|
|
17
116
|
constructor(config: INamecheapConfig, sandbox?: boolean);
|
|
18
|
-
call(command:
|
|
117
|
+
call(command: Command, payload: Payload): Promise<IReponse>;
|
|
118
|
+
checkDomain(domainName: string): Promise<ICheckDomainResponse>;
|
|
119
|
+
getDomainPrice(domainName: string, action: DomainPriceAction): Promise<IReponse<object[]>>;
|
|
120
|
+
registerDomain(payload: Payload): Promise<IRegisterDomainResponse>;
|
|
121
|
+
addFundsRequest(payload: AddFundsRequestPayload): Promise<IAddFundsRequestResponse>;
|
|
122
|
+
getFundsStatus(tokenId: string): Promise<IGetFundsStatusResponse>;
|
|
19
123
|
}
|
|
20
124
|
|
|
21
|
-
export {
|
|
125
|
+
export { AddFundsRequestPayload, Command, Commands, DomainPriceAction, DomainPriceActions, IAddFundsRequestResponse, ICheckDomainResponse, IGetFundsStatusResponse, INamecheapConfig, IRegisterDomainResponse, IReponse, Payload, Namecheap as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare enum Commands {
|
|
2
|
+
DOMAINS_GETLIST = "namecheap.domains.getList",
|
|
3
|
+
DOMAINS_GETCONTACTS = "namecheap.domains.getContacts",
|
|
4
|
+
DOMAINS_CREATE = "namecheap.domains.create",
|
|
5
|
+
DOMAINS_GETTLDLIST = "namecheap.domains.getTldList",
|
|
6
|
+
DOMAINS_SETCONTACTS = "namecheap.domains.setContacts",
|
|
7
|
+
DOMAINS_CHECK = "namecheap.domains.check",
|
|
8
|
+
DOMAINS_REACTIVATE = "namecheap.domains.reactivate",
|
|
9
|
+
DOMAINS_RENEW = "namecheap.domains.renew",
|
|
10
|
+
DOMAINS_GETREGISTRARLOCK = "namecheap.domains.getRegistrarLock",
|
|
11
|
+
DOMAINS_SETREGISTRARLOCK = "namecheap.domains.setRegistrarLock",
|
|
12
|
+
DOMAINS_GETINFO = "namecheap.domains.getInfo",
|
|
13
|
+
DOMAINS_DNS_SETDEFAULT = "namecheap.domains.dns.setDefault",
|
|
14
|
+
DOMAINS_DNS_SETCUSTOM = "namecheap.domains.dns.setCustom",
|
|
15
|
+
DOMAINS_DNS_GETLIST = "namecheap.domains.dns.getList",
|
|
16
|
+
DOMAINS_DNS_GETHOSTS = "namecheap.domains.dns.getHosts",
|
|
17
|
+
DOMAINS_DNS_GETEMAILFORWARDING = "namecheap.domains.dns.getEmailForwarding",
|
|
18
|
+
DOMAINS_DNS_SETEMAILFORWARDING = "namecheap.domains.dns.setEmailForwarding",
|
|
19
|
+
DOMAINS_DNS_SETHOSTS = "namecheap.domains.dns.setHosts",
|
|
20
|
+
DOMAINS_NS_CREATE = "namecheap.domains.ns.create",
|
|
21
|
+
DOMAINS_NS_DELETE = "namecheap.domains.ns.delete",
|
|
22
|
+
DOMAINS_NS_GETINFO = "namecheap.domains.ns.getInfo",
|
|
23
|
+
DOMAINS_NS_UPDATE = "namecheap.domains.ns.update",
|
|
24
|
+
DOMAINS_TRANSFER_CREATE = "namecheap.domains.transfer.create",
|
|
25
|
+
DOMAINS_TRANSFER_GETSTATUS = "namecheap.domains.transfer.getStatus",
|
|
26
|
+
DOMAINS_TRANSFER_UPDATESTATUS = "namecheap.domains.transfer.updateStatus",
|
|
27
|
+
DOMAINS_TRANSFER_GETLIST = "namecheap.domains.transfer.getList",
|
|
28
|
+
SSL_CREATE = "namecheap.ssl.create",
|
|
29
|
+
SSL_GETLIST = "namecheap.ssl.getList",
|
|
30
|
+
SSL_PARSECSR = "namecheap.ssl.parseCSR",
|
|
31
|
+
SSL_GETAPPROVEREMAILLIST = "namecheap.ssl.getApproverEmailList",
|
|
32
|
+
SSL_ACTIVATE = "namecheap.ssl.activate",
|
|
33
|
+
SSL_RESENDAPPROVEREMAIL = "namecheap.ssl.resendApproverEmail",
|
|
34
|
+
SSL_GETINFO = "namecheap.ssl.getInfo",
|
|
35
|
+
SSL_RENEW = "namecheap.ssl.renew",
|
|
36
|
+
SSL_REISSUE = "namecheap.ssl.reissue",
|
|
37
|
+
SSL_RESENDFULFILLMENTEMAIL = "namecheap.ssl.resendfulfillmentemail",
|
|
38
|
+
SSL_PURCHASEMORESANS = "namecheap.ssl.purchasemoresans",
|
|
39
|
+
SSL_REVOKECERTIFICATE = "namecheap.ssl.revokecertificate",
|
|
40
|
+
SSL_EDITDCVMETHOD = "namecheap.ssl.editDCVMethod",
|
|
41
|
+
USERS_GETPRICING = "namecheap.users.getPricing",
|
|
42
|
+
USERS_GETBALANCES = "namecheap.users.getBalances",
|
|
43
|
+
USERS_CHANGEPASSWORD = "namecheap.users.changePassword",
|
|
44
|
+
USERS_UPDATE = "namecheap.users.update",
|
|
45
|
+
USERS_CREATEADDFUNDSREQUEST = "namecheap.users.createaddfundsrequest",
|
|
46
|
+
USERS_GETADDFUNDSSTATUS = "namecheap.users.getAddFundsStatus",
|
|
47
|
+
USERS_CREATE = "namecheap.users.create",
|
|
48
|
+
USERS_LOGIN = "namecheap.users.login",
|
|
49
|
+
USERS_RESETPASSWORD = "namecheap.users.resetPassword",
|
|
50
|
+
USERS_ADDRESS_CREATE = "namecheap.users.address.create",
|
|
51
|
+
USERS_ADDRESS_DELETE = "namecheap.users.address.delete",
|
|
52
|
+
USERS_ADDRESS_GETINFO = "namecheap.users.address.getInfo",
|
|
53
|
+
USERS_ADDRESS_GETLIST = "namecheap.users.address.getList",
|
|
54
|
+
USERS_ADDRESS_SETDEFAULT = "namecheap.users.address.setDefault",
|
|
55
|
+
USERS_ADDRESS_UPDATE = "namecheap.users.address.update",
|
|
56
|
+
WHOISGUARD_CHANGEEMAILADDRESS = "Namecheap.Whoisguard.changeemailaddress",
|
|
57
|
+
WHOISGUARD_ENABLE = "Namecheap.Whoisguard.enable",
|
|
58
|
+
WHOISGUARD_DISABLE = "Namecheap.Whoisguard.disable",
|
|
59
|
+
WHOISGUARD_GETLIST = "Namecheap.Whoisguard.getList",
|
|
60
|
+
WHOISGUARD_RENEW = "Namecheap.Whoisguard.renew"
|
|
61
|
+
}
|
|
62
|
+
type Command = `${Commands}`;
|
|
63
|
+
|
|
64
|
+
type Payload = Record<string, string | number>;
|
|
65
|
+
interface IReponse<T = any> {
|
|
66
|
+
data: T;
|
|
67
|
+
status: number;
|
|
68
|
+
}
|
|
69
|
+
type ICheckDomainResponse = IReponse<{
|
|
70
|
+
availabe: boolean;
|
|
71
|
+
premium: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
type IRegisterDomainResponse = IReponse<{
|
|
74
|
+
domain: string;
|
|
75
|
+
registered: boolean;
|
|
76
|
+
chargedAmount: number;
|
|
77
|
+
domainID: string;
|
|
78
|
+
orderID: string;
|
|
79
|
+
transactionID: string;
|
|
80
|
+
whoisguardEnable: boolean;
|
|
81
|
+
freePositiveSSL: boolean;
|
|
82
|
+
nonRealTimeDomain: boolean;
|
|
83
|
+
}>;
|
|
84
|
+
type IAddFundsRequestResponse = IReponse<{
|
|
85
|
+
tokenId: string;
|
|
86
|
+
returnURL: string;
|
|
87
|
+
redirectURL: string;
|
|
88
|
+
}>;
|
|
89
|
+
type IGetFundsStatusResponse = IReponse<{
|
|
90
|
+
status: string;
|
|
91
|
+
amount: number;
|
|
92
|
+
}>;
|
|
93
|
+
declare enum DomainPriceActions {
|
|
94
|
+
REGISTER = "REGISTER",
|
|
95
|
+
RENEW = "RENEW",
|
|
96
|
+
REACTIVATE = "REACTIVATE",
|
|
97
|
+
TRANSFER = "TRANSFER"
|
|
98
|
+
}
|
|
99
|
+
type DomainPriceAction = `${DomainPriceActions}`;
|
|
100
|
+
type AddFundsRequestPayload = {
|
|
101
|
+
username: string;
|
|
102
|
+
paymentType: "creditcard";
|
|
103
|
+
amount: number;
|
|
104
|
+
returnURL: string;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
interface INamecheapConfig {
|
|
108
|
+
apiUser: string;
|
|
109
|
+
apiKey: string;
|
|
110
|
+
username: string;
|
|
111
|
+
clientIp: string;
|
|
112
|
+
}
|
|
113
|
+
declare class Namecheap {
|
|
114
|
+
private readonly config;
|
|
115
|
+
private readonly apiClient;
|
|
116
|
+
constructor(config: INamecheapConfig, sandbox?: boolean);
|
|
117
|
+
call(command: Command, payload: Payload): Promise<IReponse>;
|
|
118
|
+
checkDomain(domainName: string): Promise<ICheckDomainResponse>;
|
|
119
|
+
getDomainPrice(domainName: string, action: DomainPriceAction): Promise<IReponse<object[]>>;
|
|
120
|
+
registerDomain(payload: Payload): Promise<IRegisterDomainResponse>;
|
|
121
|
+
addFundsRequest(payload: AddFundsRequestPayload): Promise<IAddFundsRequestResponse>;
|
|
122
|
+
getFundsStatus(tokenId: string): Promise<IGetFundsStatusResponse>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { AddFundsRequestPayload, Command, Commands, DomainPriceAction, DomainPriceActions, IAddFundsRequestResponse, ICheckDomainResponse, IGetFundsStatusResponse, INamecheapConfig, IRegisterDomainResponse, IReponse, Payload, Namecheap as default };
|