@ntegral/sendgrid-client
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,2 @@ | ||
import { ClientResponse } from "@sendgrid/client/src/response"; | ||
export declare namespace resource { | ||
@@ -102,4 +103,4 @@ namespace Mail { | ||
} | ||
function send(model: MailData): Promise<[import("@sendgrid/client/src/response").ClientResponse, any]>; | ||
function send(model: MailData): Promise<[ClientResponse, any]>; | ||
} | ||
} |
@@ -15,3 +15,12 @@ "use strict"; | ||
}; | ||
return client.request(data); | ||
return new Promise((resolve, reject) => { | ||
client.request(data, (err, resp) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(resp); | ||
} | ||
}); | ||
}); | ||
} | ||
@@ -18,0 +27,0 @@ Mail.send = send; |
import client = require("@sendgrid/client"); | ||
import {ResponseError} from "@sendgrid/helpers/classes"; | ||
import { ClientRequest } from "@sendgrid/client/src/request"; | ||
import { ClientResponse } from "@sendgrid/client/src/response"; | ||
@@ -222,3 +224,3 @@ export namespace resource { | ||
export function send(model: MailData) { | ||
export function send(model: MailData): Promise<[ClientResponse,any]> { | ||
const data: ClientRequest = { | ||
@@ -230,5 +232,22 @@ method: "POST", | ||
return client.request(data); | ||
/* | ||
client.request(data).then((result:ClientResponse) => { | ||
resolve(result); | ||
}).catch((err) => { | ||
reject(err); | ||
}) | ||
*/ | ||
return new Promise((resolve, reject) => { | ||
client.request(data, (err:ResponseError, resp: [ClientResponse,any])=> { | ||
if (err) { | ||
reject(err); | ||
} | ||
else { | ||
resolve(resp); | ||
} | ||
}) | ||
}); | ||
} | ||
} | ||
} |
@@ -10,3 +10,3 @@ { | ||
"name": "@ntegral/sendgrid-client", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Client for the SendGrid v3 Web API", | ||
@@ -13,0 +13,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21943
525