@@ -65,25 +65,6 @@ public static function fromDsn($dsn)
6565 return new self ($ username , $ password , $ apiUrl , $ account , $ library , $ transportAccount );
6666 }
6767
68- /*
69- public function setTemplateNamePrefix($prefix)
70- {
71- $this->templateNamePrefix = $prefix;
72-
73- return $this;
74- }
75- */
76-
77- /*
78- public function setToAddressOverride($address)
79- {
80- $this->toAddressOverride = $address;
81-
82- return $this;
83- }
84- */
85-
86- // USE
8768 public function send (MessageInterface $ message , $ skipNamePrefix = false )
8869 {
8970 $ guzzleclient = new GuzzleClient ();
@@ -102,32 +83,6 @@ public function send(MessageInterface $message, $skipNamePrefix = false)
10283 return 200 == $ res ->getStatusCode ();
10384 }
10485
105- /*
106- public function preview(MessageInterface $message, $skipNamePrefix = false)
107- {
108- $guzzleclient = new GuzzleClient();
109-
110- $url = $this->baseUrl.'/preview/';
111- $url .= $this->patchTemplateName($message->getTemplate(), $skipNamePrefix);
112- $url .= '?to='.$message->getToAddress();
113-
114- $res = $guzzleclient->post($url, [
115- 'auth' => [$this->username, $this->password],
116- 'headers' => ['content-type' => 'application/json'],
117- 'body' => $message->serializeData(true),
118- ]);
119-
120- return json_decode($res->getBody());
121- }
122- */
123- /*
124- public function checkTemplate($templateName)
125- {
126- return $this->templateExists($templateName);
127- }
128- */
129-
130- // USE
13186 public function templateExists ($ templateName , $ skipNamePrefix = false )
13287 {
13388 $ guzzleclient = new GuzzleClient ();
@@ -147,7 +102,6 @@ public function templateExists($templateName, $skipNamePrefix = false)
147102 return false ;
148103 }
149104
150- // USE
151105 private function patchTemplateName ($ templateName , $ skipNamePrefix = false )
152106 {
153107 if ($ skipNamePrefix ) {
@@ -157,13 +111,11 @@ private function patchTemplateName($templateName, $skipNamePrefix = false)
157111 }
158112 }
159113
160- // USE
161114 private function escapeTemplateName ($ templateName )
162115 {
163116 return str_replace ('/ ' , '___ ' , $ templateName );
164117 }
165118
166- // USE
167119 public function getMessages ()
168120 {
169121 $ guzzleclient = new GuzzleClient ();
@@ -199,7 +151,6 @@ public function getMessages()
199151 return $ data ;
200152 }
201153
202- // USE
203154 public function getMessageById ($ messageId )
204155 {
205156 $ guzzleclient = new GuzzleClient ();
@@ -246,73 +197,46 @@ private function doQuery($method, $url, $data = null)
246197 return json_decode ($ res ->getBody (), true );
247198 }
248199
249- // USE
250200 public function getLists ()
251201 {
252202 return $ this ->doQuery ('GET ' , 'list ' );
253203 }
254204
255- /*
256- public function getTemplates()
257- {
258- return $this->doQuery('GET', 'templates');
259- }
260- */
261-
262- // USE
263205 public function getContacts ($ listId )
264206 {
265207 return $ this ->doQuery ('GET ' , 'list/ ' .$ listId );
266208 }
267209
268- /*
269- public function getListFields($listId)
270- {
271- return $this->doQuery('GET', 'list/'.$listId.'/list_field');
272- }
273- */
274- // USE
275210 public function getListConditions ($ listId )
276211 {
277212 return $ this ->doQuery ('GET ' , 'list/ ' .$ listId .'/conditions ' );
278213 }
279214
280- // public function getSegments($listId)
281- // {
282- // return $this->doQuery('GET', 'list/'.$listId.'/segment');
283- // }
284-
285- // USE
286215 public function viewContact ($ contactId )
287216 {
288217 return $ this ->doQuery ('GET ' , 'contact/ ' .$ contactId );
289218 }
290219
291- // USE
292220 public function deleteContact ($ contactId )
293221 {
294222 return $ this ->doQuery ('GET ' , 'contact/ ' .$ contactId .'/delete ' );
295223 }
296224
297- // USE
298225 public function addContact ($ listId , $ address )
299226 {
300227 return $ this ->doQuery ('GET ' , 'contact/add/ ' .$ listId .'/ ' .$ address , []);
301228 }
302229
303- // USE
304230 public function getContactProperties ($ contactId )
305231 {
306232 return $ this ->doQuery ('GET ' , 'contact/ ' .$ contactId .'/contact_property ' );
307233 }
308234
309- // USE
310235 public function deleteProperty ($ propertyId )
311236 {
312237 return $ this ->doQuery ('GET ' , 'contact_property/ ' .$ propertyId .'/delete ' );
313238 }
314239
315- // USe
316240 public function addProperty ($ contactId , $ fieldId , $ value )
317241 {
318242 return $ this ->doQuery ('POST ' , 'contact_property/add ' , [
@@ -322,16 +246,6 @@ public function addProperty($contactId, $fieldId, $value)
322246 ]);
323247 }
324248
325- /*
326- public function changeContactAddress($oldAddress, $newAddress)
327- {
328- return $this->doQuery('POST', 'contact/change', [
329- 'from' => $oldAddress,
330- 'to' => $newAddress,
331- ]);
332- }
333- */
334-
335249 //---------------------------- -----------------------------
336250 // ------------ Message convert to Object-------------------
337251 private function arrayToMessage ($ m )
0 commit comments