소스 검색

criação de functions para GETs, POSTs, PUTs

Christian Matheus Batista Macedo 6 년 전
부모
커밋
e227c785fa
1개의 변경된 파일87개의 추가작업 그리고 3개의 파일을 삭제
  1. 87 3
      js/functions.js

+ 87 - 3
js/functions.js

@@ -60,8 +60,80 @@ var mktSuite = (function(){
60 60
     })
61 61
   }
62 62
 
63
-  actions.contactList = function () {
64
-    call('GET', '/contactlist', null, function (data) {
63
+  actions.getContactList = function (start, limit) {
64
+    start = start || 0
65
+    limit = limit || 100
66
+    call('GET', '/contactlist?start='+start+'&limit='+limit, null, function (data) {
67
+      console.log(data);
68
+    })
69
+  }
70
+
71
+  actions.postContactList = function (name, description) {
72
+    name = name
73
+    description = description || ''
74
+    call('POST', '/contactlist', {name: name, description: description}, function (data) {
75
+      console.log(data);
76
+    })
77
+  }
78
+
79
+  actions.getContactListId = function () {
80
+    call('GET', '/contactlist/22', null, function (data) {
81
+      console.log(data);
82
+    })
83
+  }
84
+
85
+  actions.putContactListId = function (name, description) {
86
+    name = name || ''
87
+    description = description || ''
88
+    call('PUT', '/contactlist/22', {name: name, description: description}, function (data) {
89
+      console.log(data);
90
+    })
91
+  }
92
+
93
+  actions.contactListFields = function () {
94
+    call('GET', '/contactlist/22/field', null, function (data) {
95
+      console.log(data);
96
+    })
97
+  }
98
+
99
+  actions.contactListContacts = function () {
100
+    call('GET', '/contactlist/22/contact', null, function (data) {
101
+      console.log(data);
102
+    })
103
+  }
104
+
105
+  actions.contact = function () {
106
+    call('GET', '/contact/200', null, function (data) {
107
+      console.log(data);
108
+    })
109
+  }
110
+
111
+  actions.field = function () {
112
+    call('GET', '/field/30', null, function (data) {
113
+      console.log(data);
114
+    })
115
+  }
116
+
117
+  actions.template = function () {
118
+    call('GET', '/template', null, function (data) {
119
+      console.log(data);
120
+    })
121
+  }
122
+
123
+  actions.templateId = function () {
124
+    call('GET', '/template/3', null, function (data) {
125
+      console.log(data);
126
+    })
127
+  }
128
+
129
+  actions.campaign = function () {
130
+    call('GET', '/campaign', null, function (data) {
131
+      console.log(data);
132
+    })
133
+  }
134
+
135
+  actions.campaignId = function () {
136
+    call('GET', '/campaign/4', null, function (data) {
65 137
       console.log(data);
66 138
     })
67 139
   }
@@ -71,5 +143,17 @@ var mktSuite = (function(){
71 143
 })();
72 144
 
73 145
 mktSuite.authentication(function() {
74
-  mktSuite.contactList()
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
+
75 159
 })