/** * @param array $fields */ public function editAppById($fields = []) { if (null !== $this->authConfig->appId && null !== $this->authConfig->authKey) { if (is_array($fields)) { $fields = json_encode($fields); $app = Curl::curlPut(Constant::ONESIGNAL_URL . '/apps/' . $this->authConfig->appId, $this->authConfig->authKey, $fields); return json_decode($app); } else { throw $this->createNotFoundException('editAppById parameters must be an array'); } } else { throw $this->createNotFoundException('Sorry App Id or Auth Key missing'); } }
/** * @param $notificationId * @param array $fields * @param bool $opened */ public function editNotificationById($notificationId, $fields = [], $opened = true) { if (null !== $this->authConfig->restApiKey && null !== $this->authConfig->appId) { if (is_array($fields)) { $fieldsAppId = ['app_id' => $this->authConfig->appId, 'opened' => $opened]; $fieldsMerge = array_merge($fields, $fieldsAppId); $data = json_encode($fieldsMerge); $notifications = Curl::curlPut(Constant::ONESIGNAL_URL . '/notifications/' . $notificationId, $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 or App Id missing, check up your config file'); } }
public function editPlayerDevices($playersId, $fields) { if (null !== $this->authConfig->appId) { if (is_array($fields)) { $fieldsAppId = ['app_id' => $this->authConfig->appId]; $fieldsMerge = array_merge($fields, $fieldsAppId); $data = json_encode($fieldsMerge); $players = Curl::curlPut(Constant::ONESIGNAL_URL . '/players/' . $playersId, null, $data); return json_decode($players); } else { throw $this->createNotFoundException('editPlayerDevices parameters must be an array'); } } else { throw $this->createNotFoundException('Sorry App id missing, check up your config file'); } }