Skip to content

Commit 8875d65

Browse files
feat(api): /browsers no longer requires invocation id
1 parent a68e838 commit 8875d65

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 16
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2aec229ccf91f7c1ac95aa675ea2a59bd61af9e363a22c3b49677992f1eeb16a.yml
3-
openapi_spec_hash: c80cd5d52a79cd5366a76d4a825bd27a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-ff8ccba8b5409eaa1128df9027582cb63f66e8accd75e511f70b7c27ef26c9ae.yml
3+
openapi_spec_hash: 1dbacc339695a7c78718f90f791d3f01
44
config_hash: b8e1fff080fbaa22656ab0a57b591777

src/resources/browsers.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ export class Browsers extends APIResource {
1313
*
1414
* @example
1515
* ```ts
16-
* const browser = await client.browsers.create({
17-
* invocation_id: 'rr33xuugxj9h0bkf1rdt2bet',
18-
* });
16+
* const browser = await client.browsers.create();
1917
* ```
2018
*/
21-
create(body: BrowserCreateParams, options?: RequestOptions): APIPromise<BrowserCreateResponse> {
19+
create(
20+
body: BrowserCreateParams | null | undefined = {},
21+
options?: RequestOptions,
22+
): APIPromise<BrowserCreateResponse> {
2223
return this._client.post('/browsers', { body, ...options });
2324
}
2425

@@ -169,7 +170,7 @@ export interface BrowserCreateParams {
169170
/**
170171
* action invocation ID
171172
*/
172-
invocation_id: string;
173+
invocation_id?: string;
173174

174175
/**
175176
* Optional persistence configuration for the browser session.

tests/api-resources/browsers.test.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const client = new Kernel({
99

1010
describe('resource browsers', () => {
1111
// skipped: tests are disabled for the time being
12-
test.skip('create: only required params', async () => {
13-
const responsePromise = client.browsers.create({ invocation_id: 'rr33xuugxj9h0bkf1rdt2bet' });
12+
test.skip('create', async () => {
13+
const responsePromise = client.browsers.create();
1414
const rawResponse = await responsePromise.asResponse();
1515
expect(rawResponse).toBeInstanceOf(Response);
1616
const response = await responsePromise;
@@ -21,12 +21,18 @@ describe('resource browsers', () => {
2121
});
2222

2323
// skipped: tests are disabled for the time being
24-
test.skip('create: required and optional params', async () => {
25-
const response = await client.browsers.create({
26-
invocation_id: 'rr33xuugxj9h0bkf1rdt2bet',
27-
persistence: { id: 'my-awesome-browser-for-user-1234' },
28-
stealth: true,
29-
});
24+
test.skip('create: request options and params are passed correctly', async () => {
25+
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
26+
await expect(
27+
client.browsers.create(
28+
{
29+
invocation_id: 'rr33xuugxj9h0bkf1rdt2bet',
30+
persistence: { id: 'my-awesome-browser-for-user-1234' },
31+
stealth: true,
32+
},
33+
{ path: '/_stainless_unknown_path' },
34+
),
35+
).rejects.toThrow(Kernel.NotFoundError);
3036
});
3137

3238
// skipped: tests are disabled for the time being

0 commit comments

Comments
 (0)