Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

delighted

Package Overview
Dependencies
Maintainers
5
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delighted - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0-rc1

lib/resources/autopilot/Configuration.js

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 2.1.0-rc1
Features:
- Adds support for Autopilot (retrieving configuration, listing people, adding people, and removing people)
## 2.0.0 (2020-03-18)

@@ -2,0 +8,0 @@

6

lib/Delighted.js
var merge = require('./utils/merge');
var Client = require('./Client');
var VERSION = '2.0.0';
var VERSION = '2.1.0-rc1';
var DEFAULT_HOST = 'api.delighted.com';

@@ -19,3 +19,5 @@ var DEFAULT_PORT = 443;

'surveyResponse': require('./resources/SurveyResponse'),
'unsubscribe': require('./resources/Unsubscribe')
'unsubscribe': require('./resources/Unsubscribe'),
'autopilotConfiguration': require('./resources/autopilot/Configuration'),
'autopilotMembership': require('./resources/autopilot/Membership')
};

@@ -22,0 +24,0 @@

@@ -12,3 +12,3 @@ var extend = require('./utils/extend');

Resource.defaults = ['materialize', 'toJSON', '_composePath', '_identifierString']
Resource.defaults = ['materialize', 'toJSON', 'getPath', '_composePath', '_identifierString']

@@ -18,2 +18,6 @@ merge(Resource.prototype, {

getPath: function() {
return this.path;
},
materialize: function(attributes) {

@@ -42,3 +46,3 @@ var Constructor = this.constructor;

save: function() {
return this.client.put(this.path, this).then(function(response) {
return this.client.put(this.getPath(), this).then(function(response) {
return this.materialize(response.body);

@@ -49,3 +53,3 @@ }.bind(this));

all: function(params) {
return this.client.get(this.path, params).then(function(response) {
return this.client.get(this.getPath(), params).then(function(response) {
return response.body.map(this.materialize, this);

@@ -56,7 +60,7 @@ }.bind(this));

list: function(params) {
return new ListResource(this, this.path, params, this.client);
return new ListResource(this, this.getPath(), params, this.client);
},
create: function(data) {
return this.client.post(this.path, data).then(function(response) {
return this.client.post(this.getPath(), data).then(function(response) {
return this.materialize(response.body);

@@ -84,3 +88,3 @@ }.bind(this));

_composePath: function(id) {
return id ? (this.path + '/' + encodeURIComponent(id)) : this.path;
return id ? (this.getPath() + '/' + encodeURIComponent(id)) : this.getPath();
},

@@ -87,0 +91,0 @@

{
"name": "delighted",
"version": "2.0.0",
"version": "2.1.0-rc1",
"description": "Delighted API Node Client",

@@ -15,3 +15,3 @@ "main": "delighted.js",

"lint": "jshint lib",
"test": "mocha test/*_test.js test/**/*_test.js"
"test": "mocha 'test/*_test.js' 'test/**/*_test.js'"
},

@@ -18,0 +18,0 @@ "repository": {

@@ -164,2 +164,31 @@ [![Build Status](https://travis-ci.org/delighted/delighted-node.svg?branch=master)](https://travis-ci.org/delighted/delighted-node)

### Autopilot
Retrieve existing autopilot configuration for a platform:
```javascript
delighted.autopilotConfiguration.retrieve('email');
delighted.autopilotConfiguration.retrieve('sms');
```
To interact with the autopilot person api, configure the autopilotMembership instance with the platform. You can list all people imported to Autopilot, add a new person, or delete an existing person:
```javascript
// List all people in Autopilot
delighted.autopilotMembership.forEmail().list().autoPagingEach((person) => {
console.log(person);
}, { auto_handle_rate_limits: true });
delighted.autopilotMembership.forSms().list().autoPagingEach((person) => {
console.log(person);
}, { auto_handle_rate_limits: true });
// Create a new person
delighted.autopilotMembership.forEmail().create({ person_email: 'email@example.com' });
delighted.autopilotMembership.forSms().create({ phone_number: '+15556667777' });
// Remove a person
delighted.autopilotMembership.forEmail().delete({ person_email: 'email@example.com' });
delighted.autopilotMembership.forSms().delete( {phone_number: '+15556667777' });
```
## Rate limits

@@ -166,0 +195,0 @@

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