mindsim 0.1.0 → 0.1.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.
Files changed (42) hide show
  1. package/README.md +222 -6
  2. package/dist/cli.js +465 -4
  3. package/dist/cli.js.map +1 -1
  4. package/dist/index.d.ts +6 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +9 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/resources/mind-topics.d.ts +11 -0
  9. package/dist/resources/mind-topics.d.ts.map +1 -0
  10. package/dist/resources/mind-topics.js +18 -0
  11. package/dist/resources/mind-topics.js.map +1 -0
  12. package/dist/resources/snapshots.d.ts +29 -1
  13. package/dist/resources/snapshots.d.ts.map +1 -1
  14. package/dist/resources/snapshots.js +30 -0
  15. package/dist/resources/snapshots.js.map +1 -1
  16. package/dist/resources/usage.d.ts +14 -0
  17. package/dist/resources/usage.d.ts.map +1 -0
  18. package/dist/resources/usage.js +20 -0
  19. package/dist/resources/usage.js.map +1 -0
  20. package/dist/resources/users.d.ts +14 -0
  21. package/dist/resources/users.d.ts.map +1 -0
  22. package/dist/resources/users.js +20 -0
  23. package/dist/resources/users.js.map +1 -0
  24. package/dist/types.d.ts +51 -0
  25. package/dist/types.d.ts.map +1 -1
  26. package/dist/version.d.ts.map +1 -1
  27. package/dist/version.js +3 -3
  28. package/dist/version.js.map +1 -1
  29. package/package.json +2 -2
  30. package/src/cli.ts +474 -5
  31. package/src/index.ts +9 -0
  32. package/src/resources/mind-topics.ts +16 -0
  33. package/src/resources/snapshots.ts +60 -0
  34. package/src/resources/usage.ts +16 -0
  35. package/src/resources/users.ts +16 -0
  36. package/src/types.ts +61 -0
  37. package/src/version.ts +3 -5
  38. package/tests/resources/mind-topics.test.ts +69 -0
  39. package/tests/resources/snapshots.test.ts +46 -0
  40. package/tests/resources/usage.test.ts +34 -0
  41. package/tests/resources/users.test.ts +54 -0
  42. package/tests/version.test.ts +1 -3
package/src/cli.ts CHANGED
@@ -1,24 +1,63 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { Command } from "commander";
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { Command, Option } from "commander";
4
6
  import { login } from "./auth";
7
+ import { MindSim } from "./index";
5
8
  import { checkForUpdates, getPackageVersion, updateSdk } from "./version";
6
9
 
7
10
  const program = new Command();
8
11
 
12
+ /**
13
+ * Helper to instantiate the SDK or fail gracefully if not authenticated
14
+ */
15
+ const getSDK = () => {
16
+ try {
17
+ return new MindSim();
18
+ } catch (error) {
19
+ console.error("❌ Authentication required.");
20
+ console.error("Please run 'mindsim auth' or set MINDSIM_API_KEY environment variable.");
21
+ process.exit(1);
22
+ }
23
+ };
24
+
25
+ /**
26
+ * Helper to print JSON output
27
+ */
28
+ const printOutput = (data: any) => {
29
+ console.log(JSON.stringify(data, null, 2));
30
+ };
31
+
32
+ /**
33
+ * Helper to handle errors uniformly
34
+ */
35
+ const handleError = (error: any) => {
36
+ if (error.response) {
37
+ // Axios error
38
+ console.error(`❌ API Error (${error.response.status}):`);
39
+ console.error(JSON.stringify(error.response.data, null, 2));
40
+ } else {
41
+ console.error("❌ Error:", error.message || error);
42
+ }
43
+ process.exit(1);
44
+ };
45
+
9
46
  const main = async () => {
10
- program.name("mindsim").description("CLI for Mindsim SDK").version(getPackageVersion()); // Use the reusable extractor
47
+ program.name("mindsim").description("CLI for Mindsim SDK").version(getPackageVersion());
48
+
49
+ // ==========================================
50
+ // CORE COMMANDS
51
+ // ==========================================
11
52
 
12
53
  program
13
54
  .command("version")
14
55
  .description("Output your current MindSim CLI version and check for updates")
15
56
  .action(async () => {
16
- // When explicitly asking for version, be verbose about update status
17
57
  console.log(getPackageVersion());
18
58
  await checkForUpdates(true);
19
59
  });
20
60
 
21
- // The Auth Command
22
61
  program
23
62
  .command("auth")
24
63
  .description("Login to Mindsim via browser")
@@ -27,7 +66,6 @@ const main = async () => {
27
66
  await login();
28
67
  });
29
68
 
30
- // NEW: The Update Command
31
69
  program
32
70
  .command("update")
33
71
  .description("Auto-update the MindSim SDK to the latest version")
@@ -35,6 +73,437 @@ const main = async () => {
35
73
  await updateSdk();
36
74
  });
37
75
 
76
+ // ==========================================
77
+ // MINDS RESOURCES
78
+ // ==========================================
79
+ const minds = program.command("minds").description("Manage digital minds");
80
+
81
+ minds
82
+ .command("list")
83
+ .description("List all minds")
84
+ .option("-t, --tags <tags>", "Comma-separated list of tags to filter by")
85
+ .action(async (options) => {
86
+ try {
87
+ const client = getSDK();
88
+ const tagList = options.tags ? options.tags.split(",") : undefined;
89
+ const result = await client.minds.list({ tags: tagList });
90
+ printOutput(result);
91
+ } catch (err) {
92
+ handleError(err);
93
+ }
94
+ });
95
+
96
+ minds
97
+ .command("get")
98
+ .description("Get details of a specific mind")
99
+ .argument("<mindId>", "ID of the mind")
100
+ .action(async (mindId) => {
101
+ try {
102
+ const client = getSDK();
103
+ const result = await client.minds.get(mindId);
104
+ printOutput(result);
105
+ } catch (err) {
106
+ handleError(err);
107
+ }
108
+ });
109
+
110
+ minds
111
+ .command("create")
112
+ .description("Create a new mind")
113
+ .requiredOption("-n, --name <name>", "Name of the mind")
114
+ .option("-e, --email <email>", "Email associated with the mind")
115
+ .option("-t, --tags <tags>", "Comma-separated list of tags")
116
+ .action(async (options) => {
117
+ try {
118
+ const client = getSDK();
119
+ const tagList = options.tags ? options.tags.split(",") : undefined;
120
+ const result = await client.minds.create({
121
+ name: options.name,
122
+ email: options.email,
123
+ tags: tagList,
124
+ });
125
+ printOutput(result);
126
+ } catch (err) {
127
+ handleError(err);
128
+ }
129
+ });
130
+
131
+ minds
132
+ .command("update")
133
+ .description("Update an existing mind")
134
+ .argument("<mindId>", "ID of the mind to update")
135
+ .option("-n, --name <name>", "New name")
136
+ .option("-e, --email <email>", "New email")
137
+ .option("-t, --tags <tags>", "New comma-separated list of tags (replaces existing)")
138
+ .action(async (mindId, options) => {
139
+ try {
140
+ const client = getSDK();
141
+ const tagList = options.tags ? options.tags.split(",") : undefined;
142
+ const result = await client.minds.update(mindId, {
143
+ name: options.name,
144
+ email: options.email,
145
+ tags: tagList,
146
+ });
147
+ printOutput(result);
148
+ } catch (err) {
149
+ handleError(err);
150
+ }
151
+ });
152
+
153
+ minds
154
+ .command("delete")
155
+ .description("Delete a mind")
156
+ .argument("<mindId>", "ID of the mind to delete")
157
+ .action(async (mindId) => {
158
+ try {
159
+ const client = getSDK();
160
+ const result = await client.minds.delete(mindId);
161
+ printOutput(result);
162
+ } catch (err) {
163
+ handleError(err);
164
+ }
165
+ });
166
+
167
+ minds
168
+ .command("search")
169
+ .description("Search for minds by query string")
170
+ .argument("<query>", "Search query (e.g., email or name)")
171
+ .action(async (query) => {
172
+ try {
173
+ const client = getSDK();
174
+ const result = await client.minds.search({ query });
175
+ printOutput(result);
176
+ } catch (err) {
177
+ handleError(err);
178
+ }
179
+ });
180
+
181
+ minds
182
+ .command("set-tags")
183
+ .description("Replace tags for a specific mind")
184
+ .argument("<mindId>", "ID of the mind")
185
+ .requiredOption("-t, --tags <tags>", "Comma-separated list of tags")
186
+ .action(async (mindId, options) => {
187
+ try {
188
+ const client = getSDK();
189
+ const tagList = options.tags ? options.tags.split(",") : [];
190
+ const result = await client.minds.setTags(mindId, { tags: tagList });
191
+ printOutput(result);
192
+ } catch (err) {
193
+ handleError(err);
194
+ }
195
+ });
196
+
197
+ // ==========================================
198
+ // SNAPSHOTS RESOURCES
199
+ // ==========================================
200
+ const snapshots = program.command("snapshots").description("Manage mind snapshots/training data");
201
+
202
+ snapshots
203
+ .command("list")
204
+ .description("List snapshots for a specific mind")
205
+ .argument("<mindId>", "ID of the mind")
206
+ .action(async (mindId) => {
207
+ try {
208
+ const client = getSDK();
209
+ const result = await client.snapshots.list(mindId);
210
+ printOutput(result);
211
+ } catch (err) {
212
+ handleError(err);
213
+ }
214
+ });
215
+
216
+ snapshots
217
+ .command("get")
218
+ .description("Get snapshot detail")
219
+ .argument("<mindId>", "ID of the mind")
220
+ .argument("<snapshotId>", "ID of the snapshot")
221
+ .option("--transcript", "Include transcript")
222
+ .option("--psychometrics", "Include psychometrics")
223
+ .action(async (mindId, snapshotId, options) => {
224
+ try {
225
+ const client = getSDK();
226
+ const result = await client.snapshots.getDetail(mindId, snapshotId, {
227
+ includeTranscript: options.transcript,
228
+ includePsychometrics: options.psychometrics,
229
+ });
230
+ printOutput(result);
231
+ } catch (err) {
232
+ handleError(err);
233
+ }
234
+ });
235
+
236
+ snapshots
237
+ .command("create")
238
+ .description("Upload a file to create a snapshot")
239
+ .argument("<mindId>", "ID of the mind")
240
+ .requiredOption("-f, --file <path>", "Path to the file (pdf, vtt, txt, etc.)")
241
+ .option("-d, --date <date>", "Mindset date (YYYY-MM-DD)")
242
+ .action(async (mindId, options) => {
243
+ try {
244
+ const client = getSDK();
245
+ const filePath = path.resolve(options.file);
246
+
247
+ if (!fs.existsSync(filePath)) {
248
+ throw new Error(`File not found: ${filePath}`);
249
+ }
250
+
251
+ const fileName = path.basename(filePath);
252
+ const fileBuffer = fs.readFileSync(filePath);
253
+
254
+ console.log(`Uploading ${fileName}...`);
255
+
256
+ const result = await client.snapshots.create(mindId, {
257
+ file: fileBuffer,
258
+ fileName: fileName,
259
+ mindsetDate: options.date,
260
+ contentType: "", // Let SDK infer from fileName extension
261
+ });
262
+ printOutput(result);
263
+ } catch (err) {
264
+ handleError(err);
265
+ }
266
+ });
267
+
268
+ snapshots
269
+ .command("status")
270
+ .description("Check the processing status of a snapshot")
271
+ .argument("<mindId>", "ID of the mind")
272
+ .argument("<snapshotId>", "ID of the snapshot (mindAssessmentId)")
273
+ .action(async (mindId, snapshotId) => {
274
+ try {
275
+ const client = getSDK();
276
+ const result = await client.snapshots.getStatus(mindId, snapshotId);
277
+ printOutput(result);
278
+ } catch (err) {
279
+ handleError(err);
280
+ }
281
+ });
282
+
283
+ snapshots
284
+ .command("delete")
285
+ .description("Delete a snapshot")
286
+ .argument("<mindId>", "ID of the mind")
287
+ .argument("<snapshotId>", "ID of the snapshot")
288
+ .action(async (mindId, snapshotId) => {
289
+ try {
290
+ const client = getSDK();
291
+ const result = await client.snapshots.delete(mindId, snapshotId);
292
+ printOutput(result);
293
+ } catch (err) {
294
+ handleError(err);
295
+ }
296
+ });
297
+
298
+ snapshots
299
+ .command("link")
300
+ .description("Link snapshot to digital twin")
301
+ .argument("<mindId>", "ID of the mind")
302
+ .argument("<snapshotId>", "ID of the snapshot")
303
+ .action(async (mindId, snapshotId) => {
304
+ try {
305
+ const client = getSDK();
306
+ const result = await client.snapshots.link(mindId, snapshotId);
307
+ printOutput(result);
308
+ } catch (err) {
309
+ handleError(err);
310
+ }
311
+ });
312
+
313
+ snapshots
314
+ .command("unlink")
315
+ .description("Unlink snapshot from digital twin")
316
+ .argument("<mindId>", "ID of the mind")
317
+ .argument("<snapshotId>", "ID of the snapshot")
318
+ .action(async (mindId, snapshotId) => {
319
+ try {
320
+ const client = getSDK();
321
+ const result = await client.snapshots.unlink(mindId, snapshotId);
322
+ printOutput(result);
323
+ } catch (err) {
324
+ handleError(err);
325
+ }
326
+ });
327
+
328
+ // ==========================================
329
+ // SIMULATIONS RESOURCES
330
+ // ==========================================
331
+ const simulations = program.command("simulations").description("Run and manage simulations");
332
+
333
+ simulations
334
+ .command("run")
335
+ .description("Run a simulation against a mind")
336
+ .argument("<mindId>", "ID of the mind")
337
+ .requiredOption("-m, --message <message>", "The scenario/prompt message")
338
+ .option("-b, --background", "Run in background (async)", false)
339
+ .action(async (mindId, options) => {
340
+ try {
341
+ const client = getSDK();
342
+ const result = await client.simulations.run({
343
+ mindId,
344
+ scenario: {
345
+ message: options.message,
346
+ },
347
+ runInBackground: options.background,
348
+ });
349
+ printOutput(result);
350
+ } catch (err) {
351
+ handleError(err);
352
+ }
353
+ });
354
+
355
+ simulations
356
+ .command("list")
357
+ .description("List simulation history")
358
+ .option("-l, --limit <number>", "Number of items to return", "20")
359
+ .option("-o, --offset <number>", "Pagination offset", "0")
360
+ .action(async (options) => {
361
+ try {
362
+ const client = getSDK();
363
+ const result = await client.simulations.list({
364
+ limit: Number.parseInt(options.limit, 10),
365
+ offset: Number.parseInt(options.offset, 10),
366
+ });
367
+ printOutput(result);
368
+ } catch (err) {
369
+ handleError(err);
370
+ }
371
+ });
372
+
373
+ simulations
374
+ .command("get")
375
+ .description("Get full details of a simulation")
376
+ .argument("<simulationId>", "ID of the simulation")
377
+ .action(async (simulationId) => {
378
+ try {
379
+ const client = getSDK();
380
+ const result = await client.simulations.get(simulationId);
381
+ printOutput(result);
382
+ } catch (err) {
383
+ handleError(err);
384
+ }
385
+ });
386
+
387
+ simulations
388
+ .command("delete")
389
+ .description("Delete a simulation record")
390
+ .argument("<simulationId>", "ID of the simulation")
391
+ .action(async (simulationId) => {
392
+ try {
393
+ const client = getSDK();
394
+ const result = await client.simulations.delete(simulationId);
395
+ printOutput(result);
396
+ } catch (err) {
397
+ handleError(err);
398
+ }
399
+ });
400
+
401
+ // ==========================================
402
+ // TAGS RESOURCES
403
+ // ==========================================
404
+ const tags = program.command("tags").description("Manage tags");
405
+
406
+ tags
407
+ .command("list")
408
+ .description("List all available tags")
409
+ .action(async () => {
410
+ try {
411
+ const client = getSDK();
412
+ const result = await client.tags.list();
413
+ printOutput(result);
414
+ } catch (err) {
415
+ handleError(err);
416
+ }
417
+ });
418
+
419
+ tags
420
+ .command("update")
421
+ .description("Update a tag name")
422
+ .argument("<tagId>", "ID of the tag")
423
+ .requiredOption("-n, --name <name>", "New name for the tag")
424
+ .action(async (tagId, options) => {
425
+ try {
426
+ const client = getSDK();
427
+ const result = await client.tags.update(tagId, { name: options.name });
428
+ printOutput(result);
429
+ } catch (err) {
430
+ handleError(err);
431
+ }
432
+ });
433
+
434
+ tags
435
+ .command("delete")
436
+ .description("Delete a tag")
437
+ .argument("<tagId>", "ID of the tag")
438
+ .action(async (tagId) => {
439
+ try {
440
+ const client = getSDK();
441
+ const result = await client.tags.delete(tagId);
442
+ printOutput(result);
443
+ } catch (err) {
444
+ handleError(err);
445
+ }
446
+ });
447
+
448
+ // ==========================================
449
+ // PSYCHOMETRICS RESOURCES
450
+ // ==========================================
451
+ const psychometrics = program.command("psychometrics").description("Retrieve psychometric data");
452
+
453
+ psychometrics
454
+ .command("get")
455
+ .description("Get psychometrics for a specific snapshot")
456
+ .argument("<snapshotId>", "ID of the snapshot")
457
+ .action(async (snapshotId) => {
458
+ try {
459
+ const client = getSDK();
460
+ const result = await client.psychometrics.get(snapshotId);
461
+ printOutput(result);
462
+ } catch (err) {
463
+ handleError(err);
464
+ }
465
+ });
466
+
467
+ psychometrics
468
+ .command("topics")
469
+ .description("Get topic analysis")
470
+ .argument("<snapshotId>")
471
+ .action(async (sid) => {
472
+ try {
473
+ const client = getSDK();
474
+ printOutput(await client.mindTopics.get(sid));
475
+ } catch (e) {
476
+ handleError(e);
477
+ }
478
+ });
479
+
480
+ // USAGE & USERS
481
+ program
482
+ .command("usage")
483
+ .description("Get API key usage")
484
+ .option("--from <date>", "From date (YYYY-MM-DD)")
485
+ .option("--to <date>", "To date (YYYY-MM-DD)")
486
+ .action(async (opts) => {
487
+ try {
488
+ const client = getSDK();
489
+ printOutput(await client.usage.get({ from: opts.from, to: opts.to }));
490
+ } catch (e) {
491
+ handleError(e);
492
+ }
493
+ });
494
+
495
+ program
496
+ .command("users")
497
+ .description("List organization users")
498
+ .action(async () => {
499
+ try {
500
+ const client = getSDK();
501
+ printOutput(await client.users.list());
502
+ } catch (e) {
503
+ handleError(e);
504
+ }
505
+ });
506
+
38
507
  program.parse(process.argv);
39
508
  };
40
509
 
package/src/index.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import axios, { type AxiosInstance } from "axios";
2
2
  import { getApiBaseUrl, loadApiKey } from "./config";
3
3
  import { ArtifactsResource } from "./resources/artifacts";
4
+ import { MindTopicsResource } from "./resources/mind-topics";
4
5
  import { MindsResource } from "./resources/minds";
5
6
  import { PsychometricsResource } from "./resources/psychometrics";
6
7
  import { SimulationsResource } from "./resources/simulations";
7
8
  import { SnapshotsResource } from "./resources/snapshots";
8
9
  import { TagsResource } from "./resources/tags";
10
+ import { UsageResource } from "./resources/usage";
11
+ import { UsersResource } from "./resources/users";
9
12
  import { checkForUpdates, getPackageVersion } from "./version";
10
13
 
11
14
  export class MindSim {
@@ -13,10 +16,13 @@ export class MindSim {
13
16
 
14
17
  public artifacts: ArtifactsResource;
15
18
  public minds: MindsResource;
19
+ public mindTopics: MindTopicsResource;
16
20
  public psychometrics: PsychometricsResource;
17
21
  public snapshots: SnapshotsResource;
18
22
  public simulations: SimulationsResource;
19
23
  public tags: TagsResource;
24
+ public usage: UsageResource;
25
+ public users: UsersResource;
20
26
 
21
27
  constructor(apiKey?: string, options?: { apiBaseUrl?: string }) {
22
28
  // 1. Trigger the auto-update check (Fire and forget, do not await)
@@ -48,10 +54,13 @@ export class MindSim {
48
54
 
49
55
  this.artifacts = new ArtifactsResource(this.client);
50
56
  this.minds = new MindsResource(this.client);
57
+ this.mindTopics = new MindTopicsResource(this.client);
51
58
  this.psychometrics = new PsychometricsResource(this.client);
52
59
  this.snapshots = new SnapshotsResource(this.client);
53
60
  this.simulations = new SimulationsResource(this.client);
54
61
  this.tags = new TagsResource(this.client);
62
+ this.usage = new UsageResource(this.client);
63
+ this.users = new UsersResource(this.client);
55
64
  }
56
65
  }
57
66
 
@@ -0,0 +1,16 @@
1
+ import type { AxiosInstance } from "axios";
2
+ import type { GetMindTopicsResponse } from "../types";
3
+
4
+ export class MindTopicsResource {
5
+ constructor(private client: AxiosInstance) {}
6
+
7
+ /**
8
+ * Get topic analysis for a specific snapshot
9
+ */
10
+ async get(snapshotId: string): Promise<GetMindTopicsResponse> {
11
+ const response = await this.client.get<GetMindTopicsResponse>(
12
+ `/snapshots/${snapshotId}/mind-topics`,
13
+ );
14
+ return response.data;
15
+ }
16
+ }
@@ -5,8 +5,10 @@ import type {
5
5
  CreateSnapshotFromFileParams,
6
6
  CreateSnapshotParams,
7
7
  CreateSnapshotResponse,
8
+ DigitalTwinMindAssessment,
8
9
  GetSignedUrlResponse,
9
10
  ListSnapshotsResponse,
11
+ SnapshotDetailResponse,
10
12
  SnapshotStatus,
11
13
  } from "../types";
12
14
 
@@ -41,6 +43,36 @@ export class SnapshotsResource {
41
43
  return response.data;
42
44
  }
43
45
 
46
+ /**
47
+ * Get details of a specific snapshot, optionally including transcripts and psychometrics
48
+ */
49
+ async getDetail(
50
+ mindId: string,
51
+ snapshotId: string,
52
+ options?: { includeTranscript?: boolean; includePsychometrics?: boolean },
53
+ ): Promise<SnapshotDetailResponse> {
54
+ const response = await this.client.get<SnapshotDetailResponse>(
55
+ `/minds/${mindId}/snapshots/${snapshotId}`,
56
+ {
57
+ params: options,
58
+ },
59
+ );
60
+ return response.data;
61
+ }
62
+
63
+ /**
64
+ * Delete a snapshot
65
+ */
66
+ async delete(
67
+ mindId: string,
68
+ snapshotId: string,
69
+ ): Promise<{ message: string; snapshotId: string }> {
70
+ const response = await this.client.delete<{ message: string; snapshotId: string }>(
71
+ `/minds/${mindId}/snapshots/${snapshotId}`,
72
+ );
73
+ return response.data;
74
+ }
75
+
44
76
  /**
45
77
  * Create a snapshot via a signed url. Recommended for large files.
46
78
  */
@@ -123,4 +155,32 @@ export class SnapshotsResource {
123
155
  );
124
156
  return response.data;
125
157
  }
158
+
159
+ /**
160
+ * Link a snapshot to the Digital Twin
161
+ */
162
+ async link(
163
+ mindId: string,
164
+ snapshotId: string,
165
+ ): Promise<{ message: string; snapshot: DigitalTwinMindAssessment }> {
166
+ const response = await this.client.post<{
167
+ message: string;
168
+ snapshot: DigitalTwinMindAssessment;
169
+ }>(`/minds/${mindId}/snapshots/${snapshotId}/link`);
170
+ return response.data;
171
+ }
172
+
173
+ /**
174
+ * Unlink a snapshot from the Digital Twin
175
+ */
176
+ async unlink(
177
+ mindId: string,
178
+ snapshotId: string,
179
+ ): Promise<{ message: string; snapshot: DigitalTwinMindAssessment[] }> {
180
+ const response = await this.client.post<{
181
+ message: string;
182
+ snapshot: DigitalTwinMindAssessment[];
183
+ }>(`/minds/${mindId}/snapshots/${snapshotId}/unlink`);
184
+ return response.data;
185
+ }
126
186
  }
@@ -0,0 +1,16 @@
1
+ import type { AxiosInstance } from "axios";
2
+ import type { ApiKeyUsage } from "../types";
3
+
4
+ export class UsageResource {
5
+ constructor(private client: AxiosInstance) {}
6
+
7
+ /**
8
+ * Get API Key Usage stats
9
+ */
10
+ async get(params?: { from?: string; to?: string }): Promise<ApiKeyUsage> {
11
+ const response = await this.client.get<ApiKeyUsage>("/usage", {
12
+ params,
13
+ });
14
+ return response.data;
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ import type { AxiosInstance } from "axios";
2
+ import type { ListUsersResponse } from "../types";
3
+
4
+ export class UsersResource {
5
+ constructor(private client: AxiosInstance) {}
6
+
7
+ /**
8
+ * List users in the organization
9
+ */
10
+ async list(params?: { limit?: number; offset?: number }): Promise<ListUsersResponse> {
11
+ const response = await this.client.get<ListUsersResponse>("/organizations/users", {
12
+ params,
13
+ });
14
+ return response.data;
15
+ }
16
+ }