Skip to content

Commit

Permalink
Fix invalid types for errorOnTimeout functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-mailosaur authored and th-mailosaur committed Feb 5, 2025
1 parent 4d470af commit a09820e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 83 deletions.
92 changes: 30 additions & 62 deletions lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ export interface Metadata {
* https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.1.3
*/
rcptTo?: MessageAddress[];

}

/**
Expand All @@ -166,7 +165,7 @@ export interface Message {
/**
* The type of message.
*/
type: 'Email' | 'SMS';
type: "Email" | "SMS";
/**
* The sender of the message.
*/
Expand Down Expand Up @@ -226,7 +225,7 @@ export interface MessageSummary {
/**
* The type of message.
*/
type: 'Email' | 'SMS';
type: "Email" | "SMS";
/**
* The sender of the message.
*/
Expand Down Expand Up @@ -311,27 +310,27 @@ export interface SearchOptions {
/**
* Specify how long to wait for a matching result (in milliseconds, default value is 10 seconds).
*/
timeout?: number,
timeout?: number;
/**
* Limits results to only messages received after this date/time (default 1 hour ago).
*/
receivedAfter?: Date,
receivedAfter?: Date;
/**
* Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results.
*/
page?: number,
page?: number;
/**
* A limit on the number of results to be returned. This can be set between `1` and `1000`, with the default being `50`.
*/
itemsPerPage?: number,
itemsPerPage?: number;
/**
* When using the 'get' method, this option can be used to prevent an error being thrown if no matching message is found in time.
*/
suppressError?: boolean
errorOnTimeout?: boolean;
/**
* Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`.
*/
dir?: string
dir?: string;
}

/**
Expand All @@ -341,19 +340,19 @@ export interface MessageListOptions {
/**
* Limits results to only messages received after this date/time (default 1 hour ago).
*/
receivedAfter?: Date,
receivedAfter?: Date;
/**
* Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results.
*/
page?: number,
page?: number;
/**
* A limit on the number of results to be returned. This can be set between `1` and `1000`, with the default being `50`.
*/
itemsPerPage?: number
itemsPerPage?: number;
/**
* Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`.
*/
dir?: string
dir?: string;
}

/**
Expand Down Expand Up @@ -482,36 +481,6 @@ export interface ServerListResult {
items?: Server[];
}

/**
* Search options
*/
export interface SearchOptions {
/**
* Specify how long to wait for a matching result (in milliseconds, default value is 10 seconds).
*/
timeout?: number,
/**
* Limits results to only messages received after this date/time (default 1 hour ago).
*/
receivedAfter?: Date,
/**
* Used alongside `itemsPerPage` to paginate through results. This is zero-based, meaning `0` is the first page of results.
*/
page?: number,
/**
* A limit on the number of results to be returned. This can be set between `1` and `1000`, with the default being `50`.
*/
itemsPerPage?: number,
/**
* When using the 'get' method, this option can be used to prevent an error being thrown if no matching message is found in time.
*/
suppressError?: boolean
/**
* Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`.
*/
dir?: string
}

/**
* The result of an individual Spam Assassin rule
*/
Expand Down Expand Up @@ -554,7 +523,6 @@ export interface SpamAnalysisResult {
score?: number;
}


/**
* The results of deliverability report performed by Mailosaur.
*/
Expand Down Expand Up @@ -584,14 +552,14 @@ export interface DeliverabilityReport {
*/
dnsRecords?: DnsRecords;
/**
* The result of spam analysis performed by Mailosaur
* The result of spam analysis performed by Mailosaur
*/
spamAssassin?: SpamAssassinResult;
}

/**
* The result of an email domain check
*/
* The result of an email domain check
*/
export interface EmailAuthenticationResult {
/**
* The result of the check
Expand All @@ -605,16 +573,16 @@ export interface EmailAuthenticationResult {
* The raw values returned from the check
*/
rawValue: string;
/**
/**
* The seperated tags returned from the check
*/
tags: { [key: string]: string};
*/
tags: { [key: string]: string };
}

/**
* The result of an domain check against a blocklist checker
*/
export interface BlockListResult{
* The result of an domain check against a blocklist checker
*/
export interface BlockListResult {
/**
* The identifier of the blocklist
*/
Expand All @@ -630,9 +598,9 @@ export interface BlockListResult{
}

/**
* The results of email content analysis
*/
export interface Content{
* The results of email content analysis
*/
export interface Content {
/**
* The content contained embed tags
*/
Expand Down Expand Up @@ -672,9 +640,9 @@ export interface Content{
}

/**
* The records found when checking DNS records of an email sender's domain
*/
export interface DnsRecords{
* The records found when checking DNS records of an email sender's domain
*/
export interface DnsRecords {
/**
* The A Records of the sender's domain
*/
Expand All @@ -690,9 +658,9 @@ export interface DnsRecords{
}

/**
* The results of spam assassin check performed by Mailosaur.
*/
export interface SpamAssassinResult{
* The results of spam assassin check performed by Mailosaur.
*/
export interface SpamAssassinResult {
/**
* Overall Mailosaur spam score.
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/models/searchOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class SearchOptions {
this.receivedAfter = data.receivedAfter;
this.page = data.page;
this.itemsPerPage = data.itemsPerPage;
this.suppressError = data.suppressError;
this.errorOnTimeout = data.errorOnTimeout;
this.dir = data.dir;
}
}
Expand Down
35 changes: 15 additions & 20 deletions lib/operations/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as stream from 'stream';
import * as models from '../models';
import * as stream from "stream";
import * as models from "../models";

/**
* Message analysis operations.
Expand All @@ -15,15 +15,15 @@ export interface Analysis {
messageId: string
): Promise<models.SpamAnalysisResult>;

/**
/**
* Perform a deliverability report of an email.
*/
deliverability(
/**
* The identifier of the message to be analyzed.
*/
messageId: string
): Promise<models.DeliverabilityReport>;
deliverability(
/**
* The identifier of the message to be analyzed.
*/
messageId: string
): Promise<models.DeliverabilityReport>;
}

/**
Expand Down Expand Up @@ -79,7 +79,7 @@ export interface Messages {
/**
* Search options
*/
options?: models.SearchOptions
options?: Omit<models.SearchOptions, "errorOnTimeout">
): Promise<models.Message>;

/**
Expand Down Expand Up @@ -205,8 +205,7 @@ export interface Servers {
/**
* Returns a list of your virtual servers. Servers are returned sorted in alphabetical order.
*/
list(
): Promise<models.ServerListResult>;
list(): Promise<models.ServerListResult>;

/**
* Creates a new virtual server.
Expand Down Expand Up @@ -279,23 +278,20 @@ export interface Usage {
* Retrieve account usage limits. Details the current limits and usage for your account.
* This endpoint requires authentication with an account-level API key.
*/
limits(
): Promise<models.UsageAccountLimits>;
limits(): Promise<models.UsageAccountLimits>;

/**
* Retrieves the last 31 days of transactional usage.
* This endpoint requires authentication with an account-level API key.
*/
transactions(
): Promise<models.UsageTransactionListResult>;
transactions(): Promise<models.UsageTransactionListResult>;
}

export interface Devices {
/**
* Returns a list of your virtual security devices.
*/
list(
): Promise<models.DeviceListResult>;
list(): Promise<models.DeviceListResult>;

/**
* Creates a new virtual security device.
Expand Down Expand Up @@ -332,6 +328,5 @@ export interface Previews {
/**
* List all email clients that can be used to generate email previews.
*/
listEmailClients(
): Promise<models.PreviewEmailClientListResult>;
listEmailClients(): Promise<models.PreviewEmailClientListResult>;
}

0 comments on commit a09820e

Please sign in to comment.