gmail-api-parse-message-ts
Advanced tools
Comparing version 2.2.25 to 2.2.26
# Versions | ||
## 2.2.26 | ||
add isValid?: boolean to interface IReceiver. comments: Optional. Possible to marked users non-valid emails, as not valid, for later evaluation | ||
## 2.2.25 | ||
@@ -7,3 +10,3 @@ bugFix, checks for undefined values indexHeaders(), causing runtime errors in certain cases | ||
## 2.2.24 | ||
updates removeUnwantedCharsFromName(), now removes also ',' from name | ||
updates removeUnwantedCharsFromName(), now removes also ',' from IReceiver {name} | ||
@@ -14,3 +17,3 @@ ## 2.2.23 | ||
## 2.2.22 | ||
Removes @ParseApiGmail function this.ensureNameFromSplit() -> {name} can be empty string | ||
Removes @ParseApiGmail function this.ensureNameFromSplit() -> IReceiver {name} can be empty string | ||
@@ -24,4 +27,5 @@ ## 2.2.21 | ||
## 2.2.19 | ||
DateStr renamed to SentDate and stored as number; SendDate gets updated header('date') or if missing from internalDate (gmail timestmap) | ||
further addes isUnread boolean to IEmail, based on the labelID = "unread" | ||
- DateStr renamed to SentDate and stored as number | ||
- SendDate gets updated header('date') or if missing from internalDate (gmail timestmap) | ||
- adds attribute isUnread: boolean to IEmail (set by labelIds containing "unread" | ||
@@ -35,3 +39,3 @@ ## 2.2.18 | ||
## 2.2.13 | ||
- adds cherry-picking option (similar to v2.0.0) having `subject`, `from`, `to`, `cc`, `bcc`, and `message-id` in the object. | ||
- adds cherry-picking option (similar to versions prior to v2.0.0) having `subject`, `from`, `to`, `cc`, `bcc`, and `message-id` in the object. | ||
- adds IReceiver interface {name: '', email:''} | ||
@@ -38,0 +42,0 @@ - uses 'klingsten snippets' as dependency (Strings.splitExceptQuotes, Strings.removeNonPrintingCharsAndSpaces) |
@@ -6,2 +6,4 @@ export interface IReceiver { | ||
email: string; | ||
/** Optional. Possible to marked users non-valid emails, as not valid, for later evaluation */ | ||
isValid?: boolean; | ||
} |
@@ -6,5 +6,7 @@ import { IEmail } from './iface/iemail'; | ||
constructor(); | ||
/** parses Gmail Api Response, and return a parse IGmail Object | ||
* @param {gmailApiResp} gmail api response | ||
* @returns {IEmail } with message parsed to textPlain or textHmtl, receivers, attachments, and | ||
/** parses a gmail-api message.resource object, and returns a IEmail Object | ||
* @param messages.resource | ||
* @returns IEmail | ||
* | ||
* messages.resource: https://developers.google.com/gmail/api/v1/reference/users/messages#resource | ||
*/ | ||
@@ -11,0 +13,0 @@ parseMessage(gmailApiResp: any): IEmail; |
@@ -9,5 +9,7 @@ "use strict"; | ||
constructor() { } | ||
/** parses Gmail Api Response, and return a parse IGmail Object | ||
* @param {gmailApiResp} gmail api response | ||
* @returns {IEmail } with message parsed to textPlain or textHmtl, receivers, attachments, and | ||
/** parses a gmail-api message.resource object, and returns a IEmail Object | ||
* @param messages.resource | ||
* @returns IEmail | ||
* | ||
* messages.resource: https://developers.google.com/gmail/api/v1/reference/users/messages#resource | ||
*/ | ||
@@ -14,0 +16,0 @@ parseMessage(gmailApiResp) { |
{ | ||
"name": "gmail-api-parse-message-ts", | ||
"version": "2.2.25", | ||
"version": "2.2.26", | ||
"description": "Parses Gmail API's GET method to iGmail object. Typescript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -14,4 +14,3 @@ [![npm][npm]][npm-url] | ||
```ts | ||
import { ParseGmailApi } from 'gmail-api-parse-message-ts'; | ||
import { IGmail } from 'gmail-api-parse-message-ts/dist/iface/iGmail'; | ||
import { ParseGmailApi, IEmail } from 'gmail-api-parse-message-ts'; | ||
@@ -32,5 +31,5 @@ export class ParseEmailService { | ||
const parse = new ParseGmailApi(); | ||
const gmailResponse = await getEmail('[id of your gmail message]'); | ||
const gmailResponse = await getEmailFromApi('[id of your gmail message]'); | ||
const email : IEmail = parse.parseMessage(gmailResponse); // returns IEmail object | ||
console.log(email); // see iGmail below | ||
console.log(email); // see IEmail below | ||
} | ||
@@ -40,3 +39,3 @@ } | ||
running parseEmail() which returns an iGmail object | ||
running parseEmail() which returns an IEmail object | ||
@@ -128,11 +127,21 @@ ```ts | ||
```ts | ||
/** | ||
* Takes a response from the Gmail API's GET message method and extracts all the relevant data. | ||
* @param {object} gmail api response - The response from the Gmail API parsed to a JavaScript object. | ||
* @return {iGmail object} | ||
*/ | ||
/** parses a gmail-api message.resource object, and returns a IEmail Object | ||
* @param messages.resource | ||
* @returns IEmail | ||
* messages.resource: https://developers.google.com/gmail/api/v1/reference/users/messages#resource */ | ||
parseMessage(response); | ||
/** get a empty email object | ||
* @returns IEmail object */ | ||
getEmptyEmail(); | ||
/** parses a string containing one or more names/emails, and returns them as IReceivers[] | ||
* @param string | ||
* @returns IReceiver[] | ||
* | ||
* example usage: | ||
* parseReceivers("lars@kltn.net, 'lars' lk@kl.net"); | ||
* returns -> [ {name:"", email: "lars@kltn.net"}, { name:"lars", email:"lk@kl.net" } ] */ | ||
parseReceivers(receiverStr): IReceiver[] { | ||
``` | ||
@@ -139,0 +148,0 @@ |
Sorry, the diff of this file is not supported yet
36224
460
154