redai-automation-web-sdk 1.9.20 → 1.10.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.
- package/dist/index.cjs +134 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +187 -1
- package/dist/index.d.ts +187 -1
- package/dist/index.mjs +132 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -74,6 +74,8 @@ __export(index_exports, {
|
|
|
74
74
|
SessionStatus: () => SessionStatus,
|
|
75
75
|
SortByField: () => SortByField,
|
|
76
76
|
SortOrder: () => SortOrder,
|
|
77
|
+
TelegramPersonalAuthService: () => TelegramPersonalAuthService,
|
|
78
|
+
TelegramPersonalMessagingService: () => TelegramPersonalMessagingService,
|
|
77
79
|
TextStyle: () => TextStyle,
|
|
78
80
|
ThreadType: () => ThreadType2,
|
|
79
81
|
Undo: () => Undo,
|
|
@@ -137,7 +139,7 @@ var HttpClient = class {
|
|
|
137
139
|
timeout: this.config.timeout || 3e4,
|
|
138
140
|
headers: {
|
|
139
141
|
"Content-Type": "application/json",
|
|
140
|
-
"User-Agent": this.config.userAgent || "redai-automation-web-sdk/1.
|
|
142
|
+
"User-Agent": this.config.userAgent || "redai-automation-web-sdk/1.10.1",
|
|
141
143
|
...this.config.apiKey && { Authorization: `Bearer ${this.config.apiKey}` }
|
|
142
144
|
}
|
|
143
145
|
});
|
|
@@ -383,7 +385,7 @@ var DEFAULT_CONFIG = {
|
|
|
383
385
|
timeout: 3e4,
|
|
384
386
|
retryCount: 0,
|
|
385
387
|
retryDelay: 0,
|
|
386
|
-
userAgent: "redai-automation-web-sdk/1.
|
|
388
|
+
userAgent: "redai-automation-web-sdk/1.10.1",
|
|
387
389
|
logging: false
|
|
388
390
|
};
|
|
389
391
|
var ThreadType = /* @__PURE__ */ ((ThreadType4) => {
|
|
@@ -3702,6 +3704,119 @@ var InstanceManagerService = class {
|
|
|
3702
3704
|
}
|
|
3703
3705
|
};
|
|
3704
3706
|
|
|
3707
|
+
// src/services/telegram-personal/telegram-personal-auth.service.ts
|
|
3708
|
+
var TelegramPersonalAuthService = class {
|
|
3709
|
+
constructor(httpClient) {
|
|
3710
|
+
this.httpClient = httpClient;
|
|
3711
|
+
}
|
|
3712
|
+
/**
|
|
3713
|
+
* Tạo mã QR để quét đăng nhập bằng ứng dụng di động Telegram
|
|
3714
|
+
*/
|
|
3715
|
+
async generateQr(request) {
|
|
3716
|
+
return this.httpClient.post(
|
|
3717
|
+
"/v1/telegram-personal/auth/qr",
|
|
3718
|
+
request || {}
|
|
3719
|
+
);
|
|
3720
|
+
}
|
|
3721
|
+
/**
|
|
3722
|
+
* Gửi mã OTP tới số điện thoại Telegram
|
|
3723
|
+
*/
|
|
3724
|
+
async sendCode(request) {
|
|
3725
|
+
return this.httpClient.post(
|
|
3726
|
+
"/v1/telegram-personal/auth/send-code",
|
|
3727
|
+
request
|
|
3728
|
+
);
|
|
3729
|
+
}
|
|
3730
|
+
/**
|
|
3731
|
+
* Xác thực mã OTP nhận được
|
|
3732
|
+
*/
|
|
3733
|
+
async verifyCode(request) {
|
|
3734
|
+
return this.httpClient.post(
|
|
3735
|
+
"/v1/telegram-personal/auth/verify-code",
|
|
3736
|
+
request
|
|
3737
|
+
);
|
|
3738
|
+
}
|
|
3739
|
+
/**
|
|
3740
|
+
* Xác thực mật khẩu 2FA (Cloud Password) nếu tài khoản có bật 2FA
|
|
3741
|
+
*/
|
|
3742
|
+
async verifyPassword(request) {
|
|
3743
|
+
return this.httpClient.post(
|
|
3744
|
+
"/v1/telegram-personal/auth/verify-password",
|
|
3745
|
+
request
|
|
3746
|
+
);
|
|
3747
|
+
}
|
|
3748
|
+
/**
|
|
3749
|
+
* Lấy trạng thái session đăng nhập hiện tại
|
|
3750
|
+
*/
|
|
3751
|
+
async getStatus(request) {
|
|
3752
|
+
return this.httpClient.post(
|
|
3753
|
+
"/v1/telegram-personal/auth/status",
|
|
3754
|
+
request
|
|
3755
|
+
);
|
|
3756
|
+
}
|
|
3757
|
+
/**
|
|
3758
|
+
* Ngắt kết nối và giải phóng session Telegram
|
|
3759
|
+
*/
|
|
3760
|
+
async disconnect(request) {
|
|
3761
|
+
return this.httpClient.post(
|
|
3762
|
+
"/v1/telegram-personal/auth/disconnect",
|
|
3763
|
+
request
|
|
3764
|
+
);
|
|
3765
|
+
}
|
|
3766
|
+
};
|
|
3767
|
+
|
|
3768
|
+
// src/services/telegram-personal/telegram-personal-messaging.service.ts
|
|
3769
|
+
var TelegramPersonalMessagingService = class {
|
|
3770
|
+
constructor(httpClient) {
|
|
3771
|
+
this.httpClient = httpClient;
|
|
3772
|
+
}
|
|
3773
|
+
/**
|
|
3774
|
+
* Gửi tin nhắn văn bản qua Telegram cá nhân
|
|
3775
|
+
*/
|
|
3776
|
+
async sendText(request) {
|
|
3777
|
+
return this.httpClient.post(
|
|
3778
|
+
"/v1/telegram-personal/messaging/send-text",
|
|
3779
|
+
request
|
|
3780
|
+
);
|
|
3781
|
+
}
|
|
3782
|
+
/**
|
|
3783
|
+
* Gửi ảnh/video/tài liệu qua Telegram cá nhân
|
|
3784
|
+
*/
|
|
3785
|
+
async sendMedia(request) {
|
|
3786
|
+
return this.httpClient.post(
|
|
3787
|
+
"/v1/telegram-personal/messaging/send-media",
|
|
3788
|
+
request
|
|
3789
|
+
);
|
|
3790
|
+
}
|
|
3791
|
+
/**
|
|
3792
|
+
* Thả reaction cảm xúc vào tin nhắn
|
|
3793
|
+
*/
|
|
3794
|
+
async sendReaction(request) {
|
|
3795
|
+
return this.httpClient.post(
|
|
3796
|
+
"/v1/telegram-personal/messaging/reaction",
|
|
3797
|
+
request
|
|
3798
|
+
);
|
|
3799
|
+
}
|
|
3800
|
+
/**
|
|
3801
|
+
* Thu hồi/xóa tin nhắn cho cả hai phía
|
|
3802
|
+
*/
|
|
3803
|
+
async deleteMessage(request) {
|
|
3804
|
+
return this.httpClient.post(
|
|
3805
|
+
"/v1/telegram-personal/messaging/delete",
|
|
3806
|
+
request
|
|
3807
|
+
);
|
|
3808
|
+
}
|
|
3809
|
+
/**
|
|
3810
|
+
* Chỉnh sửa nội dung tin nhắn đã gửi
|
|
3811
|
+
*/
|
|
3812
|
+
async editMessage(request) {
|
|
3813
|
+
return this.httpClient.post(
|
|
3814
|
+
"/v1/telegram-personal/messaging/edit",
|
|
3815
|
+
request
|
|
3816
|
+
);
|
|
3817
|
+
}
|
|
3818
|
+
};
|
|
3819
|
+
|
|
3705
3820
|
// src/client/AutomationWebClient.ts
|
|
3706
3821
|
var AutomationWebClient = class {
|
|
3707
3822
|
constructor(config) {
|
|
@@ -3727,6 +3842,8 @@ var AutomationWebClient = class {
|
|
|
3727
3842
|
this._zaloTool = new ZaloToolService(this.httpClient);
|
|
3728
3843
|
this._health = new HealthService(this.httpClient);
|
|
3729
3844
|
this._instanceManager = new InstanceManagerService(this.httpClient);
|
|
3845
|
+
this._telegramPersonalAuth = new TelegramPersonalAuthService(this.httpClient);
|
|
3846
|
+
this._telegramPersonalMessaging = new TelegramPersonalMessagingService(this.httpClient);
|
|
3730
3847
|
this.setupErrorHandling();
|
|
3731
3848
|
}
|
|
3732
3849
|
/**
|
|
@@ -3813,6 +3930,18 @@ var AutomationWebClient = class {
|
|
|
3813
3930
|
get instanceManager() {
|
|
3814
3931
|
return this._instanceManager;
|
|
3815
3932
|
}
|
|
3933
|
+
get telegramAuth() {
|
|
3934
|
+
return this._telegramPersonalAuth;
|
|
3935
|
+
}
|
|
3936
|
+
get telegramPersonalAuth() {
|
|
3937
|
+
return this._telegramPersonalAuth;
|
|
3938
|
+
}
|
|
3939
|
+
get telegramMessaging() {
|
|
3940
|
+
return this._telegramPersonalMessaging;
|
|
3941
|
+
}
|
|
3942
|
+
get telegramPersonalMessaging() {
|
|
3943
|
+
return this._telegramPersonalMessaging;
|
|
3944
|
+
}
|
|
3816
3945
|
/**
|
|
3817
3946
|
* Register webhook event handler
|
|
3818
3947
|
*/
|
|
@@ -4031,7 +4160,7 @@ var AutomationWebClient = class {
|
|
|
4031
4160
|
* Get SDK version
|
|
4032
4161
|
*/
|
|
4033
4162
|
getVersion() {
|
|
4034
|
-
return "1.
|
|
4163
|
+
return "1.10.1";
|
|
4035
4164
|
}
|
|
4036
4165
|
/**
|
|
4037
4166
|
* Test connection to automation-web API
|
|
@@ -5170,6 +5299,8 @@ var FormatUtils = class {
|
|
|
5170
5299
|
SessionStatus,
|
|
5171
5300
|
SortByField,
|
|
5172
5301
|
SortOrder,
|
|
5302
|
+
TelegramPersonalAuthService,
|
|
5303
|
+
TelegramPersonalMessagingService,
|
|
5173
5304
|
TextStyle,
|
|
5174
5305
|
ThreadType,
|
|
5175
5306
|
Undo,
|