cyberdesk 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +91 -0
  3. package/package.json +1 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Cyberdesk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # cyberdesk
2
+
3
+ [![npm version](https://badge.fury.io/js/cyberdesk.svg)](https://badge.fury.io/js/cyberdesk)
4
+
5
+ The official TypeScript SDK for Cyberdesk.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install cyberdesk
11
+ # or
12
+ yarn add cyberdesk
13
+ # or
14
+ pnpm add cyberdesk
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ First, configure the client, for example, by setting default headers for authentication. You only need to do this once.
20
+
21
+ ```typescript
22
+ import { client, setConfig } from 'cyberdesk/client'; // Import client and setConfig
23
+
24
+ // Configure the client (e.g., with an API Key)
25
+ // Adjust based on your actual authentication method
26
+ setConfig({
27
+ headers: {
28
+ 'Authorization': `Bearer YOUR_API_KEY`
29
+ }
30
+ });
31
+ ```
32
+
33
+ Then, import and call the specific API functions you need:
34
+
35
+ ```typescript
36
+ import {
37
+ postV1Desktop,
38
+ postV1DesktopIdComputerAction,
39
+ type PostV1DesktopData,
40
+ type PostV1DesktopIdComputerActionData
41
+ } from 'cyberdesk';
42
+
43
+ async function createAndInteract() {
44
+ try {
45
+ // 1. Create a new desktop
46
+ console.log('Creating desktop...');
47
+ const createResponse = await postV1Desktop({
48
+ // Pass request body parameters inside the 'data' object
49
+ data: {
50
+ timeoutMs: 10000
51
+ }
52
+ // Headers like Authorization should be set globally via setConfig (see above)
53
+ });
54
+
55
+ if (!createResponse.data) {
56
+ throw new Error('Failed to create desktop: ' + (createResponse.error?.message || 'Unknown error'));
57
+ }
58
+
59
+ const desktopId = createResponse.data.id; // Assuming the response has an ID
60
+ console.log(`Desktop created with ID: ${desktopId}`);
61
+
62
+ // 2. Perform an action (e.g., a mouse click)
63
+ console.log(`Performing action on desktop ${desktopId}...`);
64
+ const actionData: PostV1DesktopIdComputerActionData['data'] = {
65
+ type: 'click_mouse', // Example action type
66
+ x: 100,
67
+ y: 150
68
+ };
69
+
70
+ const actionResponse = await postV1DesktopIdComputerAction({
71
+ path: { id: desktopId }, // Provide path parameters
72
+ data: actionData // Provide request body data
73
+ });
74
+
75
+ if (actionResponse.error) {
76
+ throw new Error(`Action failed: ${actionResponse.error.message}`);
77
+ }
78
+
79
+ console.log('Action successful:', actionResponse.data);
80
+
81
+ } catch (error) {
82
+ console.error('Error using Cyberdesk SDK:', error);
83
+ }
84
+ }
85
+
86
+ createAndInteract();
87
+ ```
88
+
89
+ ## License
90
+
91
+ [MIT](LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberdesk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "The official TypeScript SDK for Cyberdesk",
5
5
  "main": "dist/client/index.js",
6
6
  "types": "dist/client/index.d.ts",