rejoiner 2.10.4 → 2.11.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/lib/endpoints/customer.js +22 -2
- package/package.json +1 -1
|
@@ -14,8 +14,28 @@ const customerEndpoint = (client) => {
|
|
|
14
14
|
cancel: (email) => postEmail(`${endpoint}/cancel/`, email),
|
|
15
15
|
unsubscribe: (email) => postEmail(`${endpoint}/unsubscribe/`, email),
|
|
16
16
|
optIn: (email) => postEmail(`${endpoint}/opt_in/`, email),
|
|
17
|
-
get: (email) =>
|
|
18
|
-
|
|
17
|
+
get: (email) => {
|
|
18
|
+
switch (client.version) {
|
|
19
|
+
case 1:
|
|
20
|
+
return dispatchReturnData('get')(`customers/${email}/`)
|
|
21
|
+
case 2:
|
|
22
|
+
return dispatchReturnData('get')('customers/by_email/', {
|
|
23
|
+
params: { email },
|
|
24
|
+
})
|
|
25
|
+
default:
|
|
26
|
+
throw new Error(`Invalid API version: ${client.version}`)
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
update: (data) => {
|
|
30
|
+
switch (client.version) {
|
|
31
|
+
case 1:
|
|
32
|
+
return putEmail(`customers/${data.email}/`, data)
|
|
33
|
+
case 2:
|
|
34
|
+
return postEmail('/customers/', data)
|
|
35
|
+
default:
|
|
36
|
+
throw new Error(`Invalid API version: ${client.version}`)
|
|
37
|
+
}
|
|
38
|
+
},
|
|
19
39
|
}
|
|
20
40
|
}
|
|
21
41
|
|
package/package.json
CHANGED