New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-iterable-api

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-iterable-api - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

138

lib/api.js

@@ -5,8 +5,13 @@

resource: 'lists',
method: 'get',
methods: ['get', 'post', 'delete'],
actions: [
{
name: 'getUsers',
method: 'get'
},
{
name: 'subscribe',
method: 'post'
}, {
},
{
name: 'unsubscribe',

@@ -16,52 +21,78 @@ method: 'post'

]
}, {
},
{
resource: 'events',
method: 'get',
methods: ['get'],
actions: [
{
name: 'trackConversion',
name: 'track',
method: 'post'
}, {
},
{
name: 'trackBulk',
method: 'post'
},
{
name: 'trackInAppOpen',
method: 'post'
},
{
name: 'trackInAppClick',
method: 'post'
},
{
name: 'trackWebPushClick',
method: 'post'
},
{
name: 'trackPushOpen',
method: 'post'
}, {
name: 'track',
method: 'post'
}
]
}, {
},
{
resource: 'users',
method: 'get',
methods: ['get', 'delete'],
actions: [
{
name: 'delete',
name: 'update',
method: 'post'
}, {
},
{
name: 'updateEmail',
method: 'post'
}, {
},
{
name: 'bulkUpdate',
method: 'post'
}, {
},
{
name: 'registerDeviceToken',
method: 'post'
}, {
},
{
name: 'updateSubscriptions',
method: 'post'
}, {
},
{
name: 'getByEmail',
method: 'get'
}, {
},
{
name: 'byUserId',
method: 'get'
}, {
},
{
name: 'byUserId',
method: 'delete'
},
{
name: 'getFields',
method: 'get'
}, {
name: 'update',
method: 'post'
}, {
},
{
name: 'getSentMessages',
method: 'get'
}, {
},
{
name: 'disableDevice',

@@ -71,3 +102,13 @@ method: 'post'

]
}, {
},
{
resource: 'inApp',
actions: [
{
name: 'getMessages',
method: 'get'
}
]
},
{
resource: 'push',

@@ -80,5 +121,5 @@ actions: [

]
}, {
},
{
resource: 'campaigns',
method: 'get',
actions: [

@@ -88,8 +129,6 @@ {

method: 'post'
}, {
name: 'create',
method: 'post'
}
]
}, {
},
{
resource: 'commerce',

@@ -100,3 +139,4 @@ actions: [

method: 'post'
}, {
},
{
name: 'updateCart',

@@ -106,3 +146,4 @@ method: 'post'

]
}, {
},
{
resource: 'email',

@@ -113,3 +154,4 @@ actions: [

method: 'get'
}, {
},
{
name: 'target',

@@ -119,3 +161,4 @@ method: 'post'

]
}, {
},
{
resource: 'workflows',

@@ -128,3 +171,4 @@ actions: [

]
}, {
},
{
resource: 'sms',

@@ -137,3 +181,25 @@ actions: [

]
},
{
resource: 'webPush',
actions: [
{
name: 'target',
method: 'post'
}
]
},
{
resource: 'messageTypes',
methods: ['get']
},
{
resource: 'experiments',
actions: [
{
name: 'metrics',
method: 'get'
}
]
}
]

@@ -14,6 +14,12 @@

if (resource.method) {
console.log(['\t', [resource.method.toUpperCase(), ['', resource.name].join('/')].join(' - ')].join(''))
if (resource.methods) {
resource.methods.forEach(method => {
console.log(['\t', [method.toUpperCase(), ['', resource.name].join('/')].join(' - ')].join(''))
})
}
if (!resource.actions) {
return
}
resource.actions.forEach(action => {

@@ -28,3 +34,3 @@ console.log(['\t', [action.method.toUpperCase(), ['', resource.resource, action.name].join('/')].join(' - ')].join(''))

Iterable.prototype[resource.resource] = function () {
const actions = resource.actions.reduce((accm, action) => {
const actions = (resource.actions || []).reduce((accm, action) => {
accm[action.name] = (param, payload) => {

@@ -47,17 +53,19 @@ let url = ['', resource.resource, action.name]

if (resource.method) {
actions[resource.method] = (param, payload) => {
let url = ['', resource.resource]
if (resource.methods) {
resource.methods.forEach(method => {
actions[method] = (param, payload) => {
let url = ['', resource.resource]
if (typeof param === 'string') {
url.push(param)
} else {
payload = param
if (typeof param === 'string') {
url.push(param)
} else {
payload = param
}
return this.request[method]({
url: url.join('/'),
data: payload || {}
})
}
return this.request[resource.method]({
url: url.join('/'),
data: payload || {}
})
}
})
}

@@ -64,0 +72,0 @@

{
"name": "node-iterable-api",
"version": "0.0.1",
"version": "0.0.2",
"description": "Wrapper for Iterable API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -5,2 +5,4 @@ # Node Iterable API

[![Coverage Status](https://coveralls.io/repos/github/geoffdutton/iterable-api/badge.svg?branch=master)](https://coveralls.io/github/geoffdutton/iterable-api?branch=master)
[![npm version](https://badge.fury.io/js/node-iterable-api.svg)](https://badge.fury.io/js/node-iterable-api)
[![Known Vulnerabilities](https://snyk.io/test/github/geoffdutton/iterable-api/badge.svg)](https://snyk.io/test/github/geoffdutton/iterable-api)

@@ -66,41 +68,72 @@ Credit: [seanmcgary/iterable](https://github.com/seanmcgary/iterable)

```javascript
```
lists
GET - /
POST - /lists/subscribe
POST - /lists/unsubscribe
GET - /lists
POST - /lists
DELETE - /lists/{listId}
GET - /lists/getUsers?listId={listId}
POST - /lists/subscribe
POST - /lists/unsubscribe
events
GET - /events/{email}
POST - /events/trackConversion
POST - /events/trackPushOpen
POST - /events/track
POST - /events/track
POST - /events/trackBulk
GET - /events/{email}
POST - /events/trackInAppOpen
POST - /events/trackInAppClick
POST - /events/trackWebPushClick
POST - /events/trackConversion
POST - /events/trackPushOpen
users
POST - /users/delete
POST - /users/get/{email}
POST - /users/updateEmail
POST - /users/bulkUpdate
POST - /users/registerDeviceToken
POST - /users/updateSubscriptions
GET - /users/getByEmail/{email}
GET - /users/byUserId/{userId}
GET - /users/getFields
POST - /users/update
GET - /users/getSentMessages
POST - /users/disableDevice
GET - /users/{email}
DELETE - /users/{email}
POST - /users/update
POST - /users/updateEmail
POST - /users/bulkUpdate
POST - /users/registerDeviceToken
POST - /users/updateSubscriptions
GET - /users/getByEmail/{email}
GET - /users/byUserId/{userId}
DELETE - /users/byUserId/{userId}
GET - /users/getFields
GET - /users/getSentMessages
POST - /users/disableDevice
email
GET - /email/viewInBrowsers?email={email}&messageId={messageId}
POST - /email/target
webPush
POST - /webPush/target
inApp
GET - /inApp/getMessages?email={email}&count={msgCount}
GET - /inApp/getMessages?userId={userId}&count={msgCount}
push
POST - /push/target
POST - /push/target
campaigns
GET - /
POST - /campaigns/create
POST - /campaigns/create
POST - /campaigns/create
commerce
POST - /commerce/trackPurchase
POST - /commerce/updateCart
POST - /commerce/trackPurchase
POST - /commerce/updateCart
email
GET - /email/viewInBrowser
POST - /email/target
GET - /email/viewInBrowser
POST - /email/target
workflows
POST - /workflows/triggerWorkflow
POST - /workflows/triggerWorkflow
sms
POST - /sms/target
POST - /sms/target
messageTypes
GET - /messageTypes
experiments
GET - /experiments/metrics
```

@@ -107,0 +140,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