Socket
Socket
Sign inDemoInstall

layer-api

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

layer-api - npm Package Compare versions

Comparing version 2.3.1 to 2.3.2

18

lib/resources/messages.js

@@ -79,2 +79,20 @@ 'use strict';

/**
* Retrieve a message in a conversation
*
* @param {String} messageId Message ID
* @param {String} conversationId Conversation ID
* @param {Function} callback Callback function
*/
get: function(messageId, conversationId, callback) {
if (!messageId) return callback(new Error(utils.i18n.messages.mid));
messageId = utils.toUUID(messageId);
if (!conversationId) return callback(new Error(utils.i18n.conversations.id));
conversationId = utils.toUUID(conversationId);
utils.debug('Message get: ' + messageId + ', ' + conversationId);
request.get({
path: '/conversations/' + conversationId + '/messages/' + messageId
}, callback);
},
/**
* Retrieve messages in a conversation from a user

@@ -81,0 +99,0 @@ *

2

package.json
{
"name": "layer-api",
"version": "2.3.1",
"version": "2.3.2",
"description": "Node.js library, which provides a wrapper for the Layer Platform API",

@@ -5,0 +5,0 @@ "publishConfig": {

@@ -344,2 +344,15 @@ # Layer API for node.js

---------------------------------------
### messages.get(mid, cid, [callback])
[Retrieve](https://docs.layer.com/reference/server_api/messages.out#get-a-message) a single message in a conversation by providing message ID and conversation ID. Response `body` will be a [message resource](https://docs.layer.com/reference/server_api/message.obj).
#### Arguments
- `mid` — message ID
- `cid` — conversation ID
- `callback(err, res)` — Callback function returns an error and response objects
---------------------------------------
### messages.getAll(cid, [params], callback)

@@ -393,6 +406,4 @@

Announcements are messages sent to all users of the application or to a list of users.
Announcements are messages sent to all users of the application or to a list of users. Recipients should be specified in the `recipients` property, which takes an array of user IDs.
Payload property `recipients` can contain one or more user IDs or the literal string "everyone" in order to message the entire userbase.
### announcements.send(payload, [callback])

@@ -399,0 +410,0 @@

@@ -241,2 +241,19 @@ /*globals describe it*/

});
describe('Retriving a message in a conversation', function() {
nock('https://api.layer.com')
.get('/apps/' + fixtures.appId + '/conversations/' + fixtures.conversations.uuid + '/messages/' + fixtures.messages.uuid)
.reply(200, fixtures.messages.success);
it('should return array of messages', function(done) {
layerAPI.messages.get(fixtures.messages.id, fixtures.conversations.uuid, function(err, res) {
should.not.exist(err);
should.exist(res);
res.body.id.should.be.eql(fixtures.messages.id);
done();
});
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc