|
@@ -90,70 +90,188 @@ var mktSuite = (function(){
|
90
|
90
|
})
|
91
|
91
|
}
|
92
|
92
|
|
93
|
|
- actions.contactListFields = function () {
|
|
93
|
+ actions.getContactListFields = function () {
|
94
|
94
|
call('GET', '/contactlist/22/field', null, function (data) {
|
95
|
95
|
console.log(data);
|
96
|
96
|
})
|
97
|
97
|
}
|
98
|
98
|
|
99
|
|
- actions.contactListContacts = function () {
|
100
|
|
- call('GET', '/contactlist/22/contact', null, function (data) {
|
|
99
|
+ actions.postContactListFields = function (cli, name, tag) {
|
|
100
|
+ ct = 'string'
|
|
101
|
+ cli = cli
|
|
102
|
+ name = name
|
|
103
|
+ tag = tag || ''
|
|
104
|
+ call('POST', '/field', {columnType: ct, contactListId: cli, name: name, tag: tag}, function (data) {
|
|
105
|
+ console.log(data);
|
|
106
|
+ })
|
|
107
|
+ }
|
|
108
|
+
|
|
109
|
+ actions.getContactListContacts = function (start, limit, filter) {
|
|
110
|
+ start = start || 0
|
|
111
|
+ limit = limit || 100
|
|
112
|
+ name = filter || ''
|
|
113
|
+ email = filter || ''
|
|
114
|
+ phone = filter || ''
|
|
115
|
+ call('GET', '/contactlist/22/contact?start='+start+'&limit='+limit+'&name='+filter+'&email='+filter+'&phone='+filter, null, function (data) {
|
101
|
116
|
console.log(data);
|
102
|
117
|
})
|
103
|
118
|
}
|
104
|
119
|
|
105
|
|
- actions.contact = function () {
|
|
120
|
+ actions.getContact = function () {
|
106
|
121
|
call('GET', '/contact/200', null, function (data) {
|
107
|
122
|
console.log(data);
|
108
|
123
|
})
|
109
|
124
|
}
|
110
|
125
|
|
111
|
|
- actions.field = function () {
|
112
|
|
- call('GET', '/field/30', null, function (data) {
|
|
126
|
+ actions.postContact = function (cli, name, email, phone) {
|
|
127
|
+ cli = cli
|
|
128
|
+ name = name
|
|
129
|
+ email = email
|
|
130
|
+ phone = phone
|
|
131
|
+ call('POST', '/contact', {contactListId: cli, name: name, email: email, phone: phone}, function (data) {
|
|
132
|
+ console.log(data);
|
|
133
|
+ })
|
|
134
|
+ }
|
|
135
|
+
|
|
136
|
+ actions.putContact = function (cli, name, email, phone) {
|
|
137
|
+ cli = cli || ''
|
|
138
|
+ name = name || ''
|
|
139
|
+ email = email || ''
|
|
140
|
+ phone = phone || ''
|
|
141
|
+ call('PUT', '/contact/200', {contactListId: cli, name: name, email: email, phone: phone}, function (data) {
|
|
142
|
+ console.log(data);
|
|
143
|
+ })
|
|
144
|
+ }
|
|
145
|
+
|
|
146
|
+ actions.deleteContact = function () {
|
|
147
|
+ call('DELETE', '/contact/205', null, function (data) {
|
|
148
|
+ console.log(data);
|
|
149
|
+ })
|
|
150
|
+ }
|
|
151
|
+
|
|
152
|
+ actions.getField = function () {
|
|
153
|
+ call('GET', '/field/74', null, function (data) {
|
|
154
|
+ console.log(data);
|
|
155
|
+ })
|
|
156
|
+ }
|
|
157
|
+
|
|
158
|
+ actions.putField = function (name, tag) {
|
|
159
|
+ name = name || ''
|
|
160
|
+ tag = tag || ''
|
|
161
|
+ call('PUT', '/field/32', {name: name, tag: tag}, function (data) {
|
113
|
162
|
console.log(data);
|
114
|
163
|
})
|
115
|
164
|
}
|
116
|
165
|
|
117
|
|
- actions.template = function () {
|
118
|
|
- call('GET', '/template', null, function (data) {
|
|
166
|
+ actions.deleteField = function () {
|
|
167
|
+ call('DELETE', '/field/75', null, function (data) {
|
119
|
168
|
console.log(data);
|
120
|
169
|
})
|
121
|
170
|
}
|
122
|
171
|
|
123
|
|
- actions.templateId = function () {
|
124
|
|
- call('GET', '/template/3', null, function (data) {
|
|
172
|
+ actions.getTemplate = function (start, limit) {
|
|
173
|
+ start = start || 0
|
|
174
|
+ limit = limit || 100
|
|
175
|
+ call('GET', '/template?start='+start+'&limit='+limit, null, function (data) {
|
125
|
176
|
console.log(data);
|
126
|
177
|
})
|
127
|
178
|
}
|
128
|
179
|
|
129
|
|
- actions.campaign = function () {
|
130
|
|
- call('GET', '/campaign', null, function (data) {
|
|
180
|
+ actions.postTemplate = function (name, content) {
|
|
181
|
+ name = name
|
|
182
|
+ content = content
|
|
183
|
+ call('POST', '/template', {name: name, content: content}, function (data) {
|
131
|
184
|
console.log(data);
|
132
|
185
|
})
|
133
|
186
|
}
|
134
|
187
|
|
135
|
|
- actions.campaignId = function () {
|
|
188
|
+ actions.getTemplateId = function () {
|
|
189
|
+ call('GET', '/template/4', null, function (data) {
|
|
190
|
+ console.log(data);
|
|
191
|
+ })
|
|
192
|
+ }
|
|
193
|
+
|
|
194
|
+ actions.deleteTemplateId = function () {
|
|
195
|
+ call('DELETE', '/template/5', null, function (data) {
|
|
196
|
+ console.log(data);
|
|
197
|
+ })
|
|
198
|
+ }
|
|
199
|
+
|
|
200
|
+ actions.putTemplateId = function (name, content) {
|
|
201
|
+ name = name || ''
|
|
202
|
+ content = content || ''
|
|
203
|
+ call('PUT', '/template/3', {name: name, content: content}, function (data) {
|
|
204
|
+ console.log(data);
|
|
205
|
+ })
|
|
206
|
+ }
|
|
207
|
+
|
|
208
|
+ actions.getCampaign = function (start, limit) {
|
|
209
|
+ start = start || 0
|
|
210
|
+ limit = limit || 100
|
|
211
|
+ call('GET', '/campaign?start='+start+'&limit='+limit, null, function (data) {
|
|
212
|
+ console.log(data);
|
|
213
|
+ })
|
|
214
|
+ }
|
|
215
|
+
|
|
216
|
+ actions.postCampaign = function (cli, tpi, name, ro) {
|
|
217
|
+ cli = cli
|
|
218
|
+ tpi = tpi
|
|
219
|
+ name = name
|
|
220
|
+ runOn = ro
|
|
221
|
+ call('POST', '/campaign', {contactListId: cli, templateId: tpi, name: name, runOn: ro}, function (data) {
|
|
222
|
+ console.log(data);
|
|
223
|
+ })
|
|
224
|
+ }
|
|
225
|
+
|
|
226
|
+ actions.getCampaignId = function () {
|
136
|
227
|
call('GET', '/campaign/4', null, function (data) {
|
137
|
228
|
console.log(data);
|
138
|
229
|
})
|
139
|
230
|
}
|
140
|
231
|
|
|
232
|
+ actions.deleteCampaignId = function () {
|
|
233
|
+ call('DELETE', '/campaign/8', null, function (data) {
|
|
234
|
+ console.log(data);
|
|
235
|
+ })
|
|
236
|
+ }
|
|
237
|
+
|
|
238
|
+ actions.putCampaignId = function (cli, tpi, name, ro) {
|
|
239
|
+ cli = cli || ''
|
|
240
|
+ tpi = tpi || ''
|
|
241
|
+ name = name || ''
|
|
242
|
+ runOn = ro || ''
|
|
243
|
+ call('PUT', '/campaign/4', null, function (data) {
|
|
244
|
+ console.log(data);
|
|
245
|
+ })
|
|
246
|
+ }
|
|
247
|
+
|
141
|
248
|
return actions
|
142
|
249
|
|
143
|
250
|
})();
|
144
|
251
|
|
145
|
252
|
mktSuite.authentication(function() {
|
146
|
|
- mktSuite.getContactList()
|
147
|
|
- mktSuite.postContactList('teste')
|
148
|
|
- mktSuite.getContactListId('trocado')
|
149
|
|
- mktSuite.putContactListId()
|
150
|
|
- mktSuite.contactListFields()
|
151
|
|
- mktSuite.contactListContacts()
|
152
|
|
- mktSuite.contact()
|
153
|
|
- mktSuite.field()
|
154
|
|
- mktSuite.template()
|
155
|
|
- mktSuite.templateId()
|
156
|
|
- mktSuite.campaign()
|
157
|
|
- mktSuite.campaignId()
|
158
|
|
-
|
|
253
|
+ // mktSuite.getContactList()
|
|
254
|
+ // mktSuite.postContactList('teste')
|
|
255
|
+ // mktSuite.getContactListId()
|
|
256
|
+ // mktSuite.putContactListId()
|
|
257
|
+ // mktSuite.getContactListFields()
|
|
258
|
+ // mktSuite.postContactListFields('22', 'vai saber')
|
|
259
|
+ // mktSuite.getContactListContacts()
|
|
260
|
+ // mktSuite.getContact()
|
|
261
|
+ // mktSuite.deleteContact()
|
|
262
|
+ // mktSuite.postContact('22','nome','email@teste.com','5173626514')
|
|
263
|
+ // mktSuite.putContact()
|
|
264
|
+ // mktSuite.getField()
|
|
265
|
+ // mktSuite.putField()
|
|
266
|
+ // mktSuite.deleteField()
|
|
267
|
+ // mktSuite.getTemplate()
|
|
268
|
+ // mktSuite.postTemplate('template teste','tchau')
|
|
269
|
+ // mktSuite.getTemplateId()
|
|
270
|
+ // mktSuite.putTemplateId()
|
|
271
|
+ // mktSuite.deleteTemplateId()
|
|
272
|
+ // mktSuite.getCampaign()
|
|
273
|
+ // mktSuite.postCampaign('22', '3', 'campanha teste', '2019-04-23T18:25:43.511Z')
|
|
274
|
+ // mktSuite.getCampaignId()
|
|
275
|
+ // mktSuite.putCampaignId()
|
|
276
|
+ // mktSuite.deleteCampaignId()
|
159
|
277
|
})
|