Developer / Documentation / Netlog Extensions to OpenSocial
Introduction
This is the API reference for Netlog's extensions to the OpenSocial API.
To use any of these extensions you need to add the following to the <ModulePrefs> section at the start of your
XML specification:
<Require feature="netlog" />
(you might also want to have a look at the documentation about the Credits extension, translating your app or the OpenSocial REST API)
API Reference
Static Class Netlog
Namespace for the Netlog extensions to OpenSocial
Static Class Netlog.Music
Namespace for the Netlog Music extension to OpenSocial
Method Summary
<static> requestSong(artist, title, opt_callback, opt_params)
Request Netlog for a certain song
Method Detail
requestSong
<static> requestSong(artist, title, opt_callback, opt_params)
Parameters:
String artist - Artist of the song
String title - Title of the song
Function opt_callback - The function to call once the request has been processed; This function will be passed one parameter, an opensocial.ResponseItem. The error code will be set to reflect whether there were any problems with the request. If there was no error, a song has been found. The data on the response item will be set. It will be a Netlog.Music.Song object reflecting the song requested.
Map.<Netlog.Music.Player.Option, Object> opt_params - Optional parameters for the player. Defaults to: height (20), width (20), color (#FFFFFF)
Class Netlog.Music.Player
Used to represent the player related to a certain song
Method Summary
String getHTML()
Get the HTML that represents the player
object getOption(key, opt_params)
Get the option for this player that is associated with the specified key
Method Detail
getHTML
String getHTML()
Returns:
String HTML representing the player
getOption
String getOption(key, opt_params)
Parameters:
String key - The key to get data for; see the Netlog.Music.Player.Option class for possible values
Map.<opensocial.DataRequest.DataRequestFields, Object> opt_params - Additional params to pass to the request.
Returns:
object The option
Static Class Netlog.Music.Player.Option
All of the options a player can have
Field Summary
<static> object COLOR
A string representing the color of the player
<static> object HEIGHT
An integer representing the height of the player
<static> object WIDTH
An integer representing the width of the player
Field Detail
COLOR
<static> object COLOR
HEIGHT
<static> object HEIGHT
WIDTH
<static> object WIDTH
Class Netlog.Music.Song
Used to represent a certain song on Netlog
Method Summary
object getField(key, opt_params)
Get the data for this player that is associated with the specified key
Method Detail
getField
object getField(key, opt_params)
Parameters:
String key - The key to get data for; see the Netlog.Music.Song.Field class for possible values
Map.<opensocial.DataRequest.DataRequestFields, Object> opt_params - Additional params to pass to the request.
Returns:
object The data
Static Class Netlog.Music.Song.Field
All of the fields a song can have
Field Summary
<static> object ARTIST
A string defining the artist of the song
<static> object PLAYER
Player associated to the song, specified as a Netlog.Music.Player
<static> object TITLE
A string defining the title of the song
Field Detail
ARTIST
<static> object ARTIST
PLAYER
<static> object PLAYER
TITLE
<static> object TITLE
Class Netlog.Events
Namespace for the Netlog Events extension to OpenSocial
Method Summary
<static> newFetchFriendsEvents(idSpec, opt_params, callback)
Fetches Events from the idSpec's friends
<static> newFetchUserEvents(idSpec, opt_params, callback)
Fetches Events from the idSpec
<static> newFetchEventOwner(eventID, callback)
Fetches the owner of an event
<static> newFetchEvents(params, callback)
Fetches events according to the params
<static> newFetchCategories(callback)
Fetches all categories available to events
<static> newFetchEventDetails(eventID, callback)
Fetches details of an event
<static> newFetchEventAttendees(eventID, params, callback)
Fetches people attending an event
Method Detail
newFetchFriendsEvents
newFetchFriendsEvents(idSpec, opt_params, callback)
Parameters:
int idSpec - The numerical userID.
Array opt_params - Optional parameters: start and limit
function callback - A callback function to receive the data from the request.
Example:
<script type="text/javascript">
window.onload = function() {
Netlog.Events.newFetchFriendsEvents(222, { 'start' : 10 }, receiveResults);
};
function receiveResults(response) {
console.log(response);
}
</script>
newFetchUserEvents
newFetchUserEvents(idSpec, opt_params, callback)
Parameters:
int idSpec - The numerical userID.
Array opt_params - Optional parameters: start and limit
function callback - A callback function to receive the data from the request.
newFetchEventOwner
newFetchEventOwner(eventID, callback)
Parameters:
int eventID - The numerical eventID specifying the event.
function callback - A callback function to receive the data from the request.
newFetchEvents
newFetchEvents(params, callback)
Parameters:
Array params - The params to filter between the events: date, country, region, category, start, limit.
function callback - A callback function to receive the data from the request.
newFetchCategories
newFetchCategories(callback)
Parameters:
function callback - A callback function to receive the data from the request.
newFetchEventDetails
newFetchEventDetails(eventID, callback)
Parameters:
int eventID - The numerical eventID specifying the event.
function callback - A callback function to receive the data from the request.
newFetchEventAttendees
newFetchEventAttendees(eventID, params, callback)
Parameters:
int eventID - The numerical eventID specifying the event.
Array params - The params to filter between the attendees: start and limit.
function callback - A callback function to receive the data from the request.
Class Netlog.Popup
Namespace for the Netlog Popup extension to OpenSocial
Method Summary
object open(url, opt_options, opt_callback)
Netlog Popup component
Method Detail
constructor
open(url, op_options, opt_callback)
Parameters:
String urlA valid URL
object opt_optionsOptional parameters defined in Netlog.Popup.Option
function opt_callbackAn optional callback which will be called after the user closes the popup. The function will be passed one argument: an opensocial.ResponseItem containing a Netlog.Popup.Response object.
Static Class Payment.Popup.Option
All of the options that can be passed on to the Netlog Popup
Field Summary
<static> object HEIGHT
An integer representing the height of the popup window
<static> object SCROLLING
A boolean indicating whether the popup should have scrollbars or not)
<static> object WIDTH
An integer representing the width of the popup window
<static> object URL
The URL of the popup window
Field Detail
HEIGHT
<static> object HEIGHT
SCROLLING
<static> object SCROLLING
WIDTH
<static> object WIDTH
URL
<static> object URL
Class Netlog.Popup.Response
Used to pass a close event on the popup to the optional callback function of the Netlog.Popup.open function.
Method Summary
object getField(key, opt_params)
Get the data for the response that is associated with the specified key
Method Detail
getField
object getField(key, opt_params)
Parameters:
String key - The key to get data for; see the Netlog.Popup.Response.Field class for possible values
Map.<opensocial.DataRequest.DataRequestFields, Object> opt_params - Additional params to pass to the request.
Returns:
object The data
Static Class Netlog.Popup.Response.Field
All of the fields the response can have
Field Summary
<static> object STATE
The state (normaly 'closed')
Field Detail
STATE
<static> object STATE
Class Netlog.Autocomplete
Namespace for the Netlog Autocomplete extension to OpenSocial
Method Summary
object constructor(HTMLElement, options)
Netlog Autocomplete component
object getOption(key, opt_params)
Get the option for this component that is associated with the specified key
Method Detail
constructor
constructor(HTMLElement, options)
Parameters:
HTMLElement element - A HTML input field
Object options - A list of options to customize the autocomplete
getOption
String getOption(key, opt_params)
Parameters:
String key - The key to get data for; see the Netlog.Autocomplete.Option class for possible values
Map.<opensocial.DataRequest.DataRequestFields, Object> opt_params - Additional params to pass to the request.
Returns:
object The option
Static Class Netlog.Autocomplete.Option
All of the options the autocomplete component can have
Field Summary
<static> function CALLBACK
A function which will be called with raw results (objects)
<static> HTMLElement RESULTS
An HTMLElement which will be used to store/display the results
<static> function SELECT
A callback function which will be called onclick, when an item is selected
<static> boolean CSS
A boolean used to indicate if you want to use our CSS style for the autocomplete
<static> string URL
URL to fetch the results from
<static> object FIELDS
Mapping for results
<static> string SUBFIELD
An object key specified as string, the key will display the associated value in the results object
<static> HTMLElement DIV
A container div, which will be filled up with the results formed as HTMLElements
<static> string DEFAULTVALUE
A default value to fill up the input field
<static> function CLOSECALL
A callback function, called when the autocomplete is closed
<static> boolean HIDE
When set to true, the results will not be displayed to the user
<static> boolean MULTIFETCH
When true, every keypress will result in a HttpRequest
<static> boolean HIGHLIGHT
Whether or not to highlight parts of the search results
Field Detail
CALLBACK
<static> function CALLBACK
RESULTS
<static> HTMLElement RESULTS
SELECT
<static> function SELECT
CSS
<static> boolean CSS
URL
<static> string URL
FIELDS
<static> object FIELDS
to our default field image { 'thumbnailUrl' : 'image' }
fields available: image, category and name
SUBFIELD
<static> string SUBFIELD
When specified, the optional field in the result display will be filled with the found value.
DIV
<static> HTMLElement DIV
Only used when using css = true.
DEFAULTVALUE
<static> string DEFAULTVALUE
CLOSECALL
<static> function CLOSECALL
Called when the user clicks the close button in the input field.
Only available when using css=true.
HIDE
<static> boolean HIDE
The component will only send the results to the "callback" function.
Defaults to false
MULTIFETCH
<static> boolean MULTIFETCH
HIGHLIGHT
<static> boolean HIGHLIGHT
Class Netlog.Autocomplete.Friends
Namespace for the Netlog Autocomplete Friends extension to OpenSocial
Method Summary
object constructor(HTMLElement, options)
Netlog Autocomplete Friends component
Method Detail
constructor
object constructor(HTMLElement, options)
The URL is predefined by Netlog to fetch friend results from our server.
! Used when building an autocomplete feature which searches for the friends of a user.
Parameters:
HTMLElement element - A HTML input field
Object options - Accepts the same options as the Netlog.Autocomplete class
Class Netlog.Album
Namespace for the Netlog Album extension to OpenSocial
Method Summary
<static> newFetchAlbumsRequest(idSpec, opt_params, callback)
Fetch albums belonging to a user (idSpec)
<static> newFetchMediaItemsRequest(idSpec, albumId, opt_params, callback)
Fetch media items belonging to an album
Method Detail
newFetchAlbumsRequest
newFetchAlbumsRequest(idSpec, opt_params, callback)
The albums belonging to the specified user will be returned, providing you have access to the information.
The optional parameters allow you to filter the results.
The optional callback will be triggered when a valid request is returned.
Parameters:
string idSpec - A numeric userID or a string (VIEWER or OWNER)
Object opt_params - Accepts following options
function callback - Will be called when a request succeeds
Example:
<script type="text/javascript">
window.onload = function() {
Netlog.Album.newFetchAlbumsRequest(userId, {}, receiveResults);
};
function receiveResults(response) {
console.log(response);
}
</script>
Returns:
object An OpenSocial ResponseItem containing an array of albums
Options
ID
array ID
FIRST
integer FIRST
MAX
integer MAX
newFetchMediaItemsRequest
newFetchMediaItemsRequest(idSpec, albumId, opt_params, callback)
The second parameter is mandatory, specifying the specific id of the album you want to retrieve content from.
The optional parameters allow you to filter the results.
The optional callback will be triggered when a valid request is returned.
Parameters:
string idSpec - A numeric userID or a string (VIEWER or OWNER)
integer albumId - A numeric albumId specifying an existing album.
If a wildcard (*) is provided instead of a numeric value, all media items of all albums will be fetched, respecting pagination if any.
Object opt_params - Accepts following options
function callback - Will be called when a request succeeds
Example:
<script type="text/javascript">
window.onload = function() {
Netlog.Album.newFetchMediaItemsRequest(userId, albumId, {}, receiveResults);
};
function receiveResults(response) {
console.log(response);
}
</script>
Returns:
object An OpenSocial ResponseItem containing an array of Media Items belonging to an album.
Options
ID
array ID
FIRST
integer first
MAX
integer MAX
Class Payment
Namespace for the Netlog Payment extensions to OpenSocial
Method Summary
object constructor(amount, opt_message)
create an instance of a payment
object getField(key, opt_params)
Get the data for the payment that is associated with the specified key
<static> requestPayment(payment, opt_callback, opt_params)
Request the container (Netlog) for a payment
constructor
object constructor(amount, opt_message)
Parameters:
integer amount - The number of credits you want to get from the user
string op_message - Optional message for this payment. The message will be shown to the user when requesting the payment
getField
object getField(key, opt_params)
Parameters:
String key - The key to get data for; see the Payment.Field class for possible values
Map.<opensocial.DataRequest.DataRequestFields, Object> opt_params - Additional params to pass to the request.
Returns:
object The data
requestPayment
<static> object requestPayment(payment, opt_callback, opt_params)
Parameters:
object payment - an instance of a payment
Function opt_callback - The function to call once the request has been processed; This function will be passed one parameter, an opensocial.ResponseItem
object opt_params - Optional parameters that will be send to your payment confirmation page (see the credtis tutorial)
Static Class Payment.Field
All of the fields a payment can have
Field Summary
<static> object AMOUNT
An integer representing the amount of credits associated to the payment
<static> object MESSAGE
A string representing the message associated to the payment
<static> object STATE
State of the payment, specified as a Payment.State
<static> object TOKEN
A string representing a unique token associated to the payment
Field Detail
AMOUNT
<static> object AMOUNT
MESSAGE
<static> object MESSAGE
STATE
<static> object STATE
TOKEN
<static> object TOKEN
Static Class Payment.State
All of the states a payment can have
Field Summary
<static> object ACCEPTED
The payment has been accepted by the user
<static> object CANCELLED
The payment has been cancelled by the user
<static> object DENIED
The payment has been denied by the user
Field Detail
ACCEPTED
<static> object ACCEPTED
CANCELLED
<static> object CANCELLED
DENIED
<static> object DENIED
Articles
- Introduction
- Application Guidelines
- OpenSocial
- Netlog REST API (depricated)
- Flash Applications (depricated)
- PHP Applications (depricated)
- Syndication (feeds)
- Widgets: Link, blog or shout
- Bookmarklets: link, blog or shout
- Terms & Conditions