mailinator-client
Advanced tools
Comparing version 1.0.3 to 1.0.4
export declare const AUTHORIZATION: string; | ||
export declare const USERAGENT: string; | ||
export declare const COMMON_USER_AGENT = "Mailinator SDK - JS V1.0.4"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AUTHORIZATION = void 0; | ||
exports.COMMON_USER_AGENT = exports.USERAGENT = exports.AUTHORIZATION = void 0; | ||
exports.AUTHORIZATION = "Authorization"; | ||
exports.USERAGENT = "User-Agent"; | ||
exports.COMMON_USER_AGENT = 'Mailinator SDK - JS V1.0.4'; |
@@ -0,1 +1,3 @@ | ||
export * from './CreateDomainRequest'; | ||
export * from './DeleteDomainRequest'; | ||
export * from './Domain'; | ||
@@ -2,0 +4,0 @@ export * from './DomainType'; |
@@ -14,2 +14,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./CreateDomainRequest"), exports); | ||
__exportStar(require("./DeleteDomainRequest"), exports); | ||
__exportStar(require("./Domain"), exports); | ||
@@ -16,0 +18,0 @@ __exportStar(require("./DomainType"), exports); |
@@ -0,1 +1,2 @@ | ||
export * from './authenticator'; | ||
export * from './domain'; | ||
@@ -5,2 +6,3 @@ export * from './message'; | ||
export * from './stats'; | ||
export * from './webhook'; | ||
export * from './Constants'; | ||
@@ -11,1 +13,3 @@ export * from './MailinatorClient'; | ||
export * from './Request'; | ||
export * from './RequestWithoutToken'; | ||
export * from './ResponseStatus'; |
@@ -14,2 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./authenticator"), exports); | ||
__exportStar(require("./domain"), exports); | ||
@@ -19,2 +20,3 @@ __exportStar(require("./message"), exports); | ||
__exportStar(require("./stats"), exports); | ||
__exportStar(require("./webhook"), exports); | ||
__exportStar(require("./Constants"), exports); | ||
@@ -25,1 +27,3 @@ __exportStar(require("./MailinatorClient"), exports); | ||
__exportStar(require("./Request"), exports); | ||
__exportStar(require("./RequestWithoutToken"), exports); | ||
__exportStar(require("./ResponseStatus"), exports); |
import { Request } from './Request'; | ||
import { IRestResponse } from "typed-rest-client/RestClient"; | ||
import { RequestWithoutToken } from './RequestWithoutToken'; | ||
export declare class MailinatorClient { | ||
private readonly apiToken; | ||
constructor(apiToken: string); | ||
constructor(apiToken?: string); | ||
request<T>(request: Request<T>): Promise<IRestResponse<T>>; | ||
requestWithoutToken<T>(request: RequestWithoutToken<T>): Promise<IRestResponse<T>>; | ||
} |
@@ -9,5 +9,13 @@ "use strict"; | ||
request(request) { | ||
return request.execute(this.apiToken); | ||
if (this.apiToken) { | ||
return request.execute(this.apiToken); | ||
} | ||
else { | ||
throw new Error('API token is required for this request.'); | ||
} | ||
} | ||
requestWithoutToken(request) { | ||
return request.execute(); | ||
} | ||
} | ||
exports.MailinatorClient = MailinatorClient; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const restm = require("typed-rest-client/RestClient"); | ||
const restClient = new restm.RestClient('typed-rest-client'); | ||
const Constants_1 = require("./Constants"); | ||
const defaultHeaders = { | ||
[Constants_1.USERAGENT]: Constants_1.COMMON_USER_AGENT, | ||
}; | ||
const restClient = new restm.RestClient('typed-rest-client', undefined, undefined, defaultHeaders); | ||
exports.default = restClient; |
@@ -6,6 +6,5 @@ import { Request } from '../Request'; | ||
private readonly domain; | ||
private readonly inbox; | ||
private readonly messageId; | ||
constructor(domain: string, inbox: string, messageId: string); | ||
constructor(domain: string, messageId: string); | ||
execute(apiToken: string): Promise<IRestResponse<Message>>; | ||
} |
@@ -6,9 +6,8 @@ "use strict"; | ||
const Constants_1 = require("../Constants"); | ||
const _resolveTemplateUrl = (domain, inbox, messageId) => { | ||
return `https://api.mailinator.com/v2/domains/${domain}/inboxes/${inbox}/messages/${messageId}`; | ||
const _resolveTemplateUrl = (domain, messageId) => { | ||
return `https://api.mailinator.com/v2/domains/${domain}/messages/${messageId}`; | ||
}; | ||
class GetMessageRequest { | ||
constructor(domain, inbox, messageId) { | ||
constructor(domain, messageId) { | ||
this.domain = domain; | ||
this.inbox = inbox; | ||
this.messageId = messageId; | ||
@@ -22,5 +21,5 @@ } | ||
}; | ||
return MailinatorRestClient_1.default.get(_resolveTemplateUrl(this.domain, this.inbox, this.messageId), _options); | ||
return MailinatorRestClient_1.default.get(_resolveTemplateUrl(this.domain, this.messageId), _options); | ||
} | ||
} | ||
exports.GetMessageRequest = GetMessageRequest; |
@@ -7,7 +7,18 @@ export * from './Attachment'; | ||
export * from './DeletedMessages'; | ||
export * from './GetAttachmentRequest'; | ||
export * from './GetAttachmentsRequest'; | ||
export * from './EmailLogEntity'; | ||
export * from './GetInboxMessageAttachmentRequest'; | ||
export * from './GetInboxMessageAttachmentsRequest'; | ||
export * from './GetInboxMessageLinksRequest'; | ||
export * from './GetInboxMessageRawRequest'; | ||
export * from './GetInboxMessageRequest'; | ||
export * from './GetInboxMessageSmtpLogRequest'; | ||
export * from './GetInboxRequest'; | ||
export * from './GetLinksRequest'; | ||
export * from './GetLatestInboxMessagesRequest'; | ||
export * from './GetLatestMessagesRequest'; | ||
export * from './GetMessageAttachmentRequest'; | ||
export * from './GetMessageAttachmentsRequest'; | ||
export * from './GetMessageLinksRequest'; | ||
export * from './GetMessageRawRequest'; | ||
export * from './GetMessageRequest'; | ||
export * from './GetMessageSmtpLogRequest'; | ||
export * from './GetSmsInboxRequest'; | ||
@@ -21,2 +32,4 @@ export * from './Inbox'; | ||
export * from './PostedMessage'; | ||
export * from './RawData'; | ||
export * from './SmtpLogs'; | ||
export * from './Sort'; |
@@ -20,7 +20,18 @@ "use strict"; | ||
__exportStar(require("./DeletedMessages"), exports); | ||
__exportStar(require("./GetAttachmentRequest"), exports); | ||
__exportStar(require("./GetAttachmentsRequest"), exports); | ||
__exportStar(require("./EmailLogEntity"), exports); | ||
__exportStar(require("./GetInboxMessageAttachmentRequest"), exports); | ||
__exportStar(require("./GetInboxMessageAttachmentsRequest"), exports); | ||
__exportStar(require("./GetInboxMessageLinksRequest"), exports); | ||
__exportStar(require("./GetInboxMessageRawRequest"), exports); | ||
__exportStar(require("./GetInboxMessageRequest"), exports); | ||
__exportStar(require("./GetInboxMessageSmtpLogRequest"), exports); | ||
__exportStar(require("./GetInboxRequest"), exports); | ||
__exportStar(require("./GetLinksRequest"), exports); | ||
__exportStar(require("./GetLatestInboxMessagesRequest"), exports); | ||
__exportStar(require("./GetLatestMessagesRequest"), exports); | ||
__exportStar(require("./GetMessageAttachmentRequest"), exports); | ||
__exportStar(require("./GetMessageAttachmentsRequest"), exports); | ||
__exportStar(require("./GetMessageLinksRequest"), exports); | ||
__exportStar(require("./GetMessageRawRequest"), exports); | ||
__exportStar(require("./GetMessageRequest"), exports); | ||
__exportStar(require("./GetMessageSmtpLogRequest"), exports); | ||
__exportStar(require("./GetSmsInboxRequest"), exports); | ||
@@ -34,2 +45,4 @@ __exportStar(require("./Inbox"), exports); | ||
__exportStar(require("./PostedMessage"), exports); | ||
__exportStar(require("./RawData"), exports); | ||
__exportStar(require("./SmtpLogs"), exports); | ||
__exportStar(require("./Sort"), exports); |
export declare class Links { | ||
links: Array<String>; | ||
links: Array<string>; | ||
} |
import { Request } from '../Request'; | ||
import { IRestResponse } from 'typed-rest-client/RestClient'; | ||
import { ResponseStatus } from "./ResponseStatus"; | ||
import { ResponseStatus } from "../ResponseStatus"; | ||
export declare class DeleteRuleRequest implements Request<ResponseStatus> { | ||
@@ -5,0 +5,0 @@ private readonly domainId; |
import { Request } from '../Request'; | ||
import { IRestResponse } from 'typed-rest-client/RestClient'; | ||
import { ResponseStatus } from "./ResponseStatus"; | ||
import { ResponseStatus } from "../ResponseStatus"; | ||
export declare class DisableRuleRequest implements Request<ResponseStatus> { | ||
@@ -5,0 +5,0 @@ private readonly domainId; |
import { Request } from '../Request'; | ||
import { IRestResponse } from 'typed-rest-client/RestClient'; | ||
import { ResponseStatus } from "./ResponseStatus"; | ||
import { ResponseStatus } from "../ResponseStatus"; | ||
export declare class EnableRuleRequest implements Request<ResponseStatus> { | ||
@@ -5,0 +5,0 @@ private readonly domainId; |
@@ -14,5 +14,4 @@ export * from './Action'; | ||
export * from './OperationType'; | ||
export * from './ResponseStatus'; | ||
export * from './Rule'; | ||
export * from './RuleToCreate'; | ||
export * from './Rules'; |
@@ -27,5 +27,4 @@ "use strict"; | ||
__exportStar(require("./OperationType"), exports); | ||
__exportStar(require("./ResponseStatus"), exports); | ||
__exportStar(require("./Rule"), exports); | ||
__exportStar(require("./RuleToCreate"), exports); | ||
__exportStar(require("./Rules"), exports); |
{ | ||
"name": "mailinator-client", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Mailinator REST API client for JavaScript applications.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -54,2 +54,8 @@ #### [Mailinator](https://www.mailinator.com/) REST API client for JavaScript applications. | ||
* `MAILINATOR_TEST_DELETE_DOMAIN` - don't use it unless you are 100% sure what you are doing | ||
* `MAILINATOR_TEST_WEBHOOKTOKEN_PRIVATEDOMAIN` - private domain for webhook token | ||
* `MAILINATOR_TEST_WEBHOOKTOKEN_CUSTOMSERVICE` - custom service for webhook token | ||
* `MAILINATOR_TEST_AUTH_SECRET` - authenticator secret | ||
* `MAILINATOR_TEST_AUTH_ID` - authenticator id | ||
* `MAILINATOR_TEST_WEBHOOK_INBOX` - inbox for webhook | ||
* `MAILINATOR_TEST_WEBHOOK_CUSTOMSERVICE` - custom service for webhook | ||
@@ -56,0 +62,0 @@ #### Create index |
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
97957
214
2440
65