@rqt/namecheap-web
Advanced tools
Comparing version 1.2.0 to 1.3.0
let rqt = require('rqt'); if (rqt && rqt.__esModule) rqt = rqt.default; | ||
const coupon = async (USER_AGENT) => { | ||
const s = await rqt('https://www.namecheap.com/promos/coupons/', { | ||
const coupon = async (USER_AGENT, sandbox) => { | ||
const h = sandbox ? 'sandbox.' : '' | ||
const s = await rqt(`https://www.${h}namecheap.com/promos/coupons/`, { | ||
headers: { | ||
@@ -6,0 +7,0 @@ 'User-Agent': USER_AGENT, |
@@ -57,2 +57,8 @@ const { debuglog } = require('util'); | ||
} | ||
/** | ||
* Return the coupon from the https://www.sandbox.namecheap.com/promos/coupons/ page. | ||
*/ | ||
static async SANDBOX_COUPON() { | ||
return coupon(USER_AGENT, true) | ||
} | ||
@@ -59,0 +65,0 @@ async auth(username, password, phone, force) { |
## 6 October 2018 | ||
### 1.3.0 | ||
- [feature] Retrieve sandbox coupon codes. | ||
### 1.2.0 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "@rqt/namecheap-web", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "An API to namecheap.com via the web interface, with an ability to log in using 2-factor Auth and check Whois.", | ||
@@ -5,0 +5,0 @@ "main": "build", |
@@ -25,2 +25,3 @@ [![namecheap](https://raw.githubusercontent.com/rqt/namecheap-web/HEAD/images/nc.gif)](https://nameexpensive.com) | ||
* [`async static COUPON(): string`](#async-static-coupon-string) | ||
* [`async static SANDBOX_COUPON(): string`](#async-static-sandbox_coupon-string) | ||
* [`async getWhitelistedIPList(username: string, password: string, phone?: string): WhitelistedIP[]`](#async-getwhitelistediplistusername-stringpassword-stringphone-string-whitelistedip) | ||
@@ -175,2 +176,25 @@ * [`WhitelistedIP`](#type-whitelistedip) | ||
### `async static SANDBOX_COUPON(): string` | ||
Returns this month's coupon from the https://www.sandbox.namecheap.com/promos/coupons/ page. | ||
```js | ||
/* yarn example/whois.js */ | ||
import NamecheapWeb from '@rqt/namecheap-web' | ||
(async () => { | ||
try { | ||
const res = await NamecheapWeb.SANDBOX_COUPON() | ||
console.log(res) | ||
} catch ({ message }) { | ||
console.error(message) | ||
} | ||
})() | ||
``` | ||
``` | ||
CAMPUSTLD | ||
``` | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/6.svg?sanitize=true" width="15"></a></p> | ||
### `async getWhitelistedIPList(`<br/> `username: string,`<br/> `password: string,`<br/> `phone?: string,`<br/>`): WhitelistedIP[]` | ||
@@ -188,3 +212,3 @@ | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/6.svg?sanitize=true" width="15"></a></p> | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/7.svg?sanitize=true" width="15"></a></p> | ||
@@ -195,3 +219,3 @@ ### `async whitelistIP(`<br/> `ip: string,`<br/> `name?: string,`<br/>`): void` | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/7.svg?sanitize=true" width="15"></a></p> | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/8.svg?sanitize=true" width="15"></a></p> | ||
@@ -202,3 +226,3 @@ ### `async removeWhitelistedIP(`<br/> `name: string,`<br/>`): void` | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/8.svg?sanitize=true"></a></p> | ||
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/9.svg?sanitize=true"></a></p> | ||
@@ -205,0 +229,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29405
559
231