assistsx-js 0.0.2021 → 0.0.2023

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.
@@ -42,6 +42,25 @@ export interface WebFloatingWindowOptions {
42
42
  maxHeight?: number;
43
43
  initialCenter?: boolean;
44
44
  }
45
+ /**
46
+ * HTTP请求选项接口定义
47
+ */
48
+ export interface HttpRequestOptions {
49
+ url: string;
50
+ method?: "GET" | "POST";
51
+ headers?: Record<string, string>;
52
+ body?: string;
53
+ timeout?: number;
54
+ }
55
+ /**
56
+ * HTTP响应数据接口定义
57
+ */
58
+ export interface HttpResponse {
59
+ statusCode: number;
60
+ statusMessage: string;
61
+ body: string;
62
+ headers: Record<string, string>;
63
+ }
45
64
  export declare const callbacks: Map<string, (data: string) => void>;
46
65
  export declare const accessibilityEventListeners: AccessibilityEventListener[];
47
66
  export declare class AssistsX {
@@ -364,6 +383,8 @@ export declare class AssistsX {
364
383
  static getUniqueDeviceId(): any;
365
384
  static getAndroidID(): any;
366
385
  static getMacAddress(): Promise<any>;
386
+ static getDeviceInfo(): Promise<any>;
387
+ static getNetworkInfo(): Promise<any>;
367
388
  static setAccessibilityEventFilters(value: AccessibilityEventFilter[]): Promise<any>;
368
389
  static addAccessibilityEventFilter(value: AccessibilityEventFilter): Promise<any>;
369
390
  /**
package/dist/AssistsX.js CHANGED
@@ -566,6 +566,14 @@ export class AssistsX {
566
566
  const response = await this.asyncCall(CallMethod.getMacAddress);
567
567
  return response.getDataOrDefault({});
568
568
  }
569
+ static async getDeviceInfo() {
570
+ const response = await this.asyncCall(CallMethod.getDeviceInfo);
571
+ return response.getDataOrDefault({});
572
+ }
573
+ static async getNetworkInfo() {
574
+ const response = await this.asyncCall(CallMethod.getNetworkInfo);
575
+ return response.getDataOrDefault({});
576
+ }
569
577
  static async setAccessibilityEventFilters(value) {
570
578
  const response = this.call(CallMethod.setAccessibilityEventFilters, {
571
579
  args: { value },
@@ -311,6 +311,7 @@ export declare class AssistsXAsync {
311
311
  static getUniqueDeviceId(): Promise<any>;
312
312
  static getAndroidID(): Promise<any>;
313
313
  static getMacAddress(): Promise<any>;
314
+ static getDeviceInfo(): Promise<any>;
314
315
  /**
315
316
  * 获取屏幕尺寸
316
317
  * @returns 屏幕尺寸对象
@@ -7,7 +7,7 @@ import { CallMethod } from "./CallMethod";
7
7
  import { CallResponse } from "./CallResponse";
8
8
  import { Bounds } from "./Bounds";
9
9
  import { generateUUID } from "./Utils";
10
- import { callbacks } from "./AssistsX";
10
+ import { callbacks, } from "./AssistsX";
11
11
  export class AssistsXAsync {
12
12
  /**
13
13
  * 执行异步调用
@@ -515,6 +515,10 @@ export class AssistsXAsync {
515
515
  const response = await this.asyncCall(CallMethod.getMacAddress);
516
516
  return response.getDataOrDefault({});
517
517
  }
518
+ static async getDeviceInfo() {
519
+ const response = await this.asyncCall(CallMethod.getDeviceInfo);
520
+ return response.getDataOrDefault({});
521
+ }
518
522
  /**
519
523
  * 获取屏幕尺寸
520
524
  * @returns 屏幕尺寸对象
@@ -44,5 +44,8 @@ export declare const CallMethod: {
44
44
  readonly getUniqueDeviceId: "getUniqueDeviceId";
45
45
  readonly addAccessibilityEventFilter: "addAccessibilityEventFilter";
46
46
  readonly setAccessibilityEventFilters: "setAccessibilityEventFilters";
47
+ readonly httpRequest: "httpRequest";
48
+ readonly getDeviceInfo: "getDeviceInfo";
49
+ readonly getNetworkInfo: "getNetworkInfo";
47
50
  };
48
51
  export type CallMethodType = (typeof CallMethod)[keyof typeof CallMethod];
@@ -45,4 +45,7 @@ export const CallMethod = {
45
45
  getUniqueDeviceId: "getUniqueDeviceId",
46
46
  addAccessibilityEventFilter: "addAccessibilityEventFilter",
47
47
  setAccessibilityEventFilters: "setAccessibilityEventFilters",
48
+ httpRequest: "httpRequest",
49
+ getDeviceInfo: "getDeviceInfo",
50
+ getNetworkInfo: "getNetworkInfo",
48
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2021",
3
+ "version": "0.0.2023",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/AssistsX.ts CHANGED
@@ -49,6 +49,27 @@ export interface WebFloatingWindowOptions {
49
49
  initialCenter?: boolean;
50
50
  }
51
51
 
52
+ /**
53
+ * HTTP请求选项接口定义
54
+ */
55
+ export interface HttpRequestOptions {
56
+ url: string;
57
+ method?: "GET" | "POST";
58
+ headers?: Record<string, string>;
59
+ body?: string;
60
+ timeout?: number;
61
+ }
62
+
63
+ /**
64
+ * HTTP响应数据接口定义
65
+ */
66
+ export interface HttpResponse {
67
+ statusCode: number;
68
+ statusMessage: string;
69
+ body: string;
70
+ headers: Record<string, string>;
71
+ }
72
+
52
73
  // 回调函数存储对象
53
74
  export const callbacks: Map<string, (data: string) => void> = new Map();
54
75
 
@@ -799,6 +820,14 @@ export class AssistsX {
799
820
  const response = await this.asyncCall(CallMethod.getMacAddress);
800
821
  return response.getDataOrDefault({});
801
822
  }
823
+ public static async getDeviceInfo(): Promise<any> {
824
+ const response = await this.asyncCall(CallMethod.getDeviceInfo);
825
+ return response.getDataOrDefault({});
826
+ }
827
+ public static async getNetworkInfo(): Promise<any> {
828
+ const response = await this.asyncCall(CallMethod.getNetworkInfo);
829
+ return response.getDataOrDefault({});
830
+ }
802
831
  public static async setAccessibilityEventFilters(
803
832
  value: AccessibilityEventFilter[]
804
833
  ): Promise<any> {
@@ -884,4 +913,24 @@ export class AssistsX {
884
913
  public static getAccessibilityEventListenerCount(): number {
885
914
  return accessibilityEventListeners.length;
886
915
  }
916
+
917
+ /**
918
+ * 发送HTTP请求
919
+ * @param options 请求选项
920
+ * @returns HTTP响应
921
+ */
922
+ // public static async httpRequest(
923
+ // options: HttpRequestOptions
924
+ // ): Promise<HttpResponse> {
925
+ // const { url, method = "GET", headers, body, timeout = 30 } = options;
926
+ // const response = await this.asyncCall(CallMethod.httpRequest, {
927
+ // args: { url, method, headers, body, timeout },
928
+ // });
929
+ // return response.getDataOrDefault({
930
+ // statusCode: -1,
931
+ // statusMessage: "",
932
+ // body: "",
933
+ // headers: {},
934
+ // });
935
+ // }
887
936
  }
@@ -7,7 +7,13 @@ import { CallMethod } from "./CallMethod";
7
7
  import { CallResponse } from "./CallResponse";
8
8
  import { Bounds } from "./Bounds";
9
9
  import { generateUUID } from "./Utils";
10
- import { AssistsX, callbacks, WebFloatingWindowOptions } from "./AssistsX";
10
+ import {
11
+ AssistsX,
12
+ callbacks,
13
+ WebFloatingWindowOptions,
14
+ HttpRequestOptions,
15
+ HttpResponse,
16
+ } from "./AssistsX";
11
17
 
12
18
  export class AssistsXAsync {
13
19
  /**
@@ -704,6 +710,10 @@ export class AssistsXAsync {
704
710
  const response = await this.asyncCall(CallMethod.getMacAddress);
705
711
  return response.getDataOrDefault({});
706
712
  }
713
+ public static async getDeviceInfo(): Promise<any> {
714
+ const response = await this.asyncCall(CallMethod.getDeviceInfo);
715
+ return response.getDataOrDefault({});
716
+ }
707
717
 
708
718
  /**
709
719
  * 获取屏幕尺寸
@@ -722,4 +732,24 @@ export class AssistsXAsync {
722
732
  const response = await this.asyncCall(CallMethod.getAppScreenSize);
723
733
  return response.getDataOrDefault("{}");
724
734
  }
735
+
736
+ /**
737
+ * 发送HTTP请求
738
+ * @param options 请求选项
739
+ * @returns HTTP响应
740
+ */
741
+ // public static async httpRequest(
742
+ // options: HttpRequestOptions
743
+ // ): Promise<HttpResponse> {
744
+ // const { url, method = "GET", headers, body, timeout = 30 } = options;
745
+ // const response = await this.asyncCall(CallMethod.httpRequest, {
746
+ // args: { url, method, headers, body, timeout },
747
+ // });
748
+ // return response.getDataOrDefault({
749
+ // statusCode: -1,
750
+ // statusMessage: "",
751
+ // body: "",
752
+ // headers: {},
753
+ // });
754
+ // }
725
755
  }
package/src/CallMethod.ts CHANGED
@@ -48,6 +48,10 @@ export const CallMethod = {
48
48
 
49
49
  addAccessibilityEventFilter: "addAccessibilityEventFilter",
50
50
  setAccessibilityEventFilters: "setAccessibilityEventFilters",
51
+
52
+ httpRequest: "httpRequest",
53
+ getDeviceInfo: "getDeviceInfo",
54
+ getNetworkInfo: "getNetworkInfo",
51
55
  } as const;
52
56
 
53
57
  // 导出类型定义