Пример #1
0
 public function create($params)
 {
     if (!isset($params['message'])) {
         throw new osapiException("Missing message in osapiMessages->create()");
     }
     if (!$params['message'] instanceof osapiMessage) {
         throw new osapiException("The params['message'] should be a osapiMessage in osapiMessages->create()");
     }
     return osapiRequest::createRequest('messages.create', $params);
 }
 /**
  * Gets status and mood. Uses specific endpoint for this
  * Myspace specific
  * @return osapiRequest the request
  */
 public function get($params)
 {
     if (!array_key_exists('userId', $params)) {
         $params['userId'] = '@me';
     }
     if (!array_key_exists('groupId', $params)) {
         $params['groupId'] = '@self';
     }
     return osapiRequest::createRequest('profilecomments.get', $params);
 }
 /**
  * Creates an album
  *
  * @param array $params the parameters defining the album to create
  * @return osapiRequest the request
  */
 public function create($params)
 {
     if (!isset($params['album'])) {
         throw new osapiException("Missing album in osapiAlbums->create()");
     }
     if (!$params['album'] instanceof osapiAlbum) {
         throw new osapiException("The params['album'] should be a osapiAlbum in osapiAlbums->create()");
     }
     //TODO: check album.field restrictions
     return osapiRequest::createRequest('albums.create', $params);
 }
 /**
  * Creates an activity.
  *
  * @param array $params the parameters defining the activity to create
  * @return osapiRequest the request
  */
 public function create($params) {
   // basic sanity checking of the request object
   if (!isset($params['userId'])) throw new osapiException("Missing 'userId' param for osapiActivities->create");
   if (!isset($params['groupId'])) throw new osapiException("Missing 'groupId' param for osapiActivities->create");
   if (!isset($params['activity'])) throw new osapiException("Missing 'activity' param for osapiActivities->create");
   if (!$params['activity'] instanceof osapiActivity) throw new osapiException("Activity param should be a osapiActivity in osapiActivities->create");
   // strip out the null values before we post the activity
   $params['activity'] = self::trimResponse($params['activity']);
   // add appId => @app if it is missing.
   if (!isset($params['appId'])) {
     $params['appId'] = '@app';
   }
   
   return osapiRequest::createRequest('activities.create', $params);
 }
 public function delete($params)
 {
     if (!isset($params['userId'])) {
         throw new osapiException("Invalid or no userId specified for osapiAppData->delete");
     }
     if (!isset($params['groupId'])) {
         throw new osapiException("Invalid or no groupId specified for osapiAppData->delete");
     }
     if (!isset($params['appId'])) {
         throw new osapiException("Invalid or no appId specified for osapiAppData->delete");
     }
     if (isset($params['fields'])) {
         if (!is_array($params['fields'])) {
             throw new osapiException("Optional param 'fields' should be an array in osapiAppData->delete");
         }
         foreach ($params['fields'] as $key) {
             if (!self::isValidKey($key)) {
                 throw new osapiException("Invalid key specified in osapiAppData->delete: {$key}");
             }
         }
     }
     return osapiRequest::createRequest('appdata.delete', $params);
 }
 /**
  * Sets status. Uses specific endpoint for this
  * Myspace specific
  * @return osapiRequest the request
  */
 public function update($params)
 {
     $params = array_merge($params, array('userId' => '@me', 'groupId' => '@self'));
     return osapiRequest::createRequest('statusmood.update', $params);
 }
 /**
  * Tests osapiRequest->createRequest()
  */
 public function testCreateRequestWithBadGroup()
 {
     $this->setExpectedException('osapiException');
     $request = osapiRequest::createRequest('people.get', array('userId' => true, 'groupId' => '@family'));
 }
 /**
  * Gets a users group.
  *
  * @param array $params the parameters defining which groups to fetch
  * @return osapiRequest the request
  */
 public function get($params)
 {
     return osapiRequest::createRequest('groups.get', $params);
 }
Пример #9
0
 /**
  * Gets the application's viewer.
  *
  * @param array $params the parameters defining which people to retrieve
  * @return osapiRequest the request
  */
 public function getViewer($params)
 {
     return osapiRequest::createRequest('people.get', array_merge(array('userId' => '@viewer'), $params));
 }
Пример #10
0
 /**
  * Upload mediaItem to an album
  *
  * @param array $params the parameters defining the album and mediaItem data to upload
  * @return osapiRequest the request
  */
 public function uploadContent($params)
 {
     return osapiRequest::createRequest('mediaItems.upload', $params);
 }
 /**
  * Calls the system.listMethods method that returns an array
  * of supported RPC methods, ie something like:
  * array('people.get', 'activities.get', 'activities.create', etc)
  *
  * @return osapiRequest
  */
 public function listMethods()
 {
     return osapiRequest::createRequest('system.listMethods', array());
 }
 public function create($params)
 {
     $params = array_merge($params, array('userId' => '@me', 'groupId' => '@self'));
     return osapiRequest::createRequest('notifications.create', $params);
 }