Last week the official Cisco Spark JavaScript SDK went though a version update to 0.6.3. This included bug fixes with some new ES5 examples added to the readme incase you haven’t seen it yet. NPM has updated the package description and when you update the Node module the new readme contains all the updated examples. See an example from the readme below for creating a room and posting a message.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
'use strict'; var assert = require('assert'); var ciscospark = require('ciscospark'); var message1, message2, room; return ciscospark.rooms.create({title: 'Messages Example'}) .then(function(r) { room = r; return ciscospark.messages.create({ text: 'Howdy!', roomId: room.id }); }) .then(function(m) { message1 = m; return ciscospark.messages.create({ text: 'How are you?', roomId: room.id }); }) .then(function(m) { message2 = m; return ciscospark.messages.list({roomId: room.id}); }) .then(function(messages) { assert.equal(messages.length, 2); assert.equal(messages.items[0].id, message2.id); assert.equal(messages.items[1].id, message1.id); }); |
VoIPNorm
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.