docstron 1.0.0 → 1.0.1
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 +13 -13
- package/lib/Docstron.js +3 -10
- package/lib/constants.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,10 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
The official Node.js library for the [Docstron](https://docstron.com) PDF Generation API.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
> This is an early release focused on template operations. Document generation coming in v0.2.0!
|
|
10
|
-
|
|
11
|
-
## 📋 What's Included in v0.1.0
|
|
8
|
+
## 📋 What's Included
|
|
12
9
|
|
|
13
10
|
✅ **Template Management**
|
|
14
11
|
|
|
@@ -18,25 +15,28 @@ The official Node.js library for the [Docstron](https://docstron.com) PDF Genera
|
|
|
18
15
|
- Delete templates
|
|
19
16
|
- List all templates
|
|
20
17
|
|
|
21
|
-
🚧 **Coming Soon**
|
|
22
|
-
|
|
23
|
-
- v0.2.0: Document generation (PDF creation from templates)
|
|
24
|
-
- v0.3.0: Application management
|
|
25
|
-
- v1.0.0: Full feature set with comprehensive testing
|
|
26
|
-
|
|
27
18
|
## Installation
|
|
28
19
|
|
|
29
20
|
```bash
|
|
30
21
|
npm install docstron
|
|
31
22
|
```
|
|
32
23
|
|
|
24
|
+
## Configuration
|
|
25
|
+
|
|
26
|
+
Add your API key to your environment:
|
|
27
|
+
|
|
28
|
+
```env
|
|
29
|
+
DOCSTRON_API_KEY=your-api-key
|
|
30
|
+
DOCSTRON_BASE_URL=https://api.docstron.com/v1
|
|
31
|
+
```
|
|
32
|
+
|
|
33
33
|
## Quick Start
|
|
34
34
|
|
|
35
35
|
```javascript
|
|
36
36
|
const Docstron = require("docstron");
|
|
37
37
|
|
|
38
38
|
// Initialize the client
|
|
39
|
-
const client = new Docstron(
|
|
39
|
+
const client = new Docstron();
|
|
40
40
|
|
|
41
41
|
// Create a template
|
|
42
42
|
const template = await client.templates.create({
|
|
@@ -54,11 +54,11 @@ console.log("Template created:", template.template_id);
|
|
|
54
54
|
Get your API key from your [Docstron Dashboard](https://docstron.com/dashboard).
|
|
55
55
|
|
|
56
56
|
```javascript
|
|
57
|
-
const client = new Docstron(
|
|
57
|
+
const client = new Docstron();
|
|
58
58
|
|
|
59
59
|
// With custom options
|
|
60
60
|
const client = new Docstron("your-api-key-here", {
|
|
61
|
-
baseURL: "https://
|
|
61
|
+
baseURL: "https://api.docstron.com/v1",
|
|
62
62
|
});
|
|
63
63
|
```
|
|
64
64
|
|
package/lib/Docstron.js
CHANGED
|
@@ -2,7 +2,7 @@ const HttpClient = require('./utils/httpClient');
|
|
|
2
2
|
const Templates = require('./resources/Templates');
|
|
3
3
|
const Documents = require('./resources/Documents');
|
|
4
4
|
const Applications = require('./resources/Applications');
|
|
5
|
-
const { DEFAULT_BASE_URL } = require('./constants');
|
|
5
|
+
const { DEFAULT_BASE_URL, DEFAULT_API_KEY } = require('./constants');
|
|
6
6
|
|
|
7
7
|
class Docstron {
|
|
8
8
|
/**
|
|
@@ -11,23 +11,16 @@ class Docstron {
|
|
|
11
11
|
* @param {Object} [Options] - Configuration options
|
|
12
12
|
* @param {string} [Options.baseURL] - Custom base URL
|
|
13
13
|
*/
|
|
14
|
-
constructor(apiKey, options = {}) {
|
|
15
|
-
|
|
16
|
-
throw new Error('API key is required');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
this.apiKey = apiKey;
|
|
14
|
+
constructor(apiKey = null, options = {}) {
|
|
15
|
+
this.apiKey = apiKey || DEFAULT_API_KEY;
|
|
20
16
|
this.baseURL = options.baseURL || DEFAULT_BASE_URL;
|
|
21
17
|
|
|
22
18
|
const httpClient = new HttpClient(this.apiKey, this.baseURL);
|
|
23
19
|
|
|
24
|
-
// v0.1.0 - Templates Only
|
|
25
20
|
this.templates = new Templates(httpClient);
|
|
26
21
|
|
|
27
|
-
// v0.2.0 - Documents
|
|
28
22
|
this.documents = new Documents(httpClient);
|
|
29
23
|
|
|
30
|
-
// v0.3.0 - Applications
|
|
31
24
|
this.applications = new Applications(httpClient);
|
|
32
25
|
}
|
|
33
26
|
|
package/lib/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const DEFAULT_BASE_URL = 'https://api.docstron.com';
|
|
2
|
-
const
|
|
1
|
+
const DEFAULT_BASE_URL = process.env.DOCSTRON_BASE_URL || 'https://api.docstron.com/v1';
|
|
2
|
+
const DEFAULT_API_KEY = process.env.DOCSTRON_API_KEY || null;
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
5
5
|
DEFAULT_BASE_URL,
|
|
6
|
-
|
|
6
|
+
DEFAULT_API_KEY
|
|
7
7
|
};
|