1.0.3 • Published 4 years ago

node-ciscospark v1.0.3

Weekly downloads
20
License
MIT
Repository
github
Last release
4 years ago

Cisco Spark API for Node.js

This is a super-simple lightweight JavaScript wrapper for Cisco Spark API.

NPM

npm Build Status codecov Documentation dependencies Status Known Vulnerabilities npm.io Stories in Ready JavaScript Style Guide

Installation

$ npm install node-ciscospark

Quick Start

API

var CiscoSpark = require('node-ciscospark');

var spark = new CiscoSpark(accessToken);

accessToken can also be set in the CISCOSPARK_ACCESS_TOKEN environment variable.

Create a Message

// spark.messages.create(parameters, callback)
spark.messages.create({
  roomId: sparkChatRoomId,
  text: 'This is a test'
}, function (err, result) {
  if (err) console.error(err);
  console.log(result);
});

List Rooms

// spark.rooms.list(parameters, callback)
spark.rooms.list({
  teamId: sparkTeamId
}, function (err, result, response) {
  if (err) console.error(err);
  console.log(result);
  console.log('Response Codes:', response.statusCode);
});

Supported Spark API

Messages

API methodsUsage
List Messagesspark.messages.list(parameters, callback)
Create a Messagespark.messages.create(parameters, callback)
Create a Message to a Roomspark.messages.createToRoom(roomId, markdownMessage, callback)
Create a Message to a Personspark.messages.createToPersonId(personId, markdownMessage, callback)
Create a Message to a Person's emailspark.messages.createToPersonEmail(email, markdownMessage, callback)
Get Message Detailsspark.messages.get(messageId, callback)
Delete a Messagespark.messages.delete(messageId, callback)

People

API methodsUsage
List Peoplespark.people.list(parameters, callback)
Create a Personspark.people.create(parameters, callback)
Get Person Detailsspark.people.get(personId, callback)
Update a Personspark.people.update(personId, parameters, callback)
Delete a Personspark.people.delete(personId, callback)
Get my own detailsspark.people.me(callback)

Rooms

API methodsUsage
List Roomsspark.rooms.list(parameters, callback)
Create a Roomspark.rooms.create(parameters, callback)
Get Room Detailsspark.rooms.get(roomId, callback)
Update a Roomspark.rooms.update(roomId, parameters, callback)
Delete a Roomspark.rooms.delete(roomId, callback)

Memberships

API methodsUsage
List Membershipsspark.memberships.list(parameters, callback)
Create a Membershipspark.memberships.create(parameters, callback)
Get Membership Detailsspark.memberships.get(membershipId, callback)
Update a Membershipspark.memberships.update(membershipId, parameters, callback)
Delete a Membershipspark.memberships.delete(membershipId, callback)

Teams

API methodsUsage
List Teamsspark.teams.list(parameters, callback)
Create a Teamspark.teams.create(parameters, callback)
Get Team Detailsspark.teams.get(teamId, callback)
Update a Teamspark.teams.update(teamId, parameters, callback)
Delete a Teamspark.teams.delete(teamId, callback)

Team Memberships

API methodsUsage
List Team Membershipsspark.teamMemberships.list(parameters, callback)
Create a Team Membershipspark.teamMemberships.create(parameters, callback)
Get Team Membership Detailsspark.teamMemberships.get(membershipId, callback)
Update a Team Membershipspark.teamMemberships.update(membershipId, parameters, callback)
Delete a Team Membershipspark.teamMemberships.delete(membershipId, callback)

Webhooks

API methodsUsage
List Webhooksspark.webhooks.list(parameters, callback)
Create a Webhookspark.webhooks.create(parameters, callback)
Get Webhook Detailsspark.webhooks.get(webhookId, callback)
Update a Webhookspark.webhooks.update(webhookId, parameters, callback)
Delete a Webhookspark.webhooks.delete(webhookId, callback)

Callbacks

The callbacks above return error, resultBody and httpResponse:

  function (error, resultBody, httpResponse) { }

where:

  • error is an Error object, or null
  • resultBody is the JSON response
  • httpResponse is a http.ServerResponse object

Code Documentation

See: https://doc.esdoc.org/github.com/joelee/ciscospark/

Documentation

License

The MIT License (MIT)

Copyright (C) 2017 Joseph Lee

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Contributor(s)

Joseph Lee Twitter Follow

1.0.3

4 years ago

1.0.0

4 years ago

0.9.12

4 years ago

0.9.11

5 years ago

0.9.10

5 years ago

0.9.9

5 years ago

0.9.8

5 years ago

0.9.7

5 years ago

0.9.6

5 years ago

0.9.5

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago

0.9.0

5 years ago

0.1.0

5 years ago