Skip to content

Commit b68ac03

Browse files
chore: Add archive method to stainless (#7537)
1 parent 284aac3 commit b68ac03

6 files changed

Lines changed: 55 additions & 6 deletions

File tree

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 117
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-1ee005e7d8f97067abb96c6a38af53b69d362f2511ca775a9b78580a9643c253.yml
3-
openapi_spec_hash: 9c54d19abf7993fd55714759f3265f9c
4-
config_hash: eb28692edd68a6ae95cf92af931c9976
1+
configured_endpoints: 118
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-1a92de99959f20ab5850a7f89db21cb66269b2e0002ffc5e5afbe660d05b0768.yml
3+
openapi_spec_hash: 41e4660f26e27e6ab94d223da4ec1253
4+
config_hash: cbda3692cb48ab8582a0df1674b9e5c8

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ Methods:
245245
- <code title="get /v1/scenarios/{id}">client.scenarios.<a href="./src/resources/scenarios/scenarios.ts">retrieve</a>(id) -> ScenarioView</code>
246246
- <code title="post /v1/scenarios/{id}">client.scenarios.<a href="./src/resources/scenarios/scenarios.ts">update</a>(id, { ...params }) -> ScenarioView</code>
247247
- <code title="get /v1/scenarios">client.scenarios.<a href="./src/resources/scenarios/scenarios.ts">list</a>({ ...params }) -> ScenarioViewsScenariosCursorIDPage</code>
248+
- <code title="post /v1/scenarios/{id}/archive">client.scenarios.<a href="./src/resources/scenarios/scenarios.ts">archive</a>(id) -> ScenarioView</code>
248249
- <code title="get /v1/scenarios/list_public">client.scenarios.<a href="./src/resources/scenarios/scenarios.ts">listPublic</a>({ ...params }) -> ScenarioViewsScenariosCursorIDPage</code>
249250
- <code title="post /v1/scenarios/start_run">client.scenarios.<a href="./src/resources/scenarios/scenarios.ts">startRun</a>({ ...params }) -> ScenarioRunView</code>
250251

src/resources/devboxes/devboxes.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,12 @@ export interface TunnelView {
10241024
*/
10251025
create_time_ms: number;
10261026

1027+
/**
1028+
* When true, HTTP traffic through the tunnel counts as activity for idle lifecycle
1029+
* policies, resetting the idle timer.
1030+
*/
1031+
http_keep_alive: boolean;
1032+
10271033
/**
10281034
* The encrypted tunnel key used to construct the tunnel URL. URL format:
10291035
* https://{port}-{tunnel_key}.tunnel.runloop.{domain}
@@ -1221,6 +1227,12 @@ export namespace DevboxCreateParams {
12211227
* Authentication mode for the tunnel. Defaults to 'public' if not specified.
12221228
*/
12231229
auth_mode?: 'open' | 'authenticated' | null;
1230+
1231+
/**
1232+
* When true, HTTP traffic through the tunnel counts as activity for idle lifecycle
1233+
* policies, resetting the idle timer. Defaults to true if not specified.
1234+
*/
1235+
http_keep_alive?: boolean | null;
12241236
}
12251237
}
12261238

@@ -1271,6 +1283,12 @@ export interface DevboxEnableTunnelParams {
12711283
* Authentication mode for the tunnel. Defaults to 'public' if not specified.
12721284
*/
12731285
auth_mode?: 'open' | 'authenticated' | null;
1286+
1287+
/**
1288+
* When true, HTTP traffic through the tunnel counts as activity for idle lifecycle
1289+
* policies, resetting the idle timer. Defaults to true if not specified.
1290+
*/
1291+
http_keep_alive?: boolean | null;
12741292
}
12751293

12761294
/**

src/resources/scenarios/scenarios.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ export class Scenarios extends APIResource {
8888
});
8989
}
9090

91+
/**
92+
* Archive a previously created Scenario. The scenario will no longer appear in
93+
* list endpoints but can still be retrieved by ID.
94+
*/
95+
archive(id: string, options?: Core.RequestOptions): Core.APIPromise<ScenarioView> {
96+
return this._client.post(`/v1/scenarios/${id}/archive`, options);
97+
}
98+
9199
/**
92100
* List all public scenarios matching filter.
93101
*/

tests/api-resources/devboxes/devboxes.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ describe('resource devboxes', () => {
7474
repo_connection_id: 'repo_connection_id',
7575
secrets: { foo: 'string' },
7676
snapshot_id: 'snapshot_id',
77-
tunnel: { auth_mode: 'open' },
77+
tunnel: { auth_mode: 'open', http_keep_alive: true },
7878
},
7979
{ path: '/_stainless_unknown_path' },
8080
),
@@ -240,7 +240,11 @@ describe('resource devboxes', () => {
240240
test('enableTunnel: request options and params are passed correctly', async () => {
241241
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
242242
await expect(
243-
client.devboxes.enableTunnel('id', { auth_mode: 'open' }, { path: '/_stainless_unknown_path' }),
243+
client.devboxes.enableTunnel(
244+
'id',
245+
{ auth_mode: 'open', http_keep_alive: true },
246+
{ path: '/_stainless_unknown_path' },
247+
),
244248
).rejects.toThrow(Runloop.NotFoundError);
245249
});
246250

tests/api-resources/scenarios/scenarios.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,24 @@ describe('resource scenarios', () => {
211211
).rejects.toThrow(Runloop.NotFoundError);
212212
});
213213

214+
test('archive', async () => {
215+
const responsePromise = client.scenarios.archive('id');
216+
const rawResponse = await responsePromise.asResponse();
217+
expect(rawResponse).toBeInstanceOf(Response);
218+
const response = await responsePromise;
219+
expect(response).not.toBeInstanceOf(Response);
220+
const dataAndResponse = await responsePromise.withResponse();
221+
expect(dataAndResponse.data).toBe(response);
222+
expect(dataAndResponse.response).toBe(rawResponse);
223+
});
224+
225+
test('archive: request options instead of params are passed correctly', async () => {
226+
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
227+
await expect(client.scenarios.archive('id', { path: '/_stainless_unknown_path' })).rejects.toThrow(
228+
Runloop.NotFoundError,
229+
);
230+
});
231+
214232
test('listPublic', async () => {
215233
const responsePromise = client.scenarios.listPublic();
216234
const rawResponse = await responsePromise.asResponse();

0 commit comments

Comments
 (0)