humanizedtext 0.1.1 → 0.1.3
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 +29 -27
- package/index.js +9 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,16 +51,16 @@ const client = new HumanizedTextClient({
|
|
|
51
51
|
```js
|
|
52
52
|
const client = new HumanizedTextClient({
|
|
53
53
|
apiKey: "YOUR_API_KEY",
|
|
54
|
-
baseUrl: "https://
|
|
54
|
+
baseUrl: "https://humanizedtext.pro/api/v1",
|
|
55
55
|
timeout: 60000,
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
| Option
|
|
60
|
-
|
|
61
|
-
| `apiKey`
|
|
62
|
-
| `baseUrl` | `string` | No
|
|
63
|
-
| `timeout` | `number` | No
|
|
59
|
+
| Option | Type | Required | Default | Description |
|
|
60
|
+
| --------- | -------- | -------- | -------------------------------------- | ------------------------------- |
|
|
61
|
+
| `apiKey` | `string` | Yes | - | HumanizedText API key |
|
|
62
|
+
| `baseUrl` | `string` | No | `https://humanizedtext.pro/api/v1` | API base URL |
|
|
63
|
+
| `timeout` | `number` | No | `60000` | Request timeout in milliseconds |
|
|
64
64
|
|
|
65
65
|
## API Methods
|
|
66
66
|
|
|
@@ -77,12 +77,12 @@ const res = await client.humanize({
|
|
|
77
77
|
});
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
| Param
|
|
81
|
-
|
|
82
|
-
| `text`
|
|
83
|
-
| `tone`
|
|
84
|
-
| `ultraHumanize` | `boolean`
|
|
85
|
-
| `keywords`
|
|
80
|
+
| Param | Type | Required | Default | Notes |
|
|
81
|
+
| --------------- | ------------------ | -------- | ------- | -------------------------------------------------------- |
|
|
82
|
+
| `text` | `string` | Yes | - | Must be `1..6000` characters |
|
|
83
|
+
| `tone` | `string \| null` | No | `null` | Example: `professional`, `casual`, `friendly`, `default` |
|
|
84
|
+
| `ultraHumanize` | `boolean` | No | `false` | Uses ultra quota per request when `true` |
|
|
85
|
+
| `keywords` | `string[] \| null` | No | `null` | Plan-limited count per request |
|
|
86
86
|
|
|
87
87
|
### 2) `grammarFixer(params)`
|
|
88
88
|
|
|
@@ -92,9 +92,9 @@ Fixes grammar while preserving meaning.
|
|
|
92
92
|
const res = await client.grammarFixer({ text: "this are a sentence." });
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
| Param
|
|
96
|
-
|
|
97
|
-
| `text` | `string` | Yes
|
|
95
|
+
| Param | Type | Required | Notes |
|
|
96
|
+
| ------ | -------- | -------- | ---------------------------- |
|
|
97
|
+
| `text` | `string` | Yes | Must be `1..6000` characters |
|
|
98
98
|
|
|
99
99
|
### 3) `contentRewriter(params)`
|
|
100
100
|
|
|
@@ -106,21 +106,23 @@ const res = await client.contentRewriter({
|
|
|
106
106
|
});
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
| Param
|
|
110
|
-
|
|
111
|
-
| `text` | `string` | Yes
|
|
109
|
+
| Param | Type | Required | Notes |
|
|
110
|
+
| ------ | -------- | -------- | ---------------------------- |
|
|
111
|
+
| `text` | `string` | Yes | Must be `1..6000` characters |
|
|
112
112
|
|
|
113
113
|
### 4) `seoBlogWriter(params)`
|
|
114
114
|
|
|
115
115
|
Generates SEO-focused blog content from a topic.
|
|
116
116
|
|
|
117
117
|
```js
|
|
118
|
-
const res = await client.seoBlogWriter({
|
|
118
|
+
const res = await client.seoBlogWriter({
|
|
119
|
+
topic: "Best CRM tools for startups",
|
|
120
|
+
});
|
|
119
121
|
```
|
|
120
122
|
|
|
121
|
-
| Param
|
|
122
|
-
|
|
123
|
-
| `topic` | `string` | Yes
|
|
123
|
+
| Param | Type | Required | Notes |
|
|
124
|
+
| ------- | -------- | -------- | --------------------------- |
|
|
125
|
+
| `topic` | `string` | Yes | Must be `1..500` characters |
|
|
124
126
|
|
|
125
127
|
## Response Examples
|
|
126
128
|
|
|
@@ -190,11 +192,11 @@ try {
|
|
|
190
192
|
|
|
191
193
|
`HumanizedTextAPIError` fields:
|
|
192
194
|
|
|
193
|
-
| Field
|
|
194
|
-
|
|
195
|
-
| `message`
|
|
196
|
-
| `statusCode` | `number \| undefined` | HTTP status code
|
|
197
|
-
| `payload`
|
|
195
|
+
| Field | Type | Description |
|
|
196
|
+
| ------------ | --------------------- | ---------------------- |
|
|
197
|
+
| `message` | `string` | Error detail string |
|
|
198
|
+
| `statusCode` | `number \| undefined` | HTTP status code |
|
|
199
|
+
| `payload` | `unknown` | Raw parsed API payload |
|
|
198
200
|
|
|
199
201
|
## Edge Cases and Limits
|
|
200
202
|
|
package/index.js
CHANGED
|
@@ -10,14 +10,21 @@ class HumanizedTextAPIError extends Error {
|
|
|
10
10
|
class HumanizedTextClient {
|
|
11
11
|
constructor({
|
|
12
12
|
apiKey,
|
|
13
|
-
baseUrl
|
|
13
|
+
baseUrl,
|
|
14
14
|
timeout = 60000,
|
|
15
15
|
}) {
|
|
16
16
|
if (!apiKey) {
|
|
17
17
|
throw new Error("apiKey is required");
|
|
18
18
|
}
|
|
19
|
+
const isDev = typeof process !== "undefined" && (
|
|
20
|
+
process.env.NODE_ENV === "development" ||
|
|
21
|
+
process.env.NODE_ENV === "test" ||
|
|
22
|
+
process.env.HUMANIZEDTEXT_DEV === "true" ||
|
|
23
|
+
process.env.LOCAL_DEV === "true"
|
|
24
|
+
);
|
|
25
|
+
const defaultUrl = isDev ? "http://localhost:3000/api/v1" : "https://humanizedtext.pro/api/v1";
|
|
19
26
|
this.apiKey = apiKey;
|
|
20
|
-
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
27
|
+
this.baseUrl = (baseUrl || defaultUrl).replace(/\/$/, "");
|
|
21
28
|
this.timeout = timeout;
|
|
22
29
|
}
|
|
23
30
|
|