@kadoa/node-sdk 0.3.0 → 0.5.0

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 CHANGED
@@ -16,15 +16,15 @@ pnpm add @kadoa/node-sdk
16
16
  ## Quick Start
17
17
 
18
18
  ```typescript
19
- import { initializeSdk, runExtraction } from '@kadoa/node-sdk';
19
+ import { KadoaClient } from '@kadoa/node-sdk';
20
20
 
21
- // Initialize the SDK
22
- const sdk = initializeSdk({
21
+ // Initialize the client
22
+ const client = new KadoaClient({
23
23
  apiKey: 'your-api-key'
24
24
  });
25
25
 
26
26
  // Run an extraction
27
- const result = await runExtraction(sdk, {
27
+ const result = await client.extraction.run({
28
28
  urls: ['https://example.com'],
29
29
  name: 'My Extraction Workflow'
30
30
  });
@@ -39,7 +39,7 @@ if (result) {
39
39
  ### Basic Configuration
40
40
 
41
41
  ```typescript
42
- const sdk = initializeSdk({
42
+ const client = new KadoaClient({
43
43
  apiKey: 'your-api-key',
44
44
  baseUrl: 'https://api.kadoa.com', // optional
45
45
  timeout: 30000 // optional, in ms
@@ -55,12 +55,12 @@ KADOA_TIMEOUT=30000
55
55
  ```
56
56
 
57
57
  ```typescript
58
- import { initializeSdk } from '@kadoa/node-sdk';
58
+ import { KadoaClient } from '@kadoa/node-sdk';
59
59
  import { config } from 'dotenv';
60
60
 
61
61
  config();
62
62
 
63
- const sdk = initializeSdk({
63
+ const client = new KadoaClient({
64
64
  apiKey: process.env.KADOA_API_KEY!,
65
65
  baseUrl: process.env.KADOA_API_URL,
66
66
  timeout: parseInt(process.env.KADOA_TIMEOUT || '30000')
@@ -70,10 +70,10 @@ const sdk = initializeSdk({
70
70
  ## Event Handling
71
71
 
72
72
  ```typescript
73
- const sdk = initializeSdk({ apiKey: 'your-api-key' });
73
+ const client = new KadoaClient({ apiKey: 'your-api-key' });
74
74
 
75
75
  // Listen to events
76
- sdk.onEvent((event) => {
76
+ client.onEvent((event) => {
77
77
  console.log('Event:', event);
78
78
  });
79
79
 
@@ -87,21 +87,18 @@ sdk.onEvent((event) => {
87
87
 
88
88
  ## API Reference
89
89
 
90
- ### initializeSdk(config)
90
+ ### new KadoaClient(config)
91
91
  - `apiKey` (required): Your Kadoa API key
92
- - `baseUrl` (optional): API base URL
93
- - `timeout` (optional): Request timeout in milliseconds
92
+ - `baseUrl` (optional): API base URL (default: 'https://api.kadoa.com')
93
+ - `timeout` (optional): Request timeout in milliseconds (default: 30000)
94
94
 
95
- Returns an SDK instance with:
96
- - `configuration`: Current configuration
97
- - `axiosInstance`: Configured HTTP client
95
+ Returns a client instance with:
96
+ - `extraction`: Extraction module with `run()` method
98
97
  - `onEvent()`: Subscribe to events
99
98
  - `offEvent()`: Unsubscribe from events
99
+ - `dispose()`: Releases resources and removes all event listeners
100
100
 
101
- ### dispose(sdk)
102
- Releases resources and removes all event listeners.
103
-
104
- ### runExtraction(sdk, options)
101
+ ### client.extraction.run(options)
105
102
  - `urls`: Array of URLs to extract from
106
103
  - `name`: Workflow name
107
104
  - Additional options available in API documentation