Working through some sample code for 0.8, I realized that it was going to be difficult to reconcile the new IdSpec construct with the current capabilities of the RESTful API. One such area is the concept of groups.
The RESTful spec defines the following:
selector : One of
* A user-defined local group name to select a group of contacts (a collection)
* @self to select the person record for guid
* @all to select all the universal set of contacts (a collection)
* @friends to select the subset of contacts which are friends (a collection)
The IdSpec JS file states that IdSpec supports the following field:
<static> object GROUP_ID
A string representing the group id.
My proposal is to add an opensocial.IdSpec.GroupId enum with values corresponding to the RESTful group selectors, and to modify the description of GROUP_ID to specify that it can accept either a string representing the group or one of the opensocial.IdSpec.GroupId values.
Index: idspec.js
===================================================================
--- idspec.js (revision 745)
+++ idspec.js (working copy)
@@ -66,7 +66,8 @@
USER_ID : 'userId',
/**
- * A string representing the group id.
+ * A string representing the group id or one of the
+ * opensocial.IdSpec.GroupId values.
* @member opensocial.IdSpec.Field
*/
GROUP_ID : 'groupId',
@@ -108,6 +109,28 @@
};
/**
+ * @static
+ * @class
+ * Constant group IDs available when fetching collections of people.
+ *
+ * @name opensocial.IdSpec.GroupId
+ */
+opensocial.IdSpec.GroupId = {
+ /**
+ * @member opensocial.IdSpec.GroupId
+ */
+ SELF : 'SELF',
+ /**
+ * @member opensocial.IdSpec.GroupId
+ */
+ FRIENDS : 'FRIENDS'
+ /**
+ * @member opensocial.IdSpec.GroupId
+ */
+ ALL : 'ALL'
+};
+
+/**
* Gets the id spec's data that's associated with the specified key.
*
* @param {String} key The key to get data for;