/** * @param array $fields */ public function createApp($fields = []) { if (null !== $this->authConfig->authKey) { if (is_array($fields)) { $fields = json_encode($fields); $app = Curl::curlPost(Constant::ONESIGNAL_URL . '/apps', $this->authConfig->authKey, $fields); return json_decode($app); } else { throw $this->createNotFoundException('createApp parameters must be an array'); } } else { throw $this->createNotFoundException('Sorry App Id or Auth Key missing'); } }
/** * @param array $fields */ public function createNotification($fields = []) { if (null !== $this->authConfig->restApiKey && null !== $this->authConfig->appId) { if (is_array($fields)) { $fieldsAppId = ['app_id' => $this->authConfig->appId]; $fieldsMerge = array_merge($fields, $fieldsAppId); $data = json_encode($fieldsMerge); $notifications = Curl::curlPost(Constant::ONESIGNAL_URL . '/notifications', $this->authConfig->restApiKey, $data); return json_decode($notifications); } else { throw $this->createNotFoundException('createNotification parameters must be an array'); } } else { throw $this->createNotFoundException('Sorry Rest Api Key missing, check up your config file'); } }
public function createPlayerCsvExport() { if (null !== $this->authConfig->restApiKey && null !== $this->authConfig->appId) { $players = Curl::curlPost(Constant::ONESIGNAL_URL . '/players/csv_export?app_id=' . $this->authConfig->appId, $this->authConfig->restApiKey); return json_decode($players); } else { return 'Sorry you need the App Id'; } }