UNPKG

892 BJavaScriptView Raw
1class Workflow {
2 constructor(client) {
3 this.client = client
4 }
5
6 get(workflowId) {
7 return this.client._request({
8 method: 'GET',
9 path: `/automation/v3/workflows/${workflowId}`,
10 })
11 }
12
13 getAll() {
14 return this.client._request({
15 method: 'GET',
16 path: '/automation/v3/workflows',
17 })
18 }
19
20 enroll(workflowId, email) {
21 return this.client._request({
22 method: 'POST',
23 path: `/automation/v2/workflows/${workflowId}/enrollments/contacts/${email}`,
24 })
25 }
26
27 unenroll(workflowId, email) {
28 return this.client._request({
29 method: 'DELETE',
30 path: `/automation/v2/workflows/${workflowId}/enrollments/contacts/${email}`,
31 })
32 }
33
34 current(contactId) {
35 return this.client._request({
36 method: 'GET',
37 path: `/automation/v2/workflows/enrollments/contacts/${contactId}`,
38 })
39 }
40}
41
42module.exports = Workflow