/** * Converts a response into a native data type. * * @param array $array the raw data * @param boolean $strictMode whether to throw spec errors * @return osapiPerson */ public static function convertArray($array, $strictMode = true) { $instance = new osapiNotification(); $defaults = get_class_vars('osapiNotification'); if ($strictMode && sizeof($defaults != sizeof($array))) { throw new osapiException("Unexpected fields in notifications response" . print_r($array, true)); } foreach ($array as $key => $value) { $instance->setField($key, $value); } return self::trimResponse($instance); }
*/ // Default to myspace because this is a myspace specific endpoint. if (!isset($_REQUEST["test"])) { $_REQUEST["test"] = 'myspace'; } require_once "__init__.php"; if ($osapi) { if ($strictMode) { $osapi->setStrictMode($strictMode); } // Start a batch so that many requests may be made at once. $batch = $osapi->newBatch(); // Set the status mood MySpace specific. $mediaItem = new osapiMediaItem(); $mediaItem->setField('uri', 'http://api.myspace.com/v1/users/63129100'); $notification = new osapiNotification(); $notification->setField('recipientIds', array('63129100')); $notification->setField('mediaItems', array($mediaItem)); $notification->setTemplateParameter('content', 'Hi ${recipient}, here\'s a notification from ${canvasUrl}'); $params = array('notification' => $notification); $batch->add($osapi->notifications->create($params), 'send_notification'); // Send the batch request. $result = $batch->execute(); ?> <h1>Notification API Examples</h1> <h2>Request:</h2> <p>This sample creates a notification(msypace specific)</p> <?php require_once 'response_block.php'; }