tempmail-sdk 1.0.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.
@@ -0,0 +1,48 @@
1
+ import { generateEmail, getEmails, TempEmailClient, Channel } from '../src';
2
+
3
+ async function testGenerateEmail() {
4
+ console.log('=== Test Generate Email ===\n');
5
+
6
+ // Test each channel
7
+ const channels: Channel[] = ['tempmail', 'linshi-email', 'tempmail-lol', 'chatgpt-org-uk'];
8
+
9
+ for (const channel of channels) {
10
+ try {
11
+ console.log(`Testing channel: ${channel}`);
12
+ const emailInfo = await generateEmail({ channel });
13
+ console.log(` Channel: ${emailInfo.channel}`);
14
+ console.log(` Email: ${emailInfo.email}`);
15
+ if (emailInfo.token) console.log(` Token: ${emailInfo.token}`);
16
+ if (emailInfo.expiresAt) console.log(` Expires: ${emailInfo.expiresAt}`);
17
+ console.log();
18
+ } catch (error) {
19
+ console.error(` Error: ${error}`);
20
+ console.log();
21
+ }
22
+ }
23
+ }
24
+
25
+ async function testGetEmails() {
26
+ console.log('=== Test Get Emails ===\n');
27
+
28
+ // Generate and check emails using client
29
+ const client = new TempEmailClient();
30
+
31
+ try {
32
+ const emailInfo = await client.generate({ channel: 'tempmail' });
33
+ console.log(`Generated: ${emailInfo.channel} - ${emailInfo.email}`);
34
+
35
+ const result = await client.getEmails();
36
+ console.log(`Emails count: ${result.emails.length}`);
37
+ console.log();
38
+ } catch (error) {
39
+ console.error(`Error: ${error}`);
40
+ }
41
+ }
42
+
43
+ async function main() {
44
+ await testGenerateEmail();
45
+ await testGetEmails();
46
+ }
47
+
48
+ main().catch(console.error);
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "lib": ["ES2020", "DOM"],
6
+ "declaration": true,
7
+ "strict": true,
8
+ "noImplicitAny": true,
9
+ "strictNullChecks": true,
10
+ "noImplicitThis": true,
11
+ "alwaysStrict": true,
12
+ "noUnusedLocals": false,
13
+ "noUnusedParameters": false,
14
+ "noImplicitReturns": true,
15
+ "noFallthroughCasesInSwitch": false,
16
+ "inlineSourceMap": true,
17
+ "inlineSources": true,
18
+ "experimentalDecorators": true,
19
+ "strictPropertyInitialization": false,
20
+ "outDir": "./dist",
21
+ "rootDir": "./src",
22
+ "skipLibCheck": true,
23
+ "esModuleInterop": true
24
+ },
25
+ "include": ["src/**/*"],
26
+ "exclude": ["node_modules", "dist"]
27
+ }