Skip to content

Commit db419e6

Browse files
feat: feat hide cursor v2
1 parent 1a372c2 commit db419e6

File tree

6 files changed

+70
-4
lines changed

6 files changed

+70
-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: 65
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-8c7e0b9069a18bc9437269618cde251ba15568771f2b4811d57f0d5f0fd5692d.yml
3-
openapi_spec_hash: aa2544d0bf0e7e875939aaa8e2e114d3
4-
config_hash: 0fbdda3a736cc2748ca33371871e61b3
1+
configured_endpoints: 66
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-86854c41729a6b26f71e26c906f665f69939f23e2d7adcc43380aee64cf6d056.yml
3+
openapi_spec_hash: 270a40c8af29e83cbda77d3700fd456a
4+
config_hash: 9421eb86b7f3f4b274f123279da3858e

api.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ Methods:
152152

153153
## Computer
154154

155+
Types:
156+
157+
- <code><a href="./src/resources/browsers/computer.ts">ComputerSetCursorVisibilityResponse</a></code>
158+
155159
Methods:
156160

157161
- <code title="post /browsers/{id}/computer/screenshot">client.browsers.computer.<a href="./src/resources/browsers/computer.ts">captureScreenshot</a>(id, { ...params }) -> Response</code>
@@ -160,6 +164,7 @@ Methods:
160164
- <code title="post /browsers/{id}/computer/move_mouse">client.browsers.computer.<a href="./src/resources/browsers/computer.ts">moveMouse</a>(id, { ...params }) -> void</code>
161165
- <code title="post /browsers/{id}/computer/press_key">client.browsers.computer.<a href="./src/resources/browsers/computer.ts">pressKey</a>(id, { ...params }) -> void</code>
162166
- <code title="post /browsers/{id}/computer/scroll">client.browsers.computer.<a href="./src/resources/browsers/computer.ts">scroll</a>(id, { ...params }) -> void</code>
167+
- <code title="post /browsers/{id}/computer/cursor">client.browsers.computer.<a href="./src/resources/browsers/computer.ts">setCursorVisibility</a>(id, { ...params }) -> ComputerSetCursorVisibilityResponse</code>
163168
- <code title="post /browsers/{id}/computer/type">client.browsers.computer.<a href="./src/resources/browsers/computer.ts">typeText</a>(id, { ...params }) -> void</code>
164169

165170
## Playwright

src/resources/browsers/browsers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {
1111
ComputerMoveMouseParams,
1212
ComputerPressKeyParams,
1313
ComputerScrollParams,
14+
ComputerSetCursorVisibilityParams,
15+
ComputerSetCursorVisibilityResponse,
1416
ComputerTypeTextParams,
1517
} from './computer';
1618
import * as LogsAPI from './logs';
@@ -759,12 +761,14 @@ export declare namespace Browsers {
759761

760762
export {
761763
Computer as Computer,
764+
type ComputerSetCursorVisibilityResponse as ComputerSetCursorVisibilityResponse,
762765
type ComputerCaptureScreenshotParams as ComputerCaptureScreenshotParams,
763766
type ComputerClickMouseParams as ComputerClickMouseParams,
764767
type ComputerDragMouseParams as ComputerDragMouseParams,
765768
type ComputerMoveMouseParams as ComputerMoveMouseParams,
766769
type ComputerPressKeyParams as ComputerPressKeyParams,
767770
type ComputerScrollParams as ComputerScrollParams,
771+
type ComputerSetCursorVisibilityParams as ComputerSetCursorVisibilityParams,
768772
type ComputerTypeTextParams as ComputerTypeTextParams,
769773
};
770774

src/resources/browsers/computer.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,25 @@ export class Computer extends APIResource {
125125
});
126126
}
127127

128+
/**
129+
* Set cursor visibility
130+
*
131+
* @example
132+
* ```ts
133+
* const response =
134+
* await client.browsers.computer.setCursorVisibility('id', {
135+
* hidden: true,
136+
* });
137+
* ```
138+
*/
139+
setCursorVisibility(
140+
id: string,
141+
body: ComputerSetCursorVisibilityParams,
142+
options?: RequestOptions,
143+
): APIPromise<ComputerSetCursorVisibilityResponse> {
144+
return this._client.post(path`/browsers/${id}/computer/cursor`, { body, ...options });
145+
}
146+
128147
/**
129148
* Type text on the browser instance
130149
*
@@ -144,6 +163,16 @@ export class Computer extends APIResource {
144163
}
145164
}
146165

166+
/**
167+
* Generic OK response.
168+
*/
169+
export interface ComputerSetCursorVisibilityResponse {
170+
/**
171+
* Indicates success.
172+
*/
173+
ok: boolean;
174+
}
175+
147176
export interface ComputerCaptureScreenshotParams {
148177
region?: ComputerCaptureScreenshotParams.Region;
149178
}
@@ -303,6 +332,13 @@ export interface ComputerScrollParams {
303332
hold_keys?: Array<string>;
304333
}
305334

335+
export interface ComputerSetCursorVisibilityParams {
336+
/**
337+
* Whether the cursor should be hidden or visible
338+
*/
339+
hidden: boolean;
340+
}
341+
306342
export interface ComputerTypeTextParams {
307343
/**
308344
* Text to type on the browser instance
@@ -317,12 +353,14 @@ export interface ComputerTypeTextParams {
317353

318354
export declare namespace Computer {
319355
export {
356+
type ComputerSetCursorVisibilityResponse as ComputerSetCursorVisibilityResponse,
320357
type ComputerCaptureScreenshotParams as ComputerCaptureScreenshotParams,
321358
type ComputerClickMouseParams as ComputerClickMouseParams,
322359
type ComputerDragMouseParams as ComputerDragMouseParams,
323360
type ComputerMoveMouseParams as ComputerMoveMouseParams,
324361
type ComputerPressKeyParams as ComputerPressKeyParams,
325362
type ComputerScrollParams as ComputerScrollParams,
363+
type ComputerSetCursorVisibilityParams as ComputerSetCursorVisibilityParams,
326364
type ComputerTypeTextParams as ComputerTypeTextParams,
327365
};
328366
}

src/resources/browsers/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ export {
1313
} from './browsers';
1414
export {
1515
Computer,
16+
type ComputerSetCursorVisibilityResponse,
1617
type ComputerCaptureScreenshotParams,
1718
type ComputerClickMouseParams,
1819
type ComputerDragMouseParams,
1920
type ComputerMoveMouseParams,
2021
type ComputerPressKeyParams,
2122
type ComputerScrollParams,
23+
type ComputerSetCursorVisibilityParams,
2224
type ComputerTypeTextParams,
2325
} from './computer';
2426
export {

tests/api-resources/browsers/computer.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,23 @@ describe('resource computer', () => {
136136
});
137137
});
138138

139+
// Prism tests are disabled
140+
test.skip('setCursorVisibility: only required params', async () => {
141+
const responsePromise = client.browsers.computer.setCursorVisibility('id', { hidden: true });
142+
const rawResponse = await responsePromise.asResponse();
143+
expect(rawResponse).toBeInstanceOf(Response);
144+
const response = await responsePromise;
145+
expect(response).not.toBeInstanceOf(Response);
146+
const dataAndResponse = await responsePromise.withResponse();
147+
expect(dataAndResponse.data).toBe(response);
148+
expect(dataAndResponse.response).toBe(rawResponse);
149+
});
150+
151+
// Prism tests are disabled
152+
test.skip('setCursorVisibility: required and optional params', async () => {
153+
const response = await client.browsers.computer.setCursorVisibility('id', { hidden: true });
154+
});
155+
139156
// Prism tests are disabled
140157
test.skip('typeText: only required params', async () => {
141158
const responsePromise = client.browsers.computer.typeText('id', { text: 'text' });

0 commit comments

Comments
 (0)