Esempio n. 1
0
 public function restorePassword($identity)
 {
     if (!isset($identity) || $identity == null) {
         throw new BackendlessException("Identity cannot be null");
     } else {
         RequestBuilder::doRequest('users', 'restorepassword/' . urlencode($identity), null, 'GET');
     }
 }
Esempio n. 2
0
 public function writeLog($message, $type)
 {
     $log_data = [];
     $log_data[0] = [];
     $log_data[0]["log-level"] = $type;
     $log_data[0]["logger"] = $this->getName();
     $log_data[0]["timestamp"] = time();
     $log_data[0]["message"] = $message;
     $log_data[0]["exception"] = "";
     RequestBuilder::doRequest('log', null, $log_data, 'PUT');
 }
Esempio n. 3
0
 public function sendEmail($subject, $body, $to, $attachments = null, $html)
 {
     if (!is_array($to)) {
         $to = [$to];
     }
     $data = ["subject" => $subject, "to" => $to];
     if ($html) {
         $data["bodyparts"] = ["htmlmessage" => $body];
     } else {
         $data["bodyparts"] = ["textmessage" => $body];
     }
     if ($attachments !== null) {
         $data["attachment"] = $attachments;
     }
     return RequestBuilder::doRequestByUrl(Backendless::getUrl() . "/" . Backendless::getVersion() . "/messaging/email", $data, 'POST');
 }
Esempio n. 4
0
 public function exists($file_path)
 {
     $file_path = trim($file_path);
     $file_path = trim($file_path, "\\\\/");
     if (empty($file_path)) {
         throw new Exception("File path variable empty");
     }
     return RequestBuilder::doRequest('files/exists', $file_path, '', 'GET');
 }
Esempio n. 5
0
 public function reset($counter_name)
 {
     RequestBuilder::doRequestByUrl(Backendless::getUrl() . "/" . Backendless::getVersion() . "/counters/" . $counter_name . "/reset", '', 'PUT');
 }
Esempio n. 6
0
 public function expireAt($key, $timestamp)
 {
     $timestamp = $timestamp * 1000;
     RequestBuilder::doRequestByUrl(Backendless::getUrl() . "/" . Backendless::getVersion() . "/cache/" . $key . "expireAt?timestamp=" . $timestamp, '', 'PUT');
 }
Esempio n. 7
0
 public function dispatch($event_name, $event_args_array = null)
 {
     return RequestBuilder::doRequestByUrl(Backendless::getUrl() . "/" . Backendless::getVersion() . "/servercode/events/" . $event_name, $event_args_array, 'POST');
 }
 public function retrivePageByUrl($url)
 {
     return RequestBuilder::doRequestByUrl($url, null, 'GET');
 }
Esempio n. 9
0
 public function resendEmailConfirmation($email_address)
 {
     RequestBuilder::doRequest('users', 'resendconfirmation?email=' . $email_address, null, 'POST');
 }
Esempio n. 10
0
 public function describe($entity_name)
 {
     return RequestBuilder::doRequest('data', $entity_name . "/properties", null, 'GET');
 }
Esempio n. 11
0
 private function runAction($action_name, $geofence_name, $geopoint = null)
 {
     $url = "fence/" . $action_name . "?geoFence=" . $geofence_name;
     $headers = [];
     $headers['application-id'] = Backendless::getApplicationId();
     $headers['secret-key'] = Backendless::getSecretKey();
     $headers['application-type'] = 'REST';
     $geopoint_data = [];
     if ($geopoint !== null) {
         if (is_object($geopoint)) {
             $geopoint_data['latitude'] = $geopoint->getLatitude();
             $geopoint_data['longitude'] = $geopoint->getLongitude();
         } else {
             $geopoint_data = $geopoint;
         }
         $headers['Content-Type'] = 'application/json';
     } else {
         $geopoint_data = null;
     }
     return RequestBuilder::doRequestWithHeaders("geo", $url, $geopoint_data, "POST", $headers)["totalObjects"];
 }