tempmail-sdk 1.0.1 → 1.0.2
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/README.md +162 -72
- package/demo/poll-emails.ts +25 -40
- package/dist/index.d.ts +2 -1
- package/dist/index.js +55 -4
- package/dist/normalize.d.ts +5 -0
- package/dist/normalize.js +87 -0
- package/dist/providers/awamail.d.ts +15 -0
- package/dist/providers/awamail.js +91 -0
- package/dist/providers/chatgpt-org-uk.js +4 -2
- package/dist/providers/dropmail.d.ts +13 -0
- package/dist/providers/dropmail.js +86 -0
- package/dist/providers/linshi-email.js +4 -2
- package/dist/providers/mail-tm.d.ts +11 -0
- package/dist/providers/mail-tm.js +167 -0
- package/dist/providers/temp-mail-io.d.ts +13 -0
- package/dist/providers/temp-mail-io.js +69 -0
- package/dist/providers/tempmail-la.d.ts +15 -0
- package/dist/providers/tempmail-la.js +89 -0
- package/dist/providers/tempmail-lol.d.ts +1 -1
- package/dist/providers/tempmail-lol.js +5 -3
- package/dist/providers/tempmail.js +4 -2
- package/dist/types.d.ts +31 -28
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +54 -4
- package/src/normalize.ts +80 -0
- package/src/providers/awamail.ts +101 -0
- package/src/providers/chatgpt-org-uk.ts +3 -1
- package/src/providers/dropmail.ts +98 -0
- package/src/providers/linshi-email.ts +3 -1
- package/src/providers/mail-tm.ts +188 -0
- package/src/providers/temp-mail-io.ts +76 -0
- package/src/providers/tempmail-la.ts +99 -0
- package/src/providers/tempmail-lol.ts +4 -2
- package/src/providers/tempmail.ts +3 -1
- package/src/types.ts +32 -28
- package/test/example.ts +16 -1
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type Channel = 'tempmail' | 'linshi-email' | 'tempmail-lol' | 'chatgpt-org-uk';
|
|
1
|
+
export type Channel = 'tempmail' | 'linshi-email' | 'tempmail-lol' | 'chatgpt-org-uk' | 'tempmail-la' | 'temp-mail-io' | 'awamail' | 'mail-tm' | 'dropmail';
|
|
2
2
|
|
|
3
3
|
export interface EmailInfo {
|
|
4
4
|
channel: Channel;
|
|
@@ -8,34 +8,38 @@ export interface EmailInfo {
|
|
|
8
8
|
createdAt?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* 标准化邮件附件
|
|
13
|
+
*/
|
|
14
|
+
export interface EmailAttachment {
|
|
15
|
+
filename: string;
|
|
16
|
+
size?: number;
|
|
17
|
+
contentType?: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 标准化邮件格式 - 所有提供商返回统一结构
|
|
23
|
+
*/
|
|
11
24
|
export interface Email {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
date?: string | number;
|
|
31
|
-
e_date?: number;
|
|
32
|
-
timestamp?: number;
|
|
33
|
-
received_at?: string;
|
|
34
|
-
created_at?: string;
|
|
35
|
-
createdAt?: string;
|
|
36
|
-
is_read?: number;
|
|
37
|
-
has_html?: boolean;
|
|
38
|
-
[key: string]: any;
|
|
25
|
+
/** 邮件唯一标识 */
|
|
26
|
+
id: string;
|
|
27
|
+
/** 发件人邮箱地址 */
|
|
28
|
+
from: string;
|
|
29
|
+
/** 收件人邮箱地址 */
|
|
30
|
+
to: string;
|
|
31
|
+
/** 邮件主题 */
|
|
32
|
+
subject: string;
|
|
33
|
+
/** 纯文本内容 */
|
|
34
|
+
text: string;
|
|
35
|
+
/** HTML 内容 */
|
|
36
|
+
html: string;
|
|
37
|
+
/** ISO 8601 格式的日期字符串 */
|
|
38
|
+
date: string;
|
|
39
|
+
/** 是否已读 */
|
|
40
|
+
isRead: boolean;
|
|
41
|
+
/** 附件列表 */
|
|
42
|
+
attachments: EmailAttachment[];
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
export interface GetEmailsResult {
|
package/test/example.ts
CHANGED
|
@@ -4,7 +4,7 @@ async function testGenerateEmail() {
|
|
|
4
4
|
console.log('=== Test Generate Email ===\n');
|
|
5
5
|
|
|
6
6
|
// Test each channel
|
|
7
|
-
const channels: Channel[] = ['tempmail', 'linshi-email', 'tempmail-lol', 'chatgpt-org-uk'];
|
|
7
|
+
const channels: Channel[] = ['tempmail', 'linshi-email', 'tempmail-lol', 'chatgpt-org-uk', 'tempmail-la', 'temp-mail-io', 'awamail', 'mail-tm', 'dropmail'];
|
|
8
8
|
|
|
9
9
|
for (const channel of channels) {
|
|
10
10
|
try {
|
|
@@ -14,6 +14,7 @@ async function testGenerateEmail() {
|
|
|
14
14
|
console.log(` Email: ${emailInfo.email}`);
|
|
15
15
|
if (emailInfo.token) console.log(` Token: ${emailInfo.token}`);
|
|
16
16
|
if (emailInfo.expiresAt) console.log(` Expires: ${emailInfo.expiresAt}`);
|
|
17
|
+
if (emailInfo.createdAt) console.log(` Created: ${emailInfo.createdAt}`);
|
|
17
18
|
console.log();
|
|
18
19
|
} catch (error) {
|
|
19
20
|
console.error(` Error: ${error}`);
|
|
@@ -34,6 +35,20 @@ async function testGetEmails() {
|
|
|
34
35
|
|
|
35
36
|
const result = await client.getEmails();
|
|
36
37
|
console.log(`Emails count: ${result.emails.length}`);
|
|
38
|
+
|
|
39
|
+
// 展示标准化的邮件格式
|
|
40
|
+
for (const email of result.emails) {
|
|
41
|
+
console.log(` ID: ${email.id}`);
|
|
42
|
+
console.log(` From: ${email.from}`);
|
|
43
|
+
console.log(` To: ${email.to}`);
|
|
44
|
+
console.log(` Subject: ${email.subject}`);
|
|
45
|
+
console.log(` Date: ${email.date}`);
|
|
46
|
+
console.log(` IsRead: ${email.isRead}`);
|
|
47
|
+
console.log(` Text: ${email.text.substring(0, 100)}`);
|
|
48
|
+
console.log(` HTML: ${email.html.substring(0, 100)}`);
|
|
49
|
+
console.log(` Attachments: ${email.attachments.length}`);
|
|
50
|
+
console.log();
|
|
51
|
+
}
|
|
37
52
|
console.log();
|
|
38
53
|
} catch (error) {
|
|
39
54
|
console.error(`Error: ${error}`);
|