Skip to content

Commit

Permalink
Add support for message direction
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-mailosaur committed Oct 13, 2022
1 parent f7ff2c2 commit 484000a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ export interface SearchOptions {
* 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
}

/**
Expand All @@ -346,6 +350,10 @@ export interface MessageListOptions {
* 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
/**
* Optionally limits results based on the direction (`Sent` or `Received`), with the default being `Received`.
*/
dir?: string
}

/**
Expand Down Expand Up @@ -486,6 +494,10 @@ export interface SearchOptions {
* 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
}

/**
Expand Down
1 change: 1 addition & 0 deletions lib/models/messageListOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class MessageListOptions {
this.receivedAfter = data.receivedAfter;
this.page = data.page;
this.itemsPerPage = data.itemsPerPage;
this.dir = data.dir;
}
}

Expand Down
1 change: 1 addition & 0 deletions lib/models/searchOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class SearchOptions {
this.page = data.page;
this.itemsPerPage = data.itemsPerPage;
this.suppressError = data.suppressError;
this.dir = data.dir;
}
}

Expand Down
6 changes: 4 additions & 2 deletions lib/operations/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class Messages {
server: serverId,
page: options.page,
itemsPerPage: options.itemsPerPage,
receivedAfter: options.receivedAfter
receivedAfter: options.receivedAfter,
dir: options.dir,
};

return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -114,7 +115,8 @@ class Messages {
server: serverId,
page: options.page,
itemsPerPage: options.itemsPerPage,
receivedAfter: options.receivedAfter
receivedAfter: options.receivedAfter,
dir: options.dir,
};

if (!Number.isInteger(options.timeout)) {
Expand Down

0 comments on commit 484000a

Please sign in to comment.