natureco-sdk 1.0.0 → 1.0.2
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/index.js +7 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NatureCo JavaScript SDK
|
|
3
|
-
* @version 1.0.
|
|
3
|
+
* @version 1.0.2
|
|
4
4
|
* @description Official JavaScript SDK for NatureCo API
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -10,6 +10,11 @@ class NatureCoClient {
|
|
|
10
10
|
throw new Error('API key is required');
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
// Validate API key format (accept both nc_ and nco_ prefixes)
|
|
14
|
+
if (!apiKey.startsWith('nc_') && !apiKey.startsWith('nco_')) {
|
|
15
|
+
throw new Error('Invalid API key format. Key must start with nc_ or nco_');
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
this.apiKey = apiKey;
|
|
14
19
|
this.baseURL = options.baseURL || 'https://api.natureco.me/api/v1';
|
|
15
20
|
this.timeout = options.timeout || 30000;
|
|
@@ -100,7 +105,7 @@ class BotsModule {
|
|
|
100
105
|
if (systemPrompt) data.system_prompt = systemPrompt;
|
|
101
106
|
if (model) data.model = model;
|
|
102
107
|
|
|
103
|
-
return this.client.request('
|
|
108
|
+
return this.client.request('PUT', `/bots/${botId}`, data);
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
async delete(botId) {
|