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'); } }
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'); }
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'); }
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'); }
public function reset($counter_name) { RequestBuilder::doRequestByUrl(Backendless::getUrl() . "/" . Backendless::getVersion() . "/counters/" . $counter_name . "/reset", '', 'PUT'); }
public function expireAt($key, $timestamp) { $timestamp = $timestamp * 1000; RequestBuilder::doRequestByUrl(Backendless::getUrl() . "/" . Backendless::getVersion() . "/cache/" . $key . "expireAt?timestamp=" . $timestamp, '', 'PUT'); }
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'); }
public function resendEmailConfirmation($email_address) { RequestBuilder::doRequest('users', 'resendconfirmation?email=' . $email_address, null, 'POST'); }
public function describe($entity_name) { return RequestBuilder::doRequest('data', $entity_name . "/properties", null, 'GET'); }
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"]; }