File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed
Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ public function getTask($taskId)
123123 */
124124 public function getSubTasks ($ taskId )
125125 {
126- return $ this ->curl ->get ("tasks/ {$ taskId }/subtasks " );
126+ return $ this ->curl ->get ("tasks/ {$ taskId }/subtasks " );
127127 }
128128
129129 /**
@@ -545,6 +545,29 @@ public function getWorkspaceUsers($workspaceId = null)
545545 return $ this ->curl ->get ("workspaces/ {$ workspaceId }/users " );
546546 }
547547
548+ /**
549+ * Returns events of a given project
550+ *
551+ * @param string $projectId The id of the project
552+ * @return string JSON or null
553+ */
554+ public function getProjectEvents ($ projectId = null )
555+ {
556+ $ projectId = $ projectId ?: $ this ->defaultProjectId ;
557+
558+ return $ this ->curl ->get ("projects/ {$ projectId }/events " );
559+ }
560+
561+ /**
562+ * Return event sync key
563+ *
564+ * @return mixed
565+ */
566+ public function getSyncKey ()
567+ {
568+ return $ this ->curl ->getSyncKey ();
569+ }
570+
548571 /**
549572 * Return error
550573 *
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ class AsanaCurl {
2121
2222 private $ apiKey ;
2323 private $ accessToken ;
24+ private $ syncKey ;
2425 private $ curl ;
2526
2627 /**
@@ -98,6 +99,16 @@ public function getErrors()
9899 return $ this ->errors ;
99100 }
100101
102+ /**
103+ * Return sync key
104+ *
105+ * @return mixed
106+ */
107+ public function getSyncKey ()
108+ {
109+ return $ this ->syncKey ;
110+ }
111+
101112 /**
102113 * This function communicates with Asana REST API.
103114 * You don't need to call this function directly. It's only for inner class working.
@@ -246,6 +257,12 @@ private function checkForCurlErrors($response)
246257 return $ error ->message ;
247258 }, $ response ->errors ));
248259
260+ // fetch sync key for event handling
261+ if (isset ($ response ->sync ))
262+ {
263+ $ this ->syncKey = $ response ->sync ;
264+ }
265+
249266 throw new Exception ($ errors , $ resultStatus ['http_code ' ]);
250267 }
251268
You can’t perform that action at this time.
0 commit comments