messagebird
Advanced tools
Comparing version 3.3.0 to 3.4.0
@@ -236,2 +236,32 @@ /** | ||
/** | ||
* Lists sms messages. | ||
* | ||
* @param filter Filtering options. | ||
* @param filter.status The status of the message. | ||
* @param filter.limit The limit of messages to retrieve. | ||
* @param filter.offset The number of messages to skip before selecting. | ||
* @param {Function} callback | ||
* @return void | ||
*/ | ||
list: function (filter, callback) { | ||
var params = {}; | ||
if (typeof callback === 'function') { | ||
if (filter.hasOwnProperty('limit')) { | ||
params.limit = filter.limit; | ||
} | ||
if (filter.hasOwnProperty('offset')) { | ||
params.offset = filter.offset; | ||
} | ||
if (filter.hasOwnProperty('status')) { | ||
params.status = filter.status; | ||
} | ||
} else { | ||
callback = filter; | ||
} | ||
httpRequest({ method: 'GET', path: '/messages', params: params }, callback); | ||
}, | ||
/** | ||
* Send a text message | ||
@@ -238,0 +268,0 @@ * |
{ | ||
"name": "messagebird", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"description": "A node.js wrapper for the MessageBird REST API", | ||
@@ -5,0 +5,0 @@ "main": "lib/messagebird.js", |
@@ -5,3 +5,3 @@ // TypeScript Version: 3.0 | ||
import { Hlr, HLRParameter } from './hlr'; | ||
import { Message, MessageParameters } from './messages'; | ||
import { Message, MessageParameters, FilterParameters } from './messages'; | ||
import { | ||
@@ -46,2 +46,3 @@ VoiceMessage, | ||
create(params: MessageParameters, callback: CallbackFn<Message>): void; | ||
list(filter: FilterParameters, callback: CallbackFn<Message[]>): void; | ||
}; | ||
@@ -48,0 +49,0 @@ callflows: { |
@@ -127,1 +127,12 @@ import { datetime, msisdn } from './general'; | ||
} | ||
export interface FilterParameters { | ||
// The status of the message. | ||
status: string; | ||
// The limit of messages to retrieve. | ||
limit?: number; | ||
// The number of messages to skip before selecting. | ||
offset?: number; | ||
} |
170097
57
5169