You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/06/02 10:28:11 UTC

svn commit: r950417 - in /shindig/trunk/features/src/main/javascript/features/opensocial-reference: container.js datarequest.js taming.js

Author: lindner
Date: Wed Jun  2 08:28:11 2010
New Revision: 950417

URL: http://svn.apache.org/viewvc?rev=950417&view=rev
Log:
SHINDIG-1347 | Patch from Henry Saputra | Add the missing Javascript APIs for Album and MediaItem based on OpenSocial v0.9

Modified:
    shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js
    shindig/trunk/features/src/main/javascript/features/opensocial-reference/datarequest.js
    shindig/trunk/features/src/main/javascript/features/opensocial-reference/taming.js

Modified: shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js?rev=950417&r1=950416&r2=950417&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-reference/container.js Wed Jun  2 08:28:11 2010
@@ -216,6 +216,41 @@ opensocial.Container.prototype.requestDa
 
 
 /**
+ * Creates a new album and returns the ID of the album created.
+ *
+ * @param {opensocial.IdSpec} idSpec The ID of the used to specify which people/groups
+ *   to create an album for.
+ * @param {opensocial.Album} album The album to create.
+ * @return {Object} A request object
+ * @private
+ */
+opensocial.Container.prototype.newCreateAlbumRequest = function(idSpec, album) {};
+
+/**
+ * Creates a new media item in the album and returns the ID of the album created.
+ *
+ * @param {opensocial.IdSpec} idSpec The ID of the used to specify which people/groups
+ *   to create an album for.
+ * @param {string} albumId The ID of album to add the media item to.
+ * @param {openSocial.MediaItem} mediaItem The media item instance to add to the album.
+ * @return {Object} A request object
+ * @private
+ */
+opensocial.Container.prototype.newCreateMediaItemRequest = function(idSpec, albumId,
+    mediaItem) {};
+
+/**
+ * Deletes the album specified.
+ *
+ * @param {opensocial.IdSpec} idSpec The ID of the used to specify which people/groups
+ *   to create an album for.
+ * @param {string} albumId The ID of the album to create.
+ * @return {Object} A request object
+ * @private
+ */
+opensocial.Container.prototype.newDeleteAlbumRequest = function(idSpec, albumId) {};
+
+/**
  * Request a profile for the specified person id.
  * When processed, returns a Person object.
  *
@@ -297,6 +332,31 @@ opensocial.Container.prototype.newUpdate
 opensocial.Container.prototype.newRemovePersonAppDataRequest = function(
     keys) {};
 
+/**
+ * Updates the fields for an album specified in the params.
+ * The following fields cannot be set: MEDIA_ITEM_COUNT, OWNER_ID, ID.
+ *
+ * @param {opensocial.IdSpec} idSpec An IdSpec used to specify which people/groups
+ *    to own the album.
+ * @param {string} albumId The ID of album to update.
+ * @param {Object.<opensocial.Album.Field, Object>=} opt_params The album fields to update.
+ * @return {Object} A request object
+ */
+opensocial.Container.prototype.newUpdateAlbumRequest = function(idSpec, albumId, opt_params) {};
+
+/**
+ * Updates the fields for a media item specified in the params.
+ * The following fields cannot be set: ID, CREATED, ALBUM_ID, FILE_SIZE, NUM_COMMENTS.
+ *
+ * @param {opensocial.IdSpec} idSpec An IdSpec used to specify which people/groups
+ *    own the album/media item.
+ * @param {string} albumId The ID of the album containing the media item to update.
+ * @param {string} mediaItemId ID of media item to update.
+ * @param {Object.<opensocial.MediaItem.Field, Object>=} opt_params The media item fields to update.
+ * @return {Object} A request object
+ */
+opensocial.Container.prototype.newUpdateMediaItemRequest = function(idSpec, albumId,
+    mediaItemId, opt_params) {};
 
 /**
  * Used to request an activity stream from the server.

Modified: shindig/trunk/features/src/main/javascript/features/opensocial-reference/datarequest.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-reference/datarequest.js?rev=950417&r1=950416&r2=950417&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-reference/datarequest.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-reference/datarequest.js Wed Jun  2 08:28:11 2010
@@ -320,6 +320,44 @@ opensocial.DataRequest.prototype.asArray
 
 
 /**
+ * Creates a new album and returns the ID of the album created.
+ *
+ * @param {opensocial.IdSpec} idSpec The ID of the used to specify which people/groups
+ *   to create an album for.
+ * @param {opensocial.Album} album The album to create.
+ * @return {Object} A request object
+ */
+opensocial.DataRequest.prototype.newCreateAlbumRequest = function(idSpec, album) {
+  return opensocial.Container.get().newCreateAlbumRequest(idSpec, album);
+};
+
+/**
+ * Creates a new media item in the album and returns the ID of the album created.
+ *
+ * @param {opensocial.IdSpec} idSpec The ID of the used to specify which people/groups
+ *   to create an album for.
+ * @param {string} albumId The ID of album to add the media item to.
+ * @param {openSocial.MediaItem} mediaItem The MediaItem to add to the album.
+ * @return {Object} A request object
+ */
+opensocial.DataRequest.prototype.newCreateMediaItemRequest = function(idSpec, albumId,
+    mediaItem) {
+  return opensocial.Container.get().newCreateMediaItemRequest(idSpec, albumId, mediaItem)
+};
+
+/**
+ * Deletes the album specified.
+ *
+ * @param {opensocial.IdSpec} idSpec The ID of the used to specify which people/groups
+ *   to create an album for.
+ * @param {string} albumId The ID of the album to create.
+ * @return {Object} A request object
+ */
+opensocial.DataRequest.prototype.newDeleteAlbumRequest = function(idSpec, albumId) {
+  return opensocial.Container.get().newDeleteAlbumRequest(idSpec, albumId);
+};
+
+/**
  * Creates an item to request a profile for the specified person ID.
  * When processed, returns a
  * <a href="opensocial.Person.html"><code>Person</code></a> object.
@@ -379,6 +417,30 @@ opensocial.DataRequest.prototype.newFetc
 /**
  * @static
  * @class
+ * @name opensocial.DataRequest.AlbumRequestFields
+ * @enum {string}
+ */
+opensocial.DataRequest.AlbumRequestFields = {
+  /**
+   * When paginating, the index of the first item to fetch.
+   * Specified as a <code>Number</code>.
+   *
+   * @member opensocial.DataRequest.AlbumRequestFields
+   */
+  FIRST : 'first',
+
+  /**
+   * The maximum number of items to fetch; defaults to 20.
+   * Specified as a <code>Number</code>.
+   *
+   * @member opensocial.DataRequest.AlbumRequestFields
+   */
+  MAX : 'max'
+};
+
+/**
+ * @static
+ * @class
  * @name opensocial.DataRequest.DataRequestFields
  * @enum {string}
  */
@@ -426,6 +488,37 @@ opensocial.DataRequest.prototype.newFetc
       this.asArray(keys), opt_params);
 };
 
+/**
+ * Updates the fields for an album specified in the params.
+ * The following fields cannot be set: MEDIA_ITEM_COUNT, OWNER_ID, ID.
+ *
+ * @param {opensocial.IdSpec} idSpec An IdSpec used to specify which people/groups
+ *    to own the album.
+ * @param {string} albumId The ID of album to update.
+ * @param {Object.<opensocial.Album.Field, Object>=} opt_params The Album Fields to update.
+ * @return {Object} A request object
+ */
+opensocial.DataRequest.prototype.newUpdateAlbumRequest = function(idSpec, albumId,
+    opt_params) {
+  return opensocial.Container.get().newUpdateAlbumRequest(idSpec, albumId, opt_params);
+};
+
+/**
+ * Updates the fields for a media item specified in the params.
+ * The following fields cannot be set: ID, CREATED, ALBUM_ID, FILE_SIZE, NUM_COMMENTS.
+ *
+ * @param {opensocial.IdSpec} idSpec An IdSpec used to specify which people/groups
+ *    own the album/media item.
+ * @param {string} albumId The ID of the album containing the media item to update.
+ * @param {string} mediaItemId ID of media item to update.
+ * @param {Object.<opensocial.MediaItem.Field, Object>=} opt_params The Album Fields to update.
+ * @return {Object} A request object
+ */
+opensocial.DataRequest.prototype.newUpdateMediaItemRequest = function(idSpec, albumId,
+    mediaItemId, opt_params) {
+  return opensocial.Container.get().newUpdateMediaItemRequest(idSpec, albumId,
+      mediaItemId, opt_params);
+};
 
 /**
  * Creates an item to request an update of an app field for the current VIEWER

Modified: shindig/trunk/features/src/main/javascript/features/opensocial-reference/taming.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/opensocial-reference/taming.js?rev=950417&r1=950416&r2=950417&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/opensocial-reference/taming.js (original)
+++ shindig/trunk/features/src/main/javascript/features/opensocial-reference/taming.js Wed Jun  2 08:28:11 2010
@@ -104,11 +104,16 @@ tamings___.push(function(imports) {
     [opensocial.Container, 'hasPermission'],
     [opensocial.Container, 'requestPermission'],
     [opensocial.Container, 'requestData'],
+    [opensocial.Container, 'newCreateAlbumRequest'],
+    [opensocial.Container, 'newCreateMediaItemRequest'],
+    [opensocial.Container, 'newDeleteAlbumRequest'],
     [opensocial.Container, 'newFetchPersonRequest'],
     [opensocial.Container, 'newFetchPeopleRequest'],
     [opensocial.Container, 'newFetchPersonAppDataRequest'],
     [opensocial.Container, 'newUpdatePersonAppDataRequest'],
     [opensocial.Container, 'newRemovePersonAppDataRequest'],
+    [opensocial.Container, 'newUpdateAlbumRequest'],
+    [opensocial.Container, 'newUpdateMediaItemRequest'],
     [opensocial.Container, 'newFetchActivitiesRequest'],
     [opensocial.Container, 'newFetchAlbumsRequest'],
     [opensocial.Container, 'newFetchMessageCollectionsRequest'],
@@ -132,10 +137,15 @@ tamings___.push(function(imports) {
     [opensocial.Collection, 'getTotalSize'],
     [opensocial.Collection, 'size'],
     [opensocial.DataRequest, 'add'],
+    [opensocial.DataRequest, 'newCreateAlbumRequest'],
+    [opensocial.DataRequest, 'newCreateMediaItemRequest'],
+    [opensocial.DataRequest, 'newDeleteAlbumRequest'],
     [opensocial.DataRequest, 'newFetchActivitiesRequest'],
     [opensocial.DataRequest, 'newFetchAlbumsRequest'],
     [opensocial.DataRequest, 'newFetchPeopleRequest'],
     [opensocial.DataRequest, 'newFetchPersonAppDataRequest'],
+    [opensocial.DataRequest, 'newUpdateAlbumRequest'],
+    [opensocial.DataRequest, 'newUpdateMediaItemRequest'],
     [opensocial.DataRequest, 'newFetchPersonRequest'],
     [opensocial.DataRequest, 'newRemovePersonAppDataRequest'],
     [opensocial.DataRequest, 'newUpdatePersonAppDataRequest'],