mail-monster-lib 0.0.2 → 0.0.4
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.
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
multiply(number1: number, number2: number): number;
|
|
20
|
-
/**
|
|
21
|
-
* Divide two numbers
|
|
22
|
-
* @param number1 First number to be divided
|
|
23
|
-
* @param number2 Second number to divide
|
|
24
|
-
*/
|
|
25
|
-
divide(number1: number, number2: number): number;
|
|
26
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Parameters for fetching the latest emails via Mail Monster API.
|
|
3
|
+
*
|
|
4
|
+
* @property api_key - (Required) The API key used for authentication.
|
|
5
|
+
* @property email - (Optional) Only return messages for this recipient email address.
|
|
6
|
+
* @property title - (Optional) Case-insensitive substring to search for in the subject.
|
|
7
|
+
* @property keyword - (Optional) Case-insensitive string to match anywhere in subject, sender, content, or attachments.
|
|
8
|
+
* @property count - (Optional) Maximum number of email messages to return. Defaults to a small value if not specified.
|
|
9
|
+
*/
|
|
10
|
+
export interface IGetLatestEmailParams {
|
|
11
|
+
api_key: string;
|
|
12
|
+
email?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
keyword?: string;
|
|
15
|
+
count?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function getLatestEmails(params: IGetLatestEmailParams): Promise<string>;
|
package/dist/mail-monster-lib.js
CHANGED
|
@@ -1,39 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return number1 / number2;
|
|
37
|
-
},
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
38
36
|
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
var LATEST_EMAIL_ENDPOINT = 'https://mail-monster-api.create-flow.ai/api/latest?';
|
|
39
|
+
function getLatestEmails(params) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
41
|
+
var url, fetchEndpoint, response;
|
|
42
|
+
return __generator(this, function (_a) {
|
|
43
|
+
switch (_a.label) {
|
|
44
|
+
case 0:
|
|
45
|
+
url = new URL(LATEST_EMAIL_ENDPOINT);
|
|
46
|
+
url.searchParams.append('apikey', params.api_key);
|
|
47
|
+
if (params.email) {
|
|
48
|
+
url.searchParams.append('email', params.email);
|
|
49
|
+
}
|
|
50
|
+
if (params.title) {
|
|
51
|
+
url.searchParams.append('title', params.title);
|
|
52
|
+
}
|
|
53
|
+
if (params.keyword) {
|
|
54
|
+
url.searchParams.append('keyword', params.keyword);
|
|
55
|
+
}
|
|
56
|
+
if (params.count !== undefined) {
|
|
57
|
+
url.searchParams.append('count', String(params.count));
|
|
58
|
+
}
|
|
59
|
+
fetchEndpoint = url.toString();
|
|
60
|
+
return [4 /*yield*/, fetch(fetchEndpoint)];
|
|
61
|
+
case 1:
|
|
62
|
+
response = _a.sent();
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
throw new Error("Failed to fetch email: " + response.status + " " + response.statusText);
|
|
65
|
+
}
|
|
66
|
+
return [2 /*return*/, response.text()];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
exports.getLatestEmails = getLatestEmails;
|
|
39
72
|
//# sourceMappingURL=mail-monster-lib.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mail-monster-lib.js","sourceRoot":"","sources":["../src/mail-monster-lib.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mail-monster-lib.js","sourceRoot":"","sources":["../src/mail-monster-lib.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAM,qBAAqB,GAAG,qDAAqD,CAAC;AAmBpF,yBAAsC,MAA6B;;;;;;oBAC3D,GAAG,GAAG,IAAI,GAAG,CAAC,qBAAqB,CAAC,CAAC;oBAC3C,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;oBAClD,IAAI,MAAM,CAAC,KAAK,EAAE;wBAAE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;qBAAE;oBACrE,IAAI,MAAM,CAAC,KAAK,EAAE;wBAAE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;qBAAE;oBACrE,IAAI,MAAM,CAAC,OAAO,EAAE;wBAAE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;qBAAE;oBAC3E,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE;wBAAE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;qBAAE;oBACrF,aAAa,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;oBACpB,qBAAM,KAAK,CAAC,aAAa,CAAC,EAAA;;oBAArC,QAAQ,GAAG,SAA0B;oBAC3C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;wBAChB,MAAM,IAAI,KAAK,CAAC,4BAA0B,QAAQ,CAAC,MAAM,SAAI,QAAQ,CAAC,UAAY,CAAC,CAAC;qBACrF;oBACD,sBAAO,QAAQ,CAAC,IAAI,EAAE,EAAC;;;;CACxB;AAbD,0CAaC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value)}).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});var LATEST_EMAIL_ENDPOINT="https://mail-monster-api.create-flow.ai/api/latest?";function getLatestEmails(params){return __awaiter(this,void 0,void 0,function(){var url,fetchEndpoint,response;return __generator(this,function(_a){switch(_a.label){case 0:url=new URL(LATEST_EMAIL_ENDPOINT);url.searchParams.append("apikey",params.api_key);if(params.email){url.searchParams.append("email",params.email)}if(params.title){url.searchParams.append("title",params.title)}if(params.keyword){url.searchParams.append("keyword",params.keyword)}if(params.count!==undefined){url.searchParams.append("count",String(params.count))}fetchEndpoint=url.toString();return[4,fetch(fetchEndpoint)];case 1:response=_a.sent();if(!response.ok){throw new Error("Failed to fetch email: "+response.status+" "+response.statusText)}return[2,response.text()]}})})}exports.getLatestEmails=getLatestEmails;
|