1 | class Subscription {
|
2 | constructor(client) {
|
3 | this.client = client
|
4 | }
|
5 |
|
6 | get(options) {
|
7 | return this.client._request({
|
8 | method: 'GET',
|
9 | path: '/email/public/v1/subscriptions/timeline',
|
10 | qs: options,
|
11 | })
|
12 | }
|
13 |
|
14 | unsubscribe(email) {
|
15 | return this.client._request({
|
16 | method: 'PUT',
|
17 | path: `/email/public/v1/subscriptions/${email}`,
|
18 | body: {
|
19 | unsubscribeFromAll: true,
|
20 | },
|
21 | })
|
22 | }
|
23 |
|
24 | subscribeToAll(email) {
|
25 | return this.client._request({
|
26 | method: 'PUT',
|
27 | path: `/email/public/v1/subscriptions/${email}`,
|
28 | body: {
|
29 | subscribed: true,
|
30 | },
|
31 | })
|
32 | }
|
33 | }
|
34 |
|
35 | module.exports = Subscription
|