@spider-cloud/spider-client 0.0.13 → 0.0.15
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 +3 -1
- package/dist/spiderwebai.d.ts +2 -2
- package/dist/spiderwebai.js +3 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,9 @@ Before using the SDK, you will need to provide it with your API key. Obtain an A
|
|
|
25
25
|
Here's a basic example to demonstrate how to use the SDK:
|
|
26
26
|
|
|
27
27
|
```javascript
|
|
28
|
-
import
|
|
28
|
+
import pkg from '@spider-cloud/spider-client';
|
|
29
|
+
|
|
30
|
+
const { default: Spider } = pkg;
|
|
29
31
|
|
|
30
32
|
// Initialize the SDK with your API key
|
|
31
33
|
const app = new Spider({ apiKey: "YOUR_API_KEY" });
|
package/dist/spiderwebai.d.ts
CHANGED
|
@@ -8,14 +8,14 @@ export interface SpiderConfig {
|
|
|
8
8
|
/**
|
|
9
9
|
* A class to interact with the Spider API.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export default class Spider {
|
|
12
12
|
private apiKey?;
|
|
13
13
|
/**
|
|
14
14
|
* Create an instance of Spider.
|
|
15
15
|
* @param {string | null} apiKey - The API key used to authenticate to the Spider API. If null, attempts to source from environment variables.
|
|
16
16
|
* @throws Will throw an error if the API key is not provided.
|
|
17
17
|
*/
|
|
18
|
-
constructor(
|
|
18
|
+
constructor(props?: SpiderConfig);
|
|
19
19
|
/**
|
|
20
20
|
* Internal method to handle POST requests.
|
|
21
21
|
* @param {string} endpoint - The API endpoint to which the POST request should be sent.
|
package/dist/spiderwebai.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Spider = void 0;
|
|
4
3
|
/**
|
|
5
4
|
* A class to interact with the Spider API.
|
|
6
5
|
*/
|
|
@@ -10,8 +9,8 @@ class Spider {
|
|
|
10
9
|
* @param {string | null} apiKey - The API key used to authenticate to the Spider API. If null, attempts to source from environment variables.
|
|
11
10
|
* @throws Will throw an error if the API key is not provided.
|
|
12
11
|
*/
|
|
13
|
-
constructor(
|
|
14
|
-
this.apiKey = apiKey || process?.env?.SPIDER_API_KEY;
|
|
12
|
+
constructor(props) {
|
|
13
|
+
this.apiKey = props?.apiKey || process?.env?.SPIDER_API_KEY;
|
|
15
14
|
if (!this.apiKey) {
|
|
16
15
|
throw new Error("No API key provided");
|
|
17
16
|
}
|
|
@@ -149,4 +148,4 @@ class Spider {
|
|
|
149
148
|
throw new Error(`Failed to ${action}. Status code: ${response.status}.`);
|
|
150
149
|
}
|
|
151
150
|
}
|
|
152
|
-
exports.
|
|
151
|
+
exports.default = Spider;
|