OpenSocial Aptana Jaxer Client Library
opensocial-jaxer-client is OS API based OpenSocial Client Library for Server Side JavaScript on Aptana Jaxer.
Examples
The current release supports only fcauth of Google FrinedConnet.
<script type="text/javascript" src="opensocial-jaxer-client.js" runat="server"></script>
<script type="text/javascript" runat="server">
osapi.init({
rpcUrl: 'http://friendconnect.gmodules.com/ps/api',
fcauth: Jaxer.Util.Cookie.get('fcauth03382920006806842951')
});
/*
* osapi.people
*/
var viewer = osapi.people.getViewer().execute();
Jaxer.Log.info('Your name is ' + viewer.displayName);
var viewer = osapi.people.getViewer({
fields: ['profileUrl', 'thumbnailUrl']
}).execute();
Jaxer.Log.info('Your profile URL is ' + viewer.profileUrl);
Jaxer.Log.info('Your thumbnail URL is ' + viewer.thumbnailUrl);
/*
* osapi.appdata
*/
var r = osapi.appdata.update({
userId: '@viewer', data: { gifts: 'a crazed monkey' }
}).execute();
var data = osapi.appdata.get({
userId: '@viewer', keys: ['gifts']
}).execute();
Jaxer.Log.info('AppData gifts is ' + data[viewer.id].gifts);
var r = osapi.appdata.deleteData({
userId: '@viewer', keys: ['gifts']
}).execute();
/*
* osapi.activities
*/
var r = osapi.activities.create({
userId: '@viewer', activity: {
title: 'Hello!', url: 'http://example.com/'
}
}).execute();
var list = osapi.activities.get({
userId: '@viewer'
}).execute();
list.forEach(function(data) {
Jaxer.Log.info('Activity title is ' + data.title);
Jaxer.Log.info('Activity URL is ' + data.url);
});
/*
* osapi.batch
*/
var batch = osapi.newBatch()
.add('viewer', osapi.people.getViewer())
.add('data', osapi.appdata.get({ userId: '@viewer' }))
.execute();
Jaxer.Log.info('Viewer id is ' + batch.viewer.id);
Jaxer.Log.info('Viewer name is ' + batch.viewer.displayName);
Jaxer.Log.info('Viewer thumbnail URL is ' + batch.viewer.thumbnailUrl);
Jaxer.Log.info('AppData gifts is ' + batch.data[batch.viewer.id].gifts);
</script>Changelog
0.1.0
This release supports osapi.appdata and osapi.activities.
- osapi.appdata
- osapi.activities
0.0.1
This release supports osapi.batch.
- osapi.batch
0.0.0
Startup of opensocial-jaxer-client project. This release supports only fcauth and osapi.people of Google FriendConnect.
- fcauth of Google FriendConnect
- osapi
- osapi.base
- osapi.util
- osapi.people
Downloads
The last version is opensocial-jaxer-client-0.1.0. You can download it from the featured downloads box right on this page.
Also, you could use the SVN version to get the most actual code:
$ svn checkout http://opensocial-jaxer-client.googlecode.com/svn/trunk/ opensocial-jaxer-client-read-only