Example #1
0
 public function authForAccessToken($responseKey = false)
 {
     if ($responseKey) {
         $this->responseKey = $responseKey;
     }
     $url = $this->accessRequestUrlBase . '&code=' . $this->responseKey . '&client_id=' . $this->apiKey;
     $auth = Utilities::callApi($url, false, 'GET');
     if ($auth && is_object($auth)) {
         if (isset($auth->access_token)) {
             $this->accessToken = $auth->access_token;
         }
         if (isset($auth->organizer_key)) {
             $this->organizerKey = $auth->organizer_key;
         }
     }
 }
Example #2
0
 /**
  * Load informaton about a user from the server.
  * 
  * Citrix allows loading user information using either an organizerKey or 
  * an email address. You must be an Admin of a corporate account to load
  * information about any user other than yourself. 
  * 
  * @param string $username Ether an organizerKey or email address 
  */
 public function getServerUserDetails($username = false)
 {
     if ($this->isAuthenticated()) {
         if (!$username && !isset($this->username)) {
             throw new \ErrorException('A username must be set or provided 
                 to pull server details.', 183);
         } elseif (isset($this->username)) {
             $username = $this->username;
         }
         if (strpos($username, '@') > 0) {
             $url = 'https://api.citrixonline.com/G2M/rest/organizers?email=' . $username;
         } else {
             $url = 'https://api.citrixonline.com/G2M/rest/organizers/' . $username;
         }
         $response = Utilities::callApi($url, $this->getAccessToken(), 'GET');
         if (is_array($response)) {
             $response = $response[0];
         }
         return $response;
     }
 }
Example #3
0
 /**
  * Retrieve a list of attendees
  * 
  * @return ItemList
  * @throws ErrorException If there is a problem with API call.
  */
 public function getAttendeeList()
 {
     $attendeeList = new ItemList();
     if ($this->isAuthenticated() && isset($this->meetingKey)) {
         $url = 'https://api.citrixonline.com/G2M/rest/meetings/' . $this->meetingKey . '/attendees' . '?startDate=' . date('c', $this->meetingStart) . '&endDate=' . date('c', $this->meetingEnd);
         $results = Utilities::callApi($url, $this->getAccessToken(), 'GET');
         if ($results) {
             foreach ($results as $person) {
                 $personDetails = array('name' => $person->attendeeName, 'email' => $person->attendeeEmail, 'meetingKey' => $this->getMeetingKey());
                 $attendeeList->addItem(new Attendee($this->getAuthInfo(), $personDetails));
             }
         }
     } else {
         if (!$this->isAuthenticated()) {
             throw new \ErrorException('User must be authenticated and an 
                 accessToken is needed to list attendees.', 181);
         } else {
             throw new \ErrorException('A meeting key is required to 
                 list attendees.', 182);
         }
     }
     return $attendeeList;
 }
Example #4
0
 public function deleteMeeting()
 {
     if ($this->isAuthenticated() && isset($this->meetingKey)) {
         $url = 'https://api.citrixonline.com/G2M/rest/meetings/' . $this->meetingKey;
         $response = Utilities::callApi($url, $this->getAccessToken(), 'DELETE');
         if ($response) {
             if ($response->success) {
                 return $this;
             }
         }
     } else {
         if (!$this->isAuthenticated()) {
             throw new \ErrorException('User must be authenticated and an 
                 accessToken is needed to delete meetings.', 179);
         } else {
             throw new \ErrorException('A meeting key is required to 
                 delete meetings.', 180);
         }
     }
 }