From b28d82e0cfd7403d7ffcc95ed14f371bf285cede Mon Sep 17 00:00:00 2001 From: Jonathan Dizdarevic Date: Sun, 5 Jul 2015 03:44:24 +0200 Subject: [PATCH] use case --- README.md | 19 +++++++++++++++++++ src/Command/CreateNotificationCommand.php | 13 ++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6033309..11a5cad 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,25 @@ dizda_onesignal_api: app_auth_key: %onesignal_app_auth_key% ``` +## Use + +Send a simple notification: + +```php +$client = $this->get('dizda_onesignal_api.service.client'); + +$client->notifications->add([ + 'headings' => [ + 'en' => 'Withdraw' + ], + 'contents' => [ + 'en' => 'Your withdraw has been sent!' + ], + 'included_segments' => ['All'], + 'url' => 'http://google.fr' +]); +``` + ## License MIT Licensed, see LICENSE. \ No newline at end of file diff --git a/src/Command/CreateNotificationCommand.php b/src/Command/CreateNotificationCommand.php index 519ec73..c718e40 100644 --- a/src/Command/CreateNotificationCommand.php +++ b/src/Command/CreateNotificationCommand.php @@ -39,6 +39,17 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $client = $this->getContainer()->get('dizda_onesignal_api.service.client'); - var_dump($client); + $client->notifications->add([ + 'headings' => [ + 'en' => 'Withdraw' + ], + 'contents' => [ + 'en' => 'Your withdraw has been sent!' + ], + 'include_player_ids' => ['6de78980-2297-11e5-ae29-43aa3272e73b'], +// 'included_segments' => ['All'], +// 'data' => ['foo' => 'bar'], + 'url' => 'http://bitter.io/privacy' + ]); } }