Skip to content

Commit 1f1c4d8

Browse files
feat(api): add delete_browsers endpoint
1 parent 7c5d2e4 commit 1f1c4d8

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 15
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-5d4e11bc46eeecee7363d56a9dfe946acee997d5b352c2b0a50c20e742c54d2d.yml
3-
openapi_spec_hash: 333e53ad9c706296b9afdb8ff73bec8f
4-
config_hash: 0fdf285ddd8dee229fd84ea57df9080f
1+
configured_endpoints: 16
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-b019e469425a59061f37c5fdc7a131a5291c66134ef0627db4f06bb1f4af0b15.yml
3+
openapi_spec_hash: f66a3c2efddb168db9539ba2507b10b8
4+
config_hash: aae6721b2be9ec8565dfc8f7eadfe105

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Methods:
5959
- <code title="post /invocations">client.invocations.<a href="./src/resources/invocations.ts">create</a>({ ...params }) -> InvocationCreateResponse</code>
6060
- <code title="get /invocations/{id}">client.invocations.<a href="./src/resources/invocations.ts">retrieve</a>(id) -> InvocationRetrieveResponse</code>
6161
- <code title="patch /invocations/{id}">client.invocations.<a href="./src/resources/invocations.ts">update</a>(id, { ...params }) -> InvocationUpdateResponse</code>
62+
- <code title="delete /invocations/{id}/browsers">client.invocations.<a href="./src/resources/invocations.ts">deleteBrowsers</a>(id) -> void</code>
6263
- <code title="get /invocations/{id}/events">client.invocations.<a href="./src/resources/invocations.ts">follow</a>(id) -> InvocationFollowResponse</code>
6364

6465
# Browsers

src/resources/invocations.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ export class Invocations extends APIResource {
5757
return this._client.patch(path`/invocations/${id}`, { body, ...options });
5858
}
5959

60+
/**
61+
* Delete all browser sessions created within the specified invocation.
62+
*
63+
* @example
64+
* ```ts
65+
* await client.invocations.deleteBrowsers('id');
66+
* ```
67+
*/
68+
deleteBrowsers(id: string, options?: RequestOptions): APIPromise<void> {
69+
return this._client.delete(path`/invocations/${id}/browsers`, {
70+
...options,
71+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
72+
});
73+
}
74+
6075
/**
6176
* Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
6277
* status updates for an invocation. The stream terminates automatically once the

tests/api-resources/invocations.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ describe('resource invocations', () => {
6464
const response = await client.invocations.update('id', { status: 'succeeded', output: 'output' });
6565
});
6666

67+
// skipped: tests are disabled for the time being
68+
test.skip('deleteBrowsers', async () => {
69+
const responsePromise = client.invocations.deleteBrowsers('id');
70+
const rawResponse = await responsePromise.asResponse();
71+
expect(rawResponse).toBeInstanceOf(Response);
72+
const response = await responsePromise;
73+
expect(response).not.toBeInstanceOf(Response);
74+
const dataAndResponse = await responsePromise.withResponse();
75+
expect(dataAndResponse.data).toBe(response);
76+
expect(dataAndResponse.response).toBe(rawResponse);
77+
});
78+
6779
// skipped: currently no good way to test endpoints with content type text/event-stream, Prism mock server will fail
6880
test.skip('follow', async () => {
6981
const responsePromise = client.invocations.follow('id');

0 commit comments

Comments
 (0)