@busy-app/busy-lib 0.3.0 → 0.4.0

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.
package/dist/index.d.ts CHANGED
@@ -2,14 +2,24 @@ declare type ApiKey = string;
2
2
 
3
3
  declare type ApiSemver = components["schemas"]["VersionInfo"]["api_semver"];
4
4
 
5
- declare interface AudioParams {
5
+ export declare interface AssetsDeleteParams {
6
+ appId: paths["/assets/upload"]["delete"]["parameters"]["query"]["app_id"];
7
+ }
8
+
9
+ export declare interface AssetsUploadParams {
10
+ appId: paths["/assets/upload"]["post"]["parameters"]["query"]["app_id"];
11
+ fileName: paths["/assets/upload"]["post"]["parameters"]["query"]["file"];
12
+ file: BusyFile;
13
+ }
14
+
15
+ export declare interface AudioPlayParams {
6
16
  appId: paths["/audio/play"]["post"]["parameters"]["query"]["app_id"];
7
17
  path: paths["/audio/play"]["post"]["parameters"]["query"]["path"];
8
18
  }
9
19
 
10
20
  export declare type AudioVolumeInfo = components["schemas"]["AudioVolumeInfo"];
11
21
 
12
- declare interface AudioVolumeParams {
22
+ export declare interface AudioVolumeParams {
13
23
  volume: operations["setAudioVolume"]["parameters"]["query"]["volume"];
14
24
  }
15
25
 
@@ -26,11 +36,6 @@ declare interface BaseConfig_2 {
26
36
 
27
37
  declare type Brightness = number | "auto";
28
38
 
29
- declare interface BrightnessParams {
30
- front?: Brightness;
31
- back?: Brightness;
32
- }
33
-
34
39
  /**
35
40
  * Main library class for interacting with the Busy Bar API.
36
41
  *
@@ -69,7 +74,7 @@ export declare class BusyBar {
69
74
  * @param {UpdateParams['file']} params.file - File data to upload.
70
75
  * @returns {Promise<SuccessResponse>} Result of the update operation.
71
76
  */
72
- updateFirmware(params: UpdateParams): Promise<SuccessResponse>;
77
+ updateFirmware(params: SystemUpdateParams): Promise<SuccessResponse>;
73
78
  /**
74
79
  * Gets the current status of the device, including system and power information.
75
80
  *
@@ -97,7 +102,7 @@ export declare class BusyBar {
97
102
  * @param {UploadParams['file']} params.file - File data to upload.
98
103
  * @returns {Promise<SuccessResponse>} Result of the upload operation.
99
104
  */
100
- uploadAsset(params: UploadParams): Promise<SuccessResponse>;
105
+ uploadAsset(params: AssetsUploadParams): Promise<SuccessResponse>;
101
106
  /**
102
107
  * Deletes all assets for a specific application from the device.
103
108
  *
@@ -105,7 +110,7 @@ export declare class BusyBar {
105
110
  * @param {DeleteParams['appId']} params.appId - Application ID whose assets should be deleted.
106
111
  * @returns {Promise<SuccessResponse>} Result of the delete operation.
107
112
  */
108
- deleteAssets(params: DeleteParams): Promise<SuccessResponse>;
113
+ deleteAssets(params: AssetsDeleteParams): Promise<SuccessResponse>;
109
114
  /**
110
115
  * Draws elements on the device display.
111
116
  *
@@ -114,7 +119,7 @@ export declare class BusyBar {
114
119
  * @param {DrawParams['elements'][]} params.elements - Array of display elements (text or image).
115
120
  * @returns {Promise<SuccessResponse>} Result of the draw operation.
116
121
  */
117
- drawDisplay(params: DrawParams): Promise<SuccessResponse>;
122
+ drawDisplay(params: DisplayDrawParams): Promise<SuccessResponse>;
118
123
  /**
119
124
  * Clears the device display and stops the Canvas application if running.
120
125
  *
@@ -124,12 +129,12 @@ export declare class BusyBar {
124
129
  /**
125
130
  * Plays an audio file from the assets directory.
126
131
  *
127
- * @param {AudioParams} params - Parameters for the audio playback.
128
- * @param {AudioParams['appId']} params.appId - Application ID for organizing assets.
129
- * @param {AudioParams['path']} params.path - Path to the audio file within the app's assets directory.
132
+ * @param {AudioPlayParams} params - Parameters for the audio playback.
133
+ * @param {AudioPlayParams['appId']} params.appId - Application ID for organizing assets.
134
+ * @param {AudioPlayParams['path']} params.path - Path to the audio file within the app's assets directory.
130
135
  * @returns {Promise<SuccessResponse>} Result of the play operation.
131
136
  */
132
- playSound(params: AudioParams): Promise<SuccessResponse>;
137
+ playSound(params: AudioPlayParams): Promise<SuccessResponse>;
133
138
  /**
134
139
  * Stops any currently playing audio on the device.
135
140
  *
@@ -169,7 +174,7 @@ export declare class BusyBar {
169
174
  * @param {ConnectParams['ipConfig']['gateway']} [params.ipConfig.gateway] - Gateway address (if using "static" method).
170
175
  * @returns {Promise<SuccessResponse>} Result of the connect operation.
171
176
  */
172
- connectWifi(params: ConnectParams): Promise<SuccessResponse>;
177
+ connectWifi(params: WifiConnectParams): Promise<SuccessResponse>;
173
178
  /**
174
179
  * Disconnects the device from the current Wi-Fi network.
175
180
  *
@@ -245,7 +250,7 @@ export declare class BusyBar {
245
250
  * @returns {Promise<SuccessResponse>} Result of the brightness update operation.
246
251
  * @throws {Error} If brightness value is outside the range 0-100 or not "auto".
247
252
  */
248
- setDisplayBrightness(params: BrightnessParams): Promise<SuccessResponse>;
253
+ setDisplayBrightness(params: DisplayBrightnessParams): Promise<SuccessResponse>;
249
254
  /**
250
255
  * Gets the current audio volume value.
251
256
  *
@@ -295,14 +300,14 @@ export declare class BusyBar {
295
300
  * Sends a button press.
296
301
  *
297
302
  * @param params - Button press parameters:
298
- * @param {InputKey['keyName']} params.keyName - Button key.
303
+ * @param {InputKeyParams['keyName']} params.keyName - Button key.
299
304
  * @example
300
305
  * {
301
306
  * keyName: "ok"
302
307
  * }
303
308
  * @returns {Promise<SuccessResponse>} Result of pressing the button.
304
309
  */
305
- pressButton(params: InputKey): Promise<SuccessResponse>;
310
+ pressButton(params: InputKeyParams): Promise<SuccessResponse>;
306
311
  }
307
312
 
308
313
  declare interface BusyBarConfig {
@@ -634,13 +639,11 @@ declare interface components {
634
639
  pathItems: never;
635
640
  }
636
641
 
637
- declare type ConnectParams = RequireKeys<Omit<CamelizedRequest, "ipConfig"> & {
638
- ipConfig: RequiredIpConfig;
639
- }, "ssid" | "security" | "ipConfig">;
640
-
641
- export declare interface CreateDirectoryParams {
642
+ declare interface CreateDirectoryParams {
642
643
  path: operations["createStorageDir"]["parameters"]["query"]["path"];
643
644
  }
645
+ export { CreateDirectoryParams }
646
+ export { CreateDirectoryParams as StorageCreateDirectoryParams }
644
647
 
645
648
  declare type CustomElement = CustomTextElement | CustomImageElement;
646
649
 
@@ -654,10 +657,6 @@ declare type DeepCamelize<T> = T extends (...args: any[]) => any ? T : T extends
654
657
  [K in keyof T as SnakeToCamel<K & string>]: DeepCamelize<T[K]>;
655
658
  } : T;
656
659
 
657
- declare interface DeleteParams {
658
- appId: paths["/assets/upload"]["delete"]["parameters"]["query"]["app_id"];
659
- }
660
-
661
660
  declare type DeviceConfig = LocalConfig | SiteConfig;
662
661
 
663
662
  declare type DeviceConfig_2 = LocalConfig_2 | SiteConfig_2;
@@ -669,16 +668,23 @@ export declare enum DeviceScreen {
669
668
 
670
669
  export declare type DisplayBrightnessInfo = components["schemas"]["DisplayBrightnessInfo"];
671
670
 
672
- export declare interface DownloadFileParams {
673
- path: operations["readStorageFile"]["parameters"]["query"]["path"];
674
- asArrayBuffer?: boolean;
671
+ export declare interface DisplayBrightnessParams {
672
+ front?: Brightness;
673
+ back?: Brightness;
675
674
  }
676
675
 
677
- declare interface DrawParams {
676
+ export declare interface DisplayDrawParams {
678
677
  appId: paths["/display/draw"]["post"]["requestBody"]["content"]["application/json"]["app_id"];
679
678
  elements: CustomElement[];
680
679
  }
681
680
 
681
+ declare interface DownloadFileParams {
682
+ path: operations["readStorageFile"]["parameters"]["query"]["path"];
683
+ asArrayBuffer?: boolean;
684
+ }
685
+ export { DownloadFileParams }
686
+ export { DownloadFileParams as StorageDownloadFileParams }
687
+
682
688
  declare type Error_2 = components["schemas"]["Error"];
683
689
  export { Error_2 as Error }
684
690
 
@@ -692,7 +698,7 @@ declare interface ErrorPayload {
692
698
 
693
699
  export declare type HttpAccessInfo = components["schemas"]["HttpAccessInfo"];
694
700
 
695
- declare interface HttpAccessParams {
701
+ export declare interface HttpAccessParams {
696
702
  mode: operations["setHttpAccess"]["parameters"]["query"]["mode"];
697
703
  key: operations["setHttpAccess"]["parameters"]["query"]["key"];
698
704
  }
@@ -722,7 +728,7 @@ export declare class Input {
722
728
  closeWebsocket(): Promise<void>;
723
729
  }
724
730
 
725
- declare interface InputKey {
731
+ export declare interface InputKeyParams {
726
732
  keyName: KeyName;
727
733
  }
728
734
 
@@ -2468,13 +2474,17 @@ declare interface paths {
2468
2474
  };
2469
2475
  }
2470
2476
 
2471
- export declare interface ReadDirectoryParams {
2477
+ declare interface ReadDirectoryParams {
2472
2478
  path: operations["listStorageFiles"]["parameters"]["query"]["path"];
2473
2479
  }
2480
+ export { ReadDirectoryParams }
2481
+ export { ReadDirectoryParams as StorageReadDirectoryParams }
2474
2482
 
2475
- export declare interface RemoveParams {
2483
+ declare interface RemoveParams {
2476
2484
  path: operations["removeStorageFile"]["parameters"]["query"]["path"];
2477
2485
  }
2486
+ export { RemoveParams }
2487
+ export { RemoveParams as StorageRemoveParams }
2478
2488
 
2479
2489
  declare type RequiredIpConfig = RequireKeys<NonNullable<CamelizedRequest["ipConfig"]>, "ipMethod" | "ipType">;
2480
2490
 
@@ -2536,24 +2546,24 @@ export declare type StorageReadResponse = ArrayBuffer | Blob;
2536
2546
 
2537
2547
  export declare type SuccessResponse = components["schemas"]["SuccessResponse"];
2538
2548
 
2539
- declare interface UpdateParams {
2549
+ export declare interface SystemUpdateParams {
2540
2550
  name?: string;
2541
2551
  file: BusyFile;
2542
2552
  }
2543
2553
 
2544
- export declare interface UploadFileParams {
2554
+ declare interface UploadFileParams {
2545
2555
  path: operations["writeStorageFile"]["parameters"]["query"]["path"];
2546
2556
  file: BusyFile;
2547
2557
  }
2548
-
2549
- declare interface UploadParams {
2550
- appId: paths["/assets/upload"]["post"]["parameters"]["query"]["app_id"];
2551
- fileName: paths["/assets/upload"]["post"]["parameters"]["query"]["file"];
2552
- file: BusyFile;
2553
- }
2558
+ export { UploadFileParams as StorageUploadFileParams }
2559
+ export { UploadFileParams }
2554
2560
 
2555
2561
  export declare type VersionInfo = components["schemas"]["VersionInfo"];
2556
2562
 
2563
+ export declare type WifiConnectParams = RequireKeys<Omit<CamelizedRequest, "ipConfig"> & {
2564
+ ipConfig: RequiredIpConfig;
2565
+ }, "ssid" | "security" | "ipConfig">;
2566
+
2557
2567
  export declare type WifiConnectRequestConfig = components["schemas"]["ConnectRequestConfig"];
2558
2568
 
2559
2569
  export declare type WifiIpMethod = components["schemas"]["WifiIpMethod"];
package/dist/index.js CHANGED
@@ -568,9 +568,9 @@ class lt {
568
568
  /**
569
569
  * Plays an audio file from the assets directory.
570
570
  *
571
- * @param {AudioParams} params - Parameters for the audio playback.
572
- * @param {AudioParams['appId']} params.appId - Application ID for organizing assets.
573
- * @param {AudioParams['path']} params.path - Path to the audio file within the app's assets directory.
571
+ * @param {AudioPlayParams} params - Parameters for the audio playback.
572
+ * @param {AudioPlayParams['appId']} params.appId - Application ID for organizing assets.
573
+ * @param {AudioPlayParams['path']} params.path - Path to the audio file within the app's assets directory.
574
574
  * @returns {Promise<SuccessResponse>} Result of the play operation.
575
575
  */
576
576
  async playSound(t) {
@@ -786,7 +786,7 @@ class lt {
786
786
  * Sends a button press.
787
787
  *
788
788
  * @param params - Button press parameters:
789
- * @param {InputKey['keyName']} params.keyName - Button key.
789
+ * @param {InputKeyParams['keyName']} params.keyName - Button key.
790
790
  * @example
791
791
  * {
792
792
  * keyName: "ok"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@busy-app/busy-lib",
3
3
  "private": false,
4
4
  "description": "A library for interacting with the BUSY Bar API",
5
- "version": "0.3.0",
5
+ "version": "0.4.0",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },