assistsx-js 0.0.2038 → 0.0.2040

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.
@@ -38,6 +38,16 @@ export interface RecognizeTextRegion {
38
38
  width?: number;
39
39
  height?: number;
40
40
  }
41
+ /**
42
+ * 联系人信息
43
+ */
44
+ export interface Contact {
45
+ id: string;
46
+ name: string;
47
+ phoneNumbers: string[];
48
+ emails: string[];
49
+ address: string;
50
+ }
41
51
  export declare class AssistsXAsync {
42
52
  /**
43
53
  * 执行异步调用
@@ -98,7 +108,7 @@ export declare class AssistsXAsync {
98
108
  * @param param0 识别参数
99
109
  * @returns 截图识别结果
100
110
  */
101
- static recognizeTextInScreenshot(targetText: string, { rotationDegrees, overlayHiddenScreenshotDelayMillis, restoreOverlay, region, timeout, }: {
111
+ static recognizeTextInScreenshot(targetText: string, options?: {
102
112
  rotationDegrees?: number;
103
113
  overlayHiddenScreenshotDelayMillis?: number;
104
114
  restoreOverlay?: boolean;
@@ -432,4 +442,18 @@ export declare class AssistsXAsync {
432
442
  static audioStop({ timeout, }: {
433
443
  timeout?: number;
434
444
  }): Promise<boolean | null | undefined>;
445
+ /**
446
+ * 添加联系人
447
+ * @param name 联系人姓名(必填)
448
+ * @param phoneNumber 电话号码(必填)
449
+ * @param timeout 超时时间(秒),默认30秒
450
+ * @returns 是否添加成功
451
+ */
452
+ static addContact(name: string, phoneNumber: string, timeout?: number): Promise<boolean>;
453
+ /**
454
+ * 获取所有联系人
455
+ * @param timeout 超时时间(秒),默认30秒
456
+ * @returns 联系人列表
457
+ */
458
+ static getAllContacts(timeout?: number): Promise<Contact[]>;
435
459
  }
@@ -124,7 +124,8 @@ export class AssistsXAsync {
124
124
  * @param param0 识别参数
125
125
  * @returns 截图识别结果
126
126
  */
127
- static async recognizeTextInScreenshot(targetText, { rotationDegrees, overlayHiddenScreenshotDelayMillis, restoreOverlay = true, region, timeout, }) {
127
+ static async recognizeTextInScreenshot(targetText, options = {}) {
128
+ const { rotationDegrees = 0, overlayHiddenScreenshotDelayMillis = 250, restoreOverlay = true, region, timeout, } = options;
128
129
  const response = await this.asyncCall(CallMethod.recognizeTextInScreenshot, {
129
130
  args: {
130
131
  targetText,
@@ -680,4 +681,29 @@ export class AssistsXAsync {
680
681
  });
681
682
  return response.getDataOrDefault(false);
682
683
  }
684
+ /**
685
+ * 添加联系人
686
+ * @param name 联系人姓名(必填)
687
+ * @param phoneNumber 电话号码(必填)
688
+ * @param timeout 超时时间(秒),默认30秒
689
+ * @returns 是否添加成功
690
+ */
691
+ static async addContact(name, phoneNumber, timeout) {
692
+ const response = await this.asyncCall(CallMethod.addContact, {
693
+ args: { name, phoneNumber },
694
+ timeout,
695
+ });
696
+ return response.getDataOrDefault(false);
697
+ }
698
+ /**
699
+ * 获取所有联系人
700
+ * @param timeout 超时时间(秒),默认30秒
701
+ * @returns 联系人列表
702
+ */
703
+ static async getAllContacts(timeout) {
704
+ const response = await this.asyncCall(CallMethod.getAllContacts, {
705
+ timeout,
706
+ });
707
+ return response.getDataOrDefault([]);
708
+ }
683
709
  }
@@ -56,5 +56,7 @@ export declare const CallMethod: {
56
56
  readonly download: "download";
57
57
  readonly audioPlayFromFile: "audioPlayFromFile";
58
58
  readonly audioStop: "audioStop";
59
+ readonly addContact: "addContact";
60
+ readonly getAllContacts: "getAllContacts";
59
61
  };
60
62
  export type CallMethodType = (typeof CallMethod)[keyof typeof CallMethod];
@@ -57,4 +57,7 @@ export const CallMethod = {
57
57
  download: "download",
58
58
  audioPlayFromFile: "audioPlayFromFile",
59
59
  audioStop: "audioStop",
60
+ // 通讯录相关方法
61
+ addContact: "addContact",
62
+ getAllContacts: "getAllContacts",
60
63
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.0.2038",
3
+ "version": "0.0.2040",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -51,6 +51,17 @@ export interface RecognizeTextRegion {
51
51
  height?: number;
52
52
  }
53
53
 
54
+ /**
55
+ * 联系人信息
56
+ */
57
+ export interface Contact {
58
+ id: string;
59
+ name: string;
60
+ phoneNumbers: string[];
61
+ emails: string[];
62
+ address: string;
63
+ }
64
+
54
65
  export class AssistsXAsync {
55
66
  /**
56
67
  * 执行异步调用
@@ -208,20 +219,22 @@ export class AssistsXAsync {
208
219
  */
209
220
  public static async recognizeTextInScreenshot(
210
221
  targetText: string,
211
- {
212
- rotationDegrees,
213
- overlayHiddenScreenshotDelayMillis,
214
- restoreOverlay = true,
215
- region,
216
- timeout,
217
- }: {
222
+ options: {
218
223
  rotationDegrees?: number;
219
224
  overlayHiddenScreenshotDelayMillis?: number;
220
225
  restoreOverlay?: boolean;
221
226
  region?: RecognizeTextRegion;
222
227
  timeout?: number;
223
- }
228
+ } = {}
224
229
  ): Promise<RecognizeTextInScreenshotResult> {
230
+ const {
231
+ rotationDegrees = 0,
232
+ overlayHiddenScreenshotDelayMillis = 250,
233
+ restoreOverlay = true,
234
+ region,
235
+ timeout,
236
+ } = options;
237
+
225
238
  const response = await this.asyncCall(
226
239
  CallMethod.recognizeTextInScreenshot,
227
240
  {
@@ -1028,6 +1041,37 @@ export class AssistsXAsync {
1028
1041
  return response.getDataOrDefault(false);
1029
1042
  }
1030
1043
 
1044
+ /**
1045
+ * 添加联系人
1046
+ * @param name 联系人姓名(必填)
1047
+ * @param phoneNumber 电话号码(必填)
1048
+ * @param timeout 超时时间(秒),默认30秒
1049
+ * @returns 是否添加成功
1050
+ */
1051
+ public static async addContact(
1052
+ name: string,
1053
+ phoneNumber: string,
1054
+ timeout?: number
1055
+ ): Promise<boolean> {
1056
+ const response = await this.asyncCall(CallMethod.addContact, {
1057
+ args: { name, phoneNumber },
1058
+ timeout,
1059
+ });
1060
+ return response.getDataOrDefault(false);
1061
+ }
1062
+
1063
+ /**
1064
+ * 获取所有联系人
1065
+ * @param timeout 超时时间(秒),默认30秒
1066
+ * @returns 联系人列表
1067
+ */
1068
+ public static async getAllContacts(timeout?: number): Promise<Contact[]> {
1069
+ const response = await this.asyncCall(CallMethod.getAllContacts, {
1070
+ timeout,
1071
+ });
1072
+ return response.getDataOrDefault([]);
1073
+ }
1074
+
1031
1075
  /**
1032
1076
  * 发送HTTP请求
1033
1077
  * @param options 请求选项
package/src/CallMethod.ts CHANGED
@@ -61,6 +61,10 @@ export const CallMethod = {
61
61
  download: "download",
62
62
  audioPlayFromFile: "audioPlayFromFile",
63
63
  audioStop: "audioStop",
64
+
65
+ // 通讯录相关方法
66
+ addContact: "addContact",
67
+ getAllContacts: "getAllContacts",
64
68
  } as const;
65
69
 
66
70
  // 导出类型定义