Skip to content

Commit dd84836

Browse files
committed
cp dines
1 parent 9d7d6f6 commit dd84836

3 files changed

Lines changed: 352 additions & 407 deletions

File tree

src/sdk.ts

Lines changed: 58 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,57 @@ type ContentType = ObjectCreateParams['content_type'];
111111
* ```
112112
*/
113113
export class RunloopSDK {
114+
/**
115+
* Low-level API client providing direct access to all Runloop API endpoints.
116+
* Use this when you need fine-grained control or access to features not yet exposed
117+
* through the high-level interfaces. Most users should prefer the specialized interfaces
118+
* (devbox, blueprint, etc.) for a more convenient API.
119+
*/
114120
public readonly api: Runloop;
115-
public readonly devbox: RunloopSDK.DevboxInterface;
116-
public readonly blueprint: RunloopSDK.BlueprintInterface;
117-
public readonly snapshot: RunloopSDK.SnapshotInterface;
118-
public readonly storageObject: RunloopSDK.StorageObjectInterface;
121+
122+
/**
123+
* Interface for creating and accessing {@link Devbox} class instances.
124+
* Devboxes are isolated development environments running in Runloop's cloud - the core resource
125+
* that provides you with a fully configured development environment. Use this interface to create
126+
* new devboxes or get existing ones by ID.
127+
*/
128+
public readonly devbox: RunloopSDK.DevboxOps;
129+
130+
/**
131+
* Interface for creating and accessing {@link Blueprint} class instances.
132+
* Blueprints are reusable templates that define the base configuration for devboxes, built from
133+
* Dockerfiles. They can be used to create multiple devboxes with consistent environments. Use this
134+
* interface to create new blueprints or get existing ones by ID.
135+
*/
136+
public readonly blueprint: RunloopSDK.BlueprintOps;
137+
138+
/**
139+
* Interface for creating and accessing {@link Snapshot} class instances.
140+
* Snapshots are point-in-time copies of a devbox's disk state, allowing you to save the complete
141+
* state of a devbox and restore it later or create new devboxes from saved states. Use this
142+
* interface to list snapshots or get existing ones by ID.
143+
*/
144+
public readonly snapshot: RunloopSDK.SnapshotOps;
145+
146+
/**
147+
* Interface for creating and accessing {@link StorageObject} class instances.
148+
* Storage objects are files stored in Runloop's object storage system. They can be uploaded,
149+
* downloaded, and managed with metadata, useful for storing configuration files, data files, or
150+
* any other content you need to persist or share between devboxes. Use this interface to create
151+
* new storage objects or get existing ones by ID.
152+
*/
153+
public readonly storageObject: RunloopSDK.StorageObjectOps;
119154

120155
/**
121156
* Creates a new RunloopSDK instance.
122157
* @param {ClientOptions} [options] - Optional client configuration options.
123158
*/
124159
constructor(options?: ClientOptions) {
125160
this.api = new Runloop(options);
126-
this.devbox = new RunloopSDK.DevboxInterface(this.api);
127-
this.blueprint = new RunloopSDK.BlueprintInterface(this.api);
128-
this.snapshot = new RunloopSDK.SnapshotInterface(this.api);
129-
this.storageObject = new RunloopSDK.StorageObjectInterface(this.api);
161+
this.devbox = new RunloopSDK.DevboxOps(this.api);
162+
this.blueprint = new RunloopSDK.BlueprintOps(this.api);
163+
this.snapshot = new RunloopSDK.SnapshotOps(this.api);
164+
this.storageObject = new RunloopSDK.StorageObjectOps(this.api);
130165
}
131166
}
132167

@@ -136,7 +171,7 @@ export namespace RunloopSDK {
136171
*
137172
* ## Overview
138173
*
139-
* The `DevboxInterface` class provides a high-level API for managing devboxes,
174+
* The `DevboxInterface` class provides a high-level abstraction for managing devboxes,
140175
* which are isolated development environments running in Runloop's cloud infrastructure.
141176
* Devboxes can be created from blueprints or snapshots, and support command execution,
142177
* file operations, and lifecycle management.
@@ -153,7 +188,7 @@ export namespace RunloopSDK {
153188
* const result = await devbox.cmd.exec({ command: 'echo "Hello, World!"' });
154189
* ```
155190
*/
156-
export class DevboxInterface {
191+
export class DevboxOps {
157192
/**
158193
* @private
159194
*/
@@ -249,7 +284,7 @@ export namespace RunloopSDK {
249284
*
250285
* ## Overview
251286
*
252-
* The `BlueprintInterface` class provides a high-level API for managing blueprints,
287+
* The `BlueprintInterface` class provides a high-level abstraction for managing blueprints,
253288
* which define the base configuration for devboxes. Blueprints are built from Dockerfiles
254289
* and can be used to create multiple devboxes with consistent environments.
255290
*
@@ -269,7 +304,7 @@ export namespace RunloopSDK {
269304
* const devbox = await sdk.devbox.createFromBlueprintId(blueprint.id, { name: 'my-devbox' });
270305
* ```
271306
*/
272-
export class BlueprintInterface {
307+
export class BlueprintOps {
273308
/**
274309
* @private
275310
*/
@@ -320,7 +355,7 @@ export namespace RunloopSDK {
320355
*
321356
* ## Overview
322357
*
323-
* The `SnapshotInterface` class provides a high-level API for managing disk snapshots,
358+
* The `SnapshotInterface` class provides a high-level abstraction for managing disk snapshots,
324359
* which capture the complete state of a devbox's disk. Snapshots can be used to restore
325360
* devboxes to a previous state or create new devboxes from saved states.
326361
*
@@ -337,7 +372,7 @@ export namespace RunloopSDK {
337372
* const devbox = await snapshot.createDevbox();
338373
* ```
339374
*/
340-
export class SnapshotInterface {
375+
export class SnapshotOps {
341376
/**
342377
* @private
343378
*/
@@ -368,7 +403,7 @@ export namespace RunloopSDK {
368403
*
369404
* ## Overview
370405
*
371-
* The `StorageObjectInterface` class provides a high-level API for managing storage objects,
406+
* The `StorageObjectInterface` class provides a high-level abstraction for managing storage objects,
372407
* which are files stored in Runloop's object storage. Storage objects can be uploaded,
373408
* downloaded, and managed with metadata.
374409
*
@@ -384,14 +419,14 @@ export namespace RunloopSDK {
384419
* const objects = await sdk.storageObject.list();
385420
* ```
386421
*/
387-
export class StorageObjectInterface {
422+
export class StorageObjectOps {
388423
/**
389424
* @private
390425
*/
391426
constructor(private client: Runloop) {}
392427

393428
/**
394-
* Create a new storage object. This is for advanced users and for basic operations you should use the {@link StorageObjectInterface.uploadFromFile uploadFromFile()}, {@link StorageObjectInterface.uploadFromText uploadFromText()}, or {@link StorageObjectInterface.uploadFromBuffer uploadFromBuffer()} methods instead.
429+
* Create a new storage object. This is for advanced users and for basic operations you should use the {@link StorageObjectOps.uploadFromFile uploadFromFile()}, {@link StorageObjectOps.uploadFromText uploadFromText()}, or {@link StorageObjectOps.uploadFromBuffer uploadFromBuffer()} methods instead.
395430
*
396431
* @example
397432
* ```typescript
@@ -400,11 +435,13 @@ export namespace RunloopSDK {
400435
* content_type: 'text',
401436
* metadata: { project: 'demo' },
402437
* });
403-
* console.log(storageObject.id);
438+
* storageObject.uploadContent('Hello, World!');
439+
* // this will mark the object as complete and make it read-only
440+
* storageObject.complete();
404441
* ```
405-
* @param {ObjectCreateParams} params - Parameters for creating the object.
406-
* @param {Core.RequestOptions & { polling?: Partial<PollingOptions<Runloop.Objects.ObjectView>> }} [options] - Request options.
407-
* @returns {Promise<StorageObject>} A {@link StorageObject} instance.
442+
* @param params - Parameters for creating the object.
443+
* @param options - Request options.
444+
* @returns A {@link StorageObject} instance.
408445
*/
409446
async create(
410447
params: ObjectCreateParams,

0 commit comments

Comments
 (0)