@toothfairyai/cli 1.4.0 → 1.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/bin/toothfairy.js +4012 -0
- package/package.json +1 -1
- package/src/api.js +563 -0
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -2105,6 +2105,569 @@ class ToothFairyAPI {
|
|
|
2105
2105
|
throw error;
|
|
2106
2106
|
}
|
|
2107
2107
|
}
|
|
2108
|
+
|
|
2109
|
+
// Agent Management Methods
|
|
2110
|
+
|
|
2111
|
+
/**
|
|
2112
|
+
* Create a new agent
|
|
2113
|
+
*
|
|
2114
|
+
* @param {Object} agentData - Agent configuration
|
|
2115
|
+
* @param {string} agentData.label - Agent display name (required)
|
|
2116
|
+
* @param {string} agentData.mode - Agent mode: retriever, coder, chatter, planner, computer, voice (required)
|
|
2117
|
+
* @param {string} agentData.interpolationString - System prompt template (required)
|
|
2118
|
+
* @param {string} agentData.goals - Primary objectives (required)
|
|
2119
|
+
* @param {number} agentData.temperature - Response creativity level (required)
|
|
2120
|
+
* @param {number} agentData.maxTokens - Maximum tokens in response (required)
|
|
2121
|
+
* @param {number} agentData.maxHistory - Maximum conversation history (required)
|
|
2122
|
+
* @param {number} agentData.topK - Number of top results for retrieval (required)
|
|
2123
|
+
* @param {number} agentData.docTopK - Number of top documents to retrieve (required)
|
|
2124
|
+
* @returns {Promise<Object>} Created agent data
|
|
2125
|
+
*/
|
|
2126
|
+
async createAgent(agentData) {
|
|
2127
|
+
try {
|
|
2128
|
+
return await this._makeRequest('POST', 'agent/create', agentData);
|
|
2129
|
+
} catch (error) {
|
|
2130
|
+
console.error(`Error creating agent: ${error.message}`);
|
|
2131
|
+
throw error;
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
/**
|
|
2136
|
+
* Get a specific agent by ID
|
|
2137
|
+
*
|
|
2138
|
+
* @param {string} agentId - Agent ID to retrieve
|
|
2139
|
+
* @returns {Promise<Object>} Agent data
|
|
2140
|
+
*/
|
|
2141
|
+
async getAgent(agentId) {
|
|
2142
|
+
try {
|
|
2143
|
+
return await this._makeRequest('GET', `agent/get/${agentId}`);
|
|
2144
|
+
} catch (error) {
|
|
2145
|
+
console.error(`Error getting agent: ${error.message}`);
|
|
2146
|
+
throw error;
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
|
|
2150
|
+
/**
|
|
2151
|
+
* List all agents in the workspace
|
|
2152
|
+
*
|
|
2153
|
+
* @param {number} limit - Maximum number of agents to return (optional)
|
|
2154
|
+
* @param {number} offset - Number of agents to skip (optional)
|
|
2155
|
+
* @returns {Promise<Object>} List of agents
|
|
2156
|
+
*/
|
|
2157
|
+
async listAgents(limit = null, offset = null) {
|
|
2158
|
+
try {
|
|
2159
|
+
const params = { workspaceid: this.workspaceId };
|
|
2160
|
+
if (limit) params.limit = limit;
|
|
2161
|
+
if (offset) params.offset = offset;
|
|
2162
|
+
return await this._makeRequest('GET', 'agent/list', params);
|
|
2163
|
+
} catch (error) {
|
|
2164
|
+
console.error(`Error listing agents: ${error.message}`);
|
|
2165
|
+
throw error;
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
/**
|
|
2170
|
+
* Update an existing agent
|
|
2171
|
+
*
|
|
2172
|
+
* @param {string} agentId - Agent ID to update
|
|
2173
|
+
* @param {Object} fields - Fields to update
|
|
2174
|
+
* @returns {Promise<Object>} Updated agent data
|
|
2175
|
+
*/
|
|
2176
|
+
async updateAgent(agentId, fields) {
|
|
2177
|
+
try {
|
|
2178
|
+
const updateData = {
|
|
2179
|
+
id: agentId,
|
|
2180
|
+
...fields,
|
|
2181
|
+
};
|
|
2182
|
+
return await this._makeRequest('POST', `agent/update/${agentId}`, updateData);
|
|
2183
|
+
} catch (error) {
|
|
2184
|
+
console.error(`Error updating agent: ${error.message}`);
|
|
2185
|
+
throw error;
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
/**
|
|
2190
|
+
* Delete an agent
|
|
2191
|
+
*
|
|
2192
|
+
* @param {string} agentId - Agent ID to delete
|
|
2193
|
+
* @returns {Promise<Object>} Deletion result
|
|
2194
|
+
*/
|
|
2195
|
+
async deleteAgent(agentId) {
|
|
2196
|
+
try {
|
|
2197
|
+
return await this._makeRequest('DELETE', `agent/delete/${agentId}`);
|
|
2198
|
+
} catch (error) {
|
|
2199
|
+
console.error(`Error deleting agent: ${error.message}`);
|
|
2200
|
+
throw error;
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
// Authorization Management Methods
|
|
2205
|
+
|
|
2206
|
+
/**
|
|
2207
|
+
* Create a new authorization
|
|
2208
|
+
*
|
|
2209
|
+
* @param {Object} authData - Authorization configuration
|
|
2210
|
+
* @returns {Promise<Object>} Created authorization data
|
|
2211
|
+
*/
|
|
2212
|
+
async createAuthorization(authData) {
|
|
2213
|
+
try {
|
|
2214
|
+
return await this._makeRequest('POST', 'authorisation/create', authData);
|
|
2215
|
+
} catch (error) {
|
|
2216
|
+
console.error(`Error creating authorization: ${error.message}`);
|
|
2217
|
+
throw error;
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
/**
|
|
2222
|
+
* Get a specific authorization by ID
|
|
2223
|
+
*
|
|
2224
|
+
* @param {string} authId - Authorization ID to retrieve
|
|
2225
|
+
* @returns {Promise<Object>} Authorization data
|
|
2226
|
+
*/
|
|
2227
|
+
async getAuthorization(authId) {
|
|
2228
|
+
try {
|
|
2229
|
+
return await this._makeRequest('GET', `authorisation/get/${authId}`);
|
|
2230
|
+
} catch (error) {
|
|
2231
|
+
console.error(`Error getting authorization: ${error.message}`);
|
|
2232
|
+
throw error;
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* List all authorizations in the workspace
|
|
2238
|
+
*
|
|
2239
|
+
* @param {number} limit - Maximum number of authorizations to return (optional)
|
|
2240
|
+
* @param {number} offset - Number of authorizations to skip (optional)
|
|
2241
|
+
* @returns {Promise<Object>} List of authorizations
|
|
2242
|
+
*/
|
|
2243
|
+
async listAuthorizations(limit = null, offset = null) {
|
|
2244
|
+
try {
|
|
2245
|
+
const params = { workspaceid: this.workspaceId };
|
|
2246
|
+
if (limit) params.limit = limit;
|
|
2247
|
+
if (offset) params.offset = offset;
|
|
2248
|
+
return await this._makeRequest('GET', 'authorisation/list', params);
|
|
2249
|
+
} catch (error) {
|
|
2250
|
+
console.error(`Error listing authorizations: ${error.message}`);
|
|
2251
|
+
throw error;
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
/**
|
|
2256
|
+
* Update an existing authorization
|
|
2257
|
+
*
|
|
2258
|
+
* @param {Object} fields - Fields to update
|
|
2259
|
+
* @returns {Promise<Object>} Updated authorization data
|
|
2260
|
+
*/
|
|
2261
|
+
async updateAuthorization(fields) {
|
|
2262
|
+
try {
|
|
2263
|
+
return await this._makeRequest('POST', 'authorisation/update', fields);
|
|
2264
|
+
} catch (error) {
|
|
2265
|
+
console.error(`Error updating authorization: ${error.message}`);
|
|
2266
|
+
throw error;
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
/**
|
|
2271
|
+
* Delete an authorization
|
|
2272
|
+
*
|
|
2273
|
+
* @param {string} authId - Authorization ID to delete
|
|
2274
|
+
* @returns {Promise<Object>} Deletion result
|
|
2275
|
+
*/
|
|
2276
|
+
async deleteAuthorization(authId) {
|
|
2277
|
+
try {
|
|
2278
|
+
return await this._makeRequest('DELETE', `authorisation/delete/${authId}`);
|
|
2279
|
+
} catch (error) {
|
|
2280
|
+
console.error(`Error deleting authorization: ${error.message}`);
|
|
2281
|
+
throw error;
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
// Benchmark Management Methods
|
|
2286
|
+
|
|
2287
|
+
/**
|
|
2288
|
+
* Create a new benchmark
|
|
2289
|
+
*
|
|
2290
|
+
* @param {Object} benchmarkData - Benchmark configuration
|
|
2291
|
+
* @returns {Promise<Object>} Created benchmark data
|
|
2292
|
+
*/
|
|
2293
|
+
async createBenchmark(benchmarkData) {
|
|
2294
|
+
try {
|
|
2295
|
+
return await this._makeRequest('POST', 'benchmark/create', benchmarkData);
|
|
2296
|
+
} catch (error) {
|
|
2297
|
+
console.error(`Error creating benchmark: ${error.message}`);
|
|
2298
|
+
throw error;
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* Get a specific benchmark by ID
|
|
2304
|
+
*
|
|
2305
|
+
* @param {string} benchmarkId - Benchmark ID to retrieve
|
|
2306
|
+
* @returns {Promise<Object>} Benchmark data
|
|
2307
|
+
*/
|
|
2308
|
+
async getBenchmark(benchmarkId) {
|
|
2309
|
+
try {
|
|
2310
|
+
return await this._makeRequest('GET', `benchmark/get/${benchmarkId}`);
|
|
2311
|
+
} catch (error) {
|
|
2312
|
+
console.error(`Error getting benchmark: ${error.message}`);
|
|
2313
|
+
throw error;
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
/**
|
|
2318
|
+
* List all benchmarks in the workspace
|
|
2319
|
+
*
|
|
2320
|
+
* @param {number} limit - Maximum number of benchmarks to return (optional)
|
|
2321
|
+
* @param {number} offset - Number of benchmarks to skip (optional)
|
|
2322
|
+
* @returns {Promise<Object>} List of benchmarks
|
|
2323
|
+
*/
|
|
2324
|
+
async listBenchmarks(limit = null, offset = null) {
|
|
2325
|
+
try {
|
|
2326
|
+
const params = { workspaceid: this.workspaceId };
|
|
2327
|
+
if (limit) params.limit = limit;
|
|
2328
|
+
if (offset) params.offset = offset;
|
|
2329
|
+
return await this._makeRequest('GET', 'benchmark/list', params);
|
|
2330
|
+
} catch (error) {
|
|
2331
|
+
console.error(`Error listing benchmarks: ${error.message}`);
|
|
2332
|
+
throw error;
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
/**
|
|
2337
|
+
* Update an existing benchmark
|
|
2338
|
+
*
|
|
2339
|
+
* @param {Object} fields - Fields to update
|
|
2340
|
+
* @returns {Promise<Object>} Updated benchmark data
|
|
2341
|
+
*/
|
|
2342
|
+
async updateBenchmark(fields) {
|
|
2343
|
+
try {
|
|
2344
|
+
return await this._makeRequest('POST', 'benchmark/update', fields);
|
|
2345
|
+
} catch (error) {
|
|
2346
|
+
console.error(`Error updating benchmark: ${error.message}`);
|
|
2347
|
+
throw error;
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
/**
|
|
2352
|
+
* Delete a benchmark
|
|
2353
|
+
*
|
|
2354
|
+
* @param {string} benchmarkId - Benchmark ID to delete
|
|
2355
|
+
* @returns {Promise<Object>} Deletion result
|
|
2356
|
+
*/
|
|
2357
|
+
async deleteBenchmark(benchmarkId) {
|
|
2358
|
+
try {
|
|
2359
|
+
return await this._makeRequest('DELETE', `benchmark/delete/${benchmarkId}`);
|
|
2360
|
+
} catch (error) {
|
|
2361
|
+
console.error(`Error deleting benchmark: ${error.message}`);
|
|
2362
|
+
throw error;
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
// Billing Methods
|
|
2367
|
+
|
|
2368
|
+
/**
|
|
2369
|
+
* Get monthly usage and cost information
|
|
2370
|
+
*
|
|
2371
|
+
* @param {number} month - Month number (1-12)
|
|
2372
|
+
* @param {number} year - Year (4-digit)
|
|
2373
|
+
* @returns {Promise<Object>} Monthly cost data
|
|
2374
|
+
*/
|
|
2375
|
+
async getMonthCosts(month, year) {
|
|
2376
|
+
try {
|
|
2377
|
+
const params = {
|
|
2378
|
+
workspaceId: this.workspaceId,
|
|
2379
|
+
month: month,
|
|
2380
|
+
year: year,
|
|
2381
|
+
};
|
|
2382
|
+
return await this._makeRequest('GET', 'billing/monthCosts', params);
|
|
2383
|
+
} catch (error) {
|
|
2384
|
+
console.error(`Error getting month costs: ${error.message}`);
|
|
2385
|
+
throw error;
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
// Channel Management Methods
|
|
2390
|
+
|
|
2391
|
+
/**
|
|
2392
|
+
* Create a new communication channel
|
|
2393
|
+
*
|
|
2394
|
+
* @param {Object} channelData - Channel configuration
|
|
2395
|
+
* @returns {Promise<Object>} Created channel data
|
|
2396
|
+
*/
|
|
2397
|
+
async createChannel(channelData) {
|
|
2398
|
+
try {
|
|
2399
|
+
return await this._makeRequest('POST', 'channel/create', channelData);
|
|
2400
|
+
} catch (error) {
|
|
2401
|
+
console.error(`Error creating channel: ${error.message}`);
|
|
2402
|
+
throw error;
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
/**
|
|
2407
|
+
* Get a specific channel by ID
|
|
2408
|
+
*
|
|
2409
|
+
* @param {string} channelId - Channel ID to retrieve
|
|
2410
|
+
* @returns {Promise<Object>} Channel data
|
|
2411
|
+
*/
|
|
2412
|
+
async getChannel(channelId) {
|
|
2413
|
+
try {
|
|
2414
|
+
return await this._makeRequest('GET', `channel/get/${channelId}`);
|
|
2415
|
+
} catch (error) {
|
|
2416
|
+
console.error(`Error getting channel: ${error.message}`);
|
|
2417
|
+
throw error;
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
/**
|
|
2422
|
+
* List all channels in the workspace
|
|
2423
|
+
*
|
|
2424
|
+
* @param {number} limit - Maximum number of channels to return (optional)
|
|
2425
|
+
* @param {number} offset - Number of channels to skip (optional)
|
|
2426
|
+
* @returns {Promise<Object>} List of channels
|
|
2427
|
+
*/
|
|
2428
|
+
async listChannels(limit = null, offset = null) {
|
|
2429
|
+
try {
|
|
2430
|
+
const params = { workspaceid: this.workspaceId };
|
|
2431
|
+
if (limit) params.limit = limit;
|
|
2432
|
+
if (offset) params.offset = offset;
|
|
2433
|
+
return await this._makeRequest('GET', 'channel/list', params);
|
|
2434
|
+
} catch (error) {
|
|
2435
|
+
console.error(`Error listing channels: ${error.message}`);
|
|
2436
|
+
throw error;
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
/**
|
|
2441
|
+
* Update an existing channel
|
|
2442
|
+
*
|
|
2443
|
+
* @param {Object} fields - Fields to update
|
|
2444
|
+
* @returns {Promise<Object>} Updated channel data
|
|
2445
|
+
*/
|
|
2446
|
+
async updateChannel(fields) {
|
|
2447
|
+
try {
|
|
2448
|
+
return await this._makeRequest('POST', 'channel/update', fields);
|
|
2449
|
+
} catch (error) {
|
|
2450
|
+
console.error(`Error updating channel: ${error.message}`);
|
|
2451
|
+
throw error;
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
/**
|
|
2456
|
+
* Delete a channel
|
|
2457
|
+
*
|
|
2458
|
+
* @param {string} channelId - Channel ID to delete
|
|
2459
|
+
* @returns {Promise<Object>} Deletion result
|
|
2460
|
+
*/
|
|
2461
|
+
async deleteChannel(channelId) {
|
|
2462
|
+
try {
|
|
2463
|
+
return await this._makeRequest('DELETE', `channel/delete/${channelId}`);
|
|
2464
|
+
} catch (error) {
|
|
2465
|
+
console.error(`Error deleting channel: ${error.message}`);
|
|
2466
|
+
throw error;
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
// Connection Management Methods
|
|
2471
|
+
|
|
2472
|
+
/**
|
|
2473
|
+
* Get a specific connection by ID
|
|
2474
|
+
*
|
|
2475
|
+
* @param {string} connectionId - Connection ID to retrieve
|
|
2476
|
+
* @returns {Promise<Object>} Connection data
|
|
2477
|
+
*/
|
|
2478
|
+
async getConnection(connectionId) {
|
|
2479
|
+
try {
|
|
2480
|
+
return await this._makeRequest('GET', `connection/get/${connectionId}`);
|
|
2481
|
+
} catch (error) {
|
|
2482
|
+
console.error(`Error getting connection: ${error.message}`);
|
|
2483
|
+
throw error;
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
/**
|
|
2488
|
+
* List all connections in the workspace
|
|
2489
|
+
*
|
|
2490
|
+
* @param {number} limit - Maximum number of connections to return (optional)
|
|
2491
|
+
* @param {number} offset - Number of connections to skip (optional)
|
|
2492
|
+
* @returns {Promise<Object>} List of connections
|
|
2493
|
+
*/
|
|
2494
|
+
async listConnections(limit = null, offset = null) {
|
|
2495
|
+
try {
|
|
2496
|
+
const params = { workspaceid: this.workspaceId };
|
|
2497
|
+
if (limit) params.limit = limit;
|
|
2498
|
+
if (offset) params.offset = offset;
|
|
2499
|
+
return await this._makeRequest('GET', 'connection/list', params);
|
|
2500
|
+
} catch (error) {
|
|
2501
|
+
console.error(`Error listing connections: ${error.message}`);
|
|
2502
|
+
throw error;
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
/**
|
|
2507
|
+
* Delete a connection
|
|
2508
|
+
*
|
|
2509
|
+
* @param {string} connectionId - Connection ID to delete
|
|
2510
|
+
* @returns {Promise<Object>} Deletion result
|
|
2511
|
+
*/
|
|
2512
|
+
async deleteConnection(connectionId) {
|
|
2513
|
+
try {
|
|
2514
|
+
return await this._makeRequest('DELETE', `connection/delete/${connectionId}`);
|
|
2515
|
+
} catch (error) {
|
|
2516
|
+
console.error(`Error deleting connection: ${error.message}`);
|
|
2517
|
+
throw error;
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
// Dictionary Management Methods
|
|
2522
|
+
|
|
2523
|
+
/**
|
|
2524
|
+
* Get a specific dictionary entry by ID
|
|
2525
|
+
*
|
|
2526
|
+
* @param {string} dictionaryId - Dictionary entry ID to retrieve
|
|
2527
|
+
* @returns {Promise<Object>} Dictionary entry data
|
|
2528
|
+
*/
|
|
2529
|
+
async getDictionary(dictionaryId) {
|
|
2530
|
+
try {
|
|
2531
|
+
return await this._makeRequest('GET', `dictionary/get/${dictionaryId}`);
|
|
2532
|
+
} catch (error) {
|
|
2533
|
+
console.error(`Error getting dictionary: ${error.message}`);
|
|
2534
|
+
throw error;
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
/**
|
|
2539
|
+
* List all dictionary entries in the workspace
|
|
2540
|
+
*
|
|
2541
|
+
* @param {number} limit - Maximum number of entries to return (optional)
|
|
2542
|
+
* @param {number} offset - Number of entries to skip (optional)
|
|
2543
|
+
* @returns {Promise<Object>} List of dictionary entries
|
|
2544
|
+
*/
|
|
2545
|
+
async listDictionaries(limit = null, offset = null) {
|
|
2546
|
+
try {
|
|
2547
|
+
const params = { workspaceid: this.workspaceId };
|
|
2548
|
+
if (limit) params.limit = limit;
|
|
2549
|
+
if (offset) params.offset = offset;
|
|
2550
|
+
return await this._makeRequest('GET', 'dictionary/list', params);
|
|
2551
|
+
} catch (error) {
|
|
2552
|
+
console.error(`Error listing dictionaries: ${error.message}`);
|
|
2553
|
+
throw error;
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
// Embedding Management Methods
|
|
2558
|
+
|
|
2559
|
+
/**
|
|
2560
|
+
* Get a specific embedding by ID
|
|
2561
|
+
*
|
|
2562
|
+
* @param {string} embeddingId - Embedding ID to retrieve
|
|
2563
|
+
* @returns {Promise<Object>} Embedding data
|
|
2564
|
+
*/
|
|
2565
|
+
async getEmbedding(embeddingId) {
|
|
2566
|
+
try {
|
|
2567
|
+
return await this._makeRequest('GET', `embedding/get/${embeddingId}`);
|
|
2568
|
+
} catch (error) {
|
|
2569
|
+
console.error(`Error getting embedding: ${error.message}`);
|
|
2570
|
+
throw error;
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
// Settings Management Methods
|
|
2575
|
+
|
|
2576
|
+
/**
|
|
2577
|
+
* Get charting settings for the workspace
|
|
2578
|
+
*
|
|
2579
|
+
* @param {string} settingsId - Settings ID to retrieve
|
|
2580
|
+
* @returns {Promise<Object>} Charting settings data
|
|
2581
|
+
*/
|
|
2582
|
+
async getChartingSettings(settingsId) {
|
|
2583
|
+
try {
|
|
2584
|
+
return await this._makeRequest('GET', `charting_settings/get/${settingsId}`);
|
|
2585
|
+
} catch (error) {
|
|
2586
|
+
console.error(`Error getting charting settings: ${error.message}`);
|
|
2587
|
+
throw error;
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
/**
|
|
2592
|
+
* Update charting settings for the workspace
|
|
2593
|
+
*
|
|
2594
|
+
* @param {Object} fields - Fields to update
|
|
2595
|
+
* @returns {Promise<Object>} Updated charting settings data
|
|
2596
|
+
*/
|
|
2597
|
+
async updateChartingSettings(fields) {
|
|
2598
|
+
try {
|
|
2599
|
+
return await this._makeRequest('POST', 'charting_settings/update', fields);
|
|
2600
|
+
} catch (error) {
|
|
2601
|
+
console.error(`Error updating charting settings: ${error.message}`);
|
|
2602
|
+
throw error;
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
/**
|
|
2607
|
+
* Get embeddings settings for the workspace
|
|
2608
|
+
*
|
|
2609
|
+
* @param {string} settingsId - Settings ID to retrieve
|
|
2610
|
+
* @returns {Promise<Object>} Embeddings settings data
|
|
2611
|
+
*/
|
|
2612
|
+
async getEmbeddingsSettings(settingsId) {
|
|
2613
|
+
try {
|
|
2614
|
+
return await this._makeRequest('GET', `embeddings_settings/get/${settingsId}`);
|
|
2615
|
+
} catch (error) {
|
|
2616
|
+
console.error(`Error getting embeddings settings: ${error.message}`);
|
|
2617
|
+
throw error;
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
/**
|
|
2622
|
+
* Update embeddings settings for the workspace
|
|
2623
|
+
*
|
|
2624
|
+
* @param {Object} fields - Fields to update
|
|
2625
|
+
* @returns {Promise<Object>} Updated embeddings settings data
|
|
2626
|
+
*/
|
|
2627
|
+
async updateEmbeddingsSettings(fields) {
|
|
2628
|
+
try {
|
|
2629
|
+
return await this._makeRequest('POST', 'embeddings_settings/update', fields);
|
|
2630
|
+
} catch (error) {
|
|
2631
|
+
console.error(`Error updating embeddings settings: ${error.message}`);
|
|
2632
|
+
throw error;
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
// Stream Management Methods
|
|
2637
|
+
|
|
2638
|
+
/**
|
|
2639
|
+
* Get a specific stream by ID
|
|
2640
|
+
*
|
|
2641
|
+
* @param {string} streamId - Stream ID to retrieve
|
|
2642
|
+
* @returns {Promise<Object>} Stream data
|
|
2643
|
+
*/
|
|
2644
|
+
async getStream(streamId) {
|
|
2645
|
+
try {
|
|
2646
|
+
return await this._makeRequest('GET', `stream/get/${streamId}`);
|
|
2647
|
+
} catch (error) {
|
|
2648
|
+
console.error(`Error getting stream: ${error.message}`);
|
|
2649
|
+
throw error;
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
/**
|
|
2654
|
+
* List all streams in the workspace
|
|
2655
|
+
*
|
|
2656
|
+
* @param {number} limit - Maximum number of streams to return (optional)
|
|
2657
|
+
* @param {number} offset - Number of streams to skip (optional)
|
|
2658
|
+
* @returns {Promise<Object>} List of streams
|
|
2659
|
+
*/
|
|
2660
|
+
async listStreams(limit = null, offset = null) {
|
|
2661
|
+
try {
|
|
2662
|
+
const params = { workspaceid: this.workspaceId };
|
|
2663
|
+
if (limit) params.limit = limit;
|
|
2664
|
+
if (offset) params.offset = offset;
|
|
2665
|
+
return await this._makeRequest('GET', 'stream/list', params);
|
|
2666
|
+
} catch (error) {
|
|
2667
|
+
console.error(`Error listing streams: ${error.message}`);
|
|
2668
|
+
throw error;
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2108
2671
|
}
|
|
2109
2672
|
|
|
2110
2673
|
module.exports = ToothFairyAPI;
|