rejoiner 2.12.1 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -111,6 +111,40 @@ client.customer.optIn('test@example.com')
111
111
  .catch(...)
112
112
  ````
113
113
 
114
+ ### Customer Preference Tags
115
+
116
+ ### Get Preference Tags
117
+
118
+ ````js
119
+ client.customer.preferenceTags.get('test@example.com')
120
+ .then(...)
121
+ .catch(...)
122
+ ````
123
+
124
+ ### Replace Preference Tags
125
+
126
+ ````js
127
+ client.customer.preferenceTags.set('test@example.com', ['example-tag'])
128
+ .then(...)
129
+ .catch(...)
130
+ ````
131
+
132
+ ### Add Preference Tags
133
+
134
+ ````js
135
+ client.customer.preferenceTags.add('test@example.com', ['example-tag'])
136
+ .then(...)
137
+ .catch(...)
138
+ ````
139
+
140
+ ### Remove Preference Tags
141
+
142
+ ````js
143
+ client.customer.preferenceTags.remove('test@example.com', ['example-tag'])
144
+ .then(...)
145
+ .catch(...)
146
+ ````
147
+
114
148
  ## Email List Endpoints
115
149
 
116
150
  ### Email Lists
@@ -1,5 +1,8 @@
1
1
  const { withClient } = require('../helpers')
2
2
 
3
+ const preferenceTagsPath = 'customer/preference_tags/by_email/'
4
+ const preferenceTagsRemovePath = 'customer/preference_tags/remove/by_email/'
5
+
3
6
  const customerEndpoint = (client) => {
4
7
  const endpoint = 'customer'
5
8
 
@@ -36,6 +39,35 @@ const customerEndpoint = (client) => {
36
39
  throw new Error(`Invalid API version: ${client.apiVersion}`)
37
40
  }
38
41
  },
42
+ preferenceTags: {
43
+ get: (email) => {
44
+ const params = { email }
45
+
46
+ const config = { params }
47
+ return dispatchReturnData('get')(preferenceTagsPath, config)
48
+ },
49
+ set: (email, tags) => {
50
+ const params = { email }
51
+ const data = { preference_tags: tags }
52
+
53
+ const config = { params, data }
54
+ return dispatchReturnData('put')(preferenceTagsPath, config)
55
+ },
56
+ add: (email, tags) => {
57
+ const params = { email }
58
+ const data = { preference_tags: tags }
59
+
60
+ const config = { params, data }
61
+ return dispatchReturnData('patch')(preferenceTagsPath, config)
62
+ },
63
+ remove: (email, tags) => {
64
+ const params = { email }
65
+ const data = { preference_tags: tags }
66
+
67
+ const config = { params, data }
68
+ return dispatchReturnData('patch')(preferenceTagsRemovePath, config)
69
+ },
70
+ },
39
71
  }
40
72
  }
41
73
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rejoiner",
3
3
  "description": "Rejoiner REST API client wrapper for Node.js",
4
- "version": "2.12.1",
4
+ "version": "2.13.0",
5
5
  "main": "lib/rejoiner.js",
6
6
  "author": "Sascha Bratton <sascha@brattonbratton.com>",
7
7
  "license": "MIT",