Please see http://www.opensocial.org/specs for the latest version of the OpenSocial specification.

OpenSocial API Reference (0.8.1)

The OpenSocial JavaScript API includes two namespaces: opensocial.* and gadgets.*. This page covers the opensocial.* namespace. The gadgets.* namespace is covered in the Gadgets API Reference.

Contents

Back to top

Type Conventions

This document uses the following conventions for types:

Array<T> or Array.<T>
An Array filled with only objects of type T. This convention is similar to Java generics.
Map<K, V> or Map.<K, V>
A JavaScript object with keys of type K that map to values of type V. Again, this convention is similar to Java generics. It's often used for opt_params variables.
static
A type marked with static class has no public or private constructor. In other words, the type is a namespace, not a class that can be instantiated to create objects. The fields and functions in such a type are also marked as static.
Boolean
A boolean value (not a Boolean object).
String
A string value (not a String object).

Back to top

Static Class opensocial

 SUMMARY     DETAIL

Namespace for top-level people functions.

Method Summary

<static>  opensocial.Environment getEnvironment()
Gets the current environment for this gadget.
<static>  Boolean hasPermission(permission)
Returns true if the current gadget has access to the specified permission.
<static>  opensocial.Activity newActivity(params)
Creates an activity object, which represents an activity on the server.
<static>  opensocial.DataRequest newDataRequest()
Creates a data request object to use for sending and fetching data from the server.
<static>  opensocial.IdSpec newIdSpec(parameters)
Creates an IdSpec object.
<static>  opensocial.MediaItem newMediaItem(mimeType, url, opt_params)
Creates a media item.
<static>  opensocial.Message newMessage(body, opt_params)
Creates a media item associated with an activity.
<static>  opensocial.NavigationParameters newNavigationParameters(parameters)
Creates a NavigationParameters object.
<static> requestCreateActivity(activity, priority, opt_callback)
Takes an activity and tries to create it, without waiting for the operation to complete.
<static> requestPermission(permissions, reason, opt_callback)
Requests the user to grant access to the specified permissions.
<static> requestSendMessage(recipients, message, opt_callback, opt_params)
Requests the container to send a specific message to the specified users.
<static> requestShareApp(recipients, reason, opt_callback, opt_params)
Requests the container to share this gadget with the specified users.
 

Method Detail

getEnvironment

<static> opensocial.Environment getEnvironment()

hasPermission

<static> Boolean hasPermission(permission)

newActivity

<static> opensocial.Activity newActivity(params)

newDataRequest

<static> opensocial.DataRequest newDataRequest()

newIdSpec

<static> opensocial.IdSpec newIdSpec(parameters)

newMediaItem

<static> opensocial.MediaItem newMediaItem(mimeType, url, opt_params)

newMessage

<static> opensocial.Message newMessage(body, opt_params)

newNavigationParameters

<static> opensocial.NavigationParameters newNavigationParameters(parameters)

requestCreateActivity

<static> requestCreateActivity(activity, priority, opt_callback)

requestPermission

<static> requestPermission(permissions, reason, opt_callback)

requestSendMessage

<static> requestSendMessage(recipients, message, opt_callback, opt_params)

requestShareApp

<static> requestShareApp(recipients, reason, opt_callback, opt_params)

Back to top

Class opensocial.Activity

 SUMMARY     DETAIL

Representation of an activity.

Activities are rendered with a title and an optional activity body.

You may set the title and body directly as strings when calling opensocial.newActivity. However, it is usually beneficial to create activities using Message Templates for the title and body.

Users will have many activities in their activity streams, and containers will not show every activity that is visible to a user. To help display large numbers of activities, containers will summarize a list of activities from a given source to a single entry.

You can provide Activity Summaries to customize the text shown when multiple activities are summarized. If no customization is provided, a container may ignore your activities altogether or provide default text such as "Bob changed his status message + 20 other events like this."

Example summaries:

<messagebundle>
<msg name="LISTEN_TO_THIS_SONG:Artist">
${Subject.Count} of your friends have suggested listening to songs
by ${Artist}!
</msg>
<msg name="LISTEN_TO_THIS_SONG:Song">
${Subject.Count} of your friends have suggested listening to ${Song}
!</msg>
<msg name="LISTEN_TO_THIS_SONG:Subject">
${Subject.DisplayName} has recommended ${Song.Count} songs to you.
</msg>
</messagebundle>

See also: opensocial.Message, opensocial.newActivity(), opensocial.requestCreateActivity()

Method Summary

 String getField(key, opt_params)
Gets the activity data that's associated with the specified key.
 String getId()
Gets an ID that can be permanently associated with this activity.
setField(key, data)
Sets data for this activity associated with the given key.
 

Method Detail

getField

String getField(key, opt_params)

getId

String getId()

setField

setField(key, data)

Back to top

Static Class opensocial.Activity.Field

 SUMMARY     DETAIL

All of the fields that activities can have.

It is only required to set one of TITLE_ID or TITLE. In addition, if you are using any variables in your title or title template, you must set TEMPLATE_PARAMS.

Other possible fields to set are: URL, MEDIA_ITEMS, BODY_ID, BODY, EXTERNAL_ID, PRIORITY, STREAM_TITLE, STREAM_URL, STREAM_SOURCE_URL, and STREAM_FAVICON_URL.

Containers are only required to use TITLE_ID or TITLE, they may ignore additional parameters.

See also: opensocial.Activity.getField()

Field Summary

<static> object APP_ID

A string specifying the application that this activity is associated with.

<static> object BODY

A string specifying an optional expanded version of an activity.

<static> object BODY_ID

A string specifying the body template message ID in the gadget spec.

<static> object EXTERNAL_ID

An optional string ID generated by the posting application.

<static> object ID

A string ID that is permanently associated with this activity.

<static> object MEDIA_ITEMS

Any photos, videos, or images that should be associated with the activity.

<static> object POSTED_TIME

A string specifying the time at which this activity took place in milliseconds since the epoch.

<static> object PRIORITY

A number between 0 and 1 representing the relative priority of this activity in relation to other activities from the same source

This field may be used interchangeably with the string 'priority'.

<static> object STREAM_FAVICON_URL

A string specifying the URL for the stream's favicon.

<static> object STREAM_SOURCE_URL

A string specifying the stream's source URL.

<static> object STREAM_TITLE

A string specifing the title of the stream.

<static> object STREAM_URL

A string specifying the stream's URL.

<static> object TEMPLATE_PARAMS

A map of custom key/value pairs associated with this activity.

<static> object TITLE

A string specifying the primary text of an activity.

<static> object TITLE_ID

A string specifying the title template message ID in the gadget spec.

<static> object URL

A string specifying the URL that represents this activity.

<static> object USER_ID

The string ID of the user who this activity is for.

 

Field Detail

APP_ID

<static> object APP_ID

BODY

<static> object BODY

BODY_ID

<static> object BODY_ID

EXTERNAL_ID

<static> object EXTERNAL_ID

ID

<static> object ID

MEDIA_ITEMS

<static> object MEDIA_ITEMS

POSTED_TIME

<static> object POSTED_TIME

PRIORITY

<static> object PRIORITY

STREAM_FAVICON_URL

<static> object STREAM_FAVICON_URL

STREAM_SOURCE_URL

<static> object STREAM_SOURCE_URL

STREAM_TITLE

<static> object STREAM_TITLE

STREAM_URL

<static> object STREAM_URL

TEMPLATE_PARAMS

<static> object TEMPLATE_PARAMS

TITLE

<static> object TITLE

TITLE_ID

<static> object TITLE_ID

URL

<static> object URL

USER_ID

<static> object USER_ID

Back to top

Class opensocial.Address

 SUMMARY     DETAIL

Base interface for all address objects.

Method Summary

 String getField(key, opt_params)
Gets data for this body type that is associated with the specified key.
 

Method Detail

getField

String getField(key, opt_params)

Back to top

Static Class opensocial.Address.Field

 SUMMARY     DETAIL

All of the fields that an address has. These are the supported keys for the Address.getField() method.

Field Summary

<static> object COUNTRY
The country, specified as a string.
<static> object EXTENDED_ADDRESS
The extended street address, specified as a string.
<static> object LATITUDE
The latitude, specified as a number.
<static> object LOCALITY
The locality, specified as a string. This field is usually used to specify a small geographical concept, such as a city (for example, Mountain View or Chicago).
<static> object LONGITUDE
The longitude, specified as a number.
<static> object PO_BOX
The P.O.
<static> object POSTAL_CODE
The postal code, specified as a string.
<static> object REGION
The region, specified as a string. This field is usually used to specify a large geographical concept, such as a state (for example, California or Florida).
<static> object STREET_ADDRESS
The street address, specified as a string.
<static> object TYPE
The address type or label, specified as a string.
<static> object UNSTRUCTURED_ADDRESS
If the container does not have structured addresses in its data store, this field contains the unstructured address that the user entered, specified as a string.
 

Field Detail

COUNTRY

<static> object COUNTRY

EXTENDED_ADDRESS

<static> object EXTENDED_ADDRESS

LATITUDE

<static> object LATITUDE

LOCALITY

<static> object LOCALITY

LONGITUDE

<static> object LONGITUDE

PO_BOX

<static> object PO_BOX

POSTAL_CODE

<static> object POSTAL_CODE

REGION

<static> object REGION

STREET_ADDRESS

<static> object STREET_ADDRESS

TYPE

<static> object TYPE

UNSTRUCTURED_ADDRESS

<static> object UNSTRUCTURED_ADDRESS

Back to top

Class opensocial.BodyType

 SUMMARY     DETAIL

Base interface for all body type objects.

Method Summary

 String getField(key, opt_params)
Gets data for this body type that is associated with the specified key.
 

Method Detail

getField

String getField(key, opt_params)

Back to top

Static Class opensocial.BodyType.Field

 SUMMARY     DETAIL

All of the fields that a body type has. These are the supported keys for the BodyType.getField() method.

Field Summary

<static> object BUILD
The build of the person's body, specified as a string.
<static> object EYE_COLOR
The eye color of the person, specified as a string.
<static> object HAIR_COLOR
The hair color of the person, specified as a string.
<static> object HEIGHT
The height of the person in meters, specified as a number.
<static> object WEIGHT
The weight of the person in kilograms, specified as a number.
 

Field Detail

BUILD

<static> object BUILD

EYE_COLOR

<static> object EYE_COLOR

HAIR_COLOR

<static> object HAIR_COLOR

HEIGHT

<static> object HEIGHT

WEIGHT

<static> object WEIGHT

Back to top

Class opensocial.Collection

 SUMMARY     DETAIL

Collection of multiple objects with useful accessors. May also represent subset of a larger collection (for example, page 1 of 10) and contain information about the larger collection.

Method Summary

 Array.<Object> asArray()
Returns an array of all the objects in this collection.
each(fn)
Executes the provided function once per member of the collection, with each member in turn as the parameter to the function.
 Object? getById(id)
Finds the entry with the given ID value, or returns null if none is found.
 Number getOffset()
Gets the offset of this collection within a larger result set.
 Number getTotalSize()
Gets the total size of the larger result set that this collection belongs to.
 Number size()
Gets the size of this collection, which is equal to or less than the total size of the result.
 

Method Detail

asArray

Array.<Object> asArray()

each

each(fn)

getById

Object? getById(id)

getOffset

Number getOffset()

getTotalSize

Number getTotalSize()

size

Number size()

Back to top

Static Class opensocial.CreateActivityPriority

 SUMMARY     DETAIL

The priorities a create activity request can have.

See also: opensocial.requestCreateActivity()

Field Summary

<static> object HIGH
If the activity is of high importance, it will be created even if this requires asking the user for permission.
<static> object LOW
If the activity is of low importance, it will not be created if the user has not given permission for the current app to create activities.
 

Field Detail

HIGH

<static> object HIGH

LOW

<static> object LOW

Back to top

Class opensocial.DataRequest

 SUMMARY     DETAIL

Used to request social information from the container. This includes data for friends, profiles, app data, and activities. All apps that require access to people information should send a DataRequest.

Here's an example of creating, initializing, sending, and handling the results of a data request:

function requestMe() {
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(
opensocial.IdSpec.PersonId.VIEWER),
"viewer");
req.send(handleRequestMe);
};

function handleRequestMe(data) {
var viewer = data.get("viewer");
if (viewer.hadError()) {
//Handle error using viewer.getError()...
return;
}

//No error. Do something with viewer.getData()...
}

See also: opensocial.newDataRequest()

Method Summary

add(request, opt_key)
Adds an item to fetch (get) or update (set) data from the server.
 Object newFetchActivitiesRequest(idSpec, opt_params)
Creates an item to request an activity stream from the server.
 Object newFetchPeopleRequest(idSpec, opt_params)
Creates an item to request friends from the server.
 Object newFetchPersonAppDataRequest(idSpec, keys, opt_params)
Creates an item to request app data for the given people.
 Object newFetchPersonRequest(id, opt_params)
Creates an item to request a profile for the specified person ID.
 Object newRemovePersonAppDataRequest(id, keys)
Deletes the given keys from the datastore for the given person.
 Object newUpdatePersonAppDataRequest(id, key, value)
Creates an item to request an update of an app field for the given person.
send(opt_callback)
Sends a data request to the server in order to get a data response.
 

Method Detail

add

add(request, opt_key)

newFetchActivitiesRequest

Object newFetchActivitiesRequest(idSpec, opt_params)

newFetchPeopleRequest

Object newFetchPeopleRequest(idSpec, opt_params)

newFetchPersonAppDataRequest

Object newFetchPersonAppDataRequest(idSpec, keys, opt_params)

newFetchPersonRequest

Object newFetchPersonRequest(id, opt_params)

newRemovePersonAppDataRequest

Object newRemovePersonAppDataRequest(id, keys)

newUpdatePersonAppDataRequest

Object newUpdatePersonAppDataRequest(id, key, value)

send

send(opt_callback)

Back to top

Static Class opensocial.DataRequest.DataRequestFields

 SUMMARY     DETAIL

Field Summary

<static> object ESCAPE_TYPE
How to escape person data returned from the server; defaults to HTML_ESCAPE.
 

Field Detail

ESCAPE_TYPE

<static> object ESCAPE_TYPE

Back to top

Static Class opensocial.DataRequest.FilterType

 SUMMARY     DETAIL

The filters available for limiting person requests.

Field Summary

<static> object ALL
Retrieves all friends.
<static> object HAS_APP
Retrieves all friends that use this application.
<static> object IS_FRIENDS_WITH
Will filter the people requested by checking if they are friends with the given idSpec.
<static> object TOP_FRIENDS
Retrieves only the user's top friends as defined by the container.
 

Field Detail

ALL

<static> object ALL

HAS_APP

<static> object HAS_APP

IS_FRIENDS_WITH

<static> object IS_FRIENDS_WITH
Will filter the people requested by checking if they are friends with the given idSpec. Expects a filterOptions parameter to be passed with the following fields defined: - idSpec The idSpec that each person must be friends with. This field may be used interchangeably with the string 'isFriendsWith'.

TOP_FRIENDS

<static> object TOP_FRIENDS

Back to top

Static Class opensocial.DataRequest.PeopleRequestFields

 SUMMARY     DETAIL

Field Summary

<static> object FILTER
How to filter the people objects; defaults to ALL.
<static> object FILTER_OPTIONS
Additional options to be passed into the filter, specified as a Map<String, Object>.
<static> object FIRST
When paginating, the index of the first item to fetch; specified as a number.
<static> object MAX
The maximum number of items to fetch, specified as a number; defaults to 20.
<static> object PROFILE_DETAILS
An array of opensocial.Person.Field specifying what profile data to fetch for each of the person objects.
<static> object SORT_ORDER
A sort order for the people objects; defaults to TOP_FRIENDS.
 

Field Detail

FILTER

<static> object FILTER

FILTER_OPTIONS

<static> object FILTER_OPTIONS

FIRST

<static> object FIRST

MAX

<static> object MAX

PROFILE_DETAILS

<static> object PROFILE_DETAILS

SORT_ORDER

<static> object SORT_ORDER

Back to top

Static Class opensocial.DataRequest.SortOrder

 SUMMARY     DETAIL

The sort orders available for ordering person objects.

Field Summary

<static> object NAME
When used will sort people alphabetically by the name field.
<static> object TOP_FRIENDS
When used will sort people by the container's definition of top friends.
 

Field Detail

NAME

<static> object NAME

TOP_FRIENDS

<static> object TOP_FRIENDS

Back to top

Class opensocial.DataResponse

 SUMMARY     DETAIL

This object contains the requested server data mapped to the requested keys.

See also: DataRequest

Method Summary

 opensocial.ResponseItem get(key)
Gets the ResponseItem for the requested field.
 String getErrorMessage()
If the entire request had a batch level error, returns the error message.
 Boolean hadError()
Returns true if there was an error in fetching this data from the server.
 

Method Detail

get

opensocial.ResponseItem get(key)

getErrorMessage

String getErrorMessage()

hadError

Boolean hadError()

Back to top

Class opensocial.Email

 SUMMARY     DETAIL

Base interface for all email objects.

Method Summary

 String getField(key, opt_params)
Gets data for this body type that is associated with the specified key.
 

Method Detail

getField

String getField(key, opt_params)

Back to top

Static Class opensocial.Email.Field

 SUMMARY     DETAIL

All of the fields that an email has. These are the supported keys for the Email.getField() method.

Field Summary

<static> object ADDRESS
The email address, specified as a string.
<static> object TYPE
The email type or label, specified as a string.
 

Field Detail

ADDRESS

<static> object ADDRESS

TYPE

<static> object TYPE

Back to top

Class opensocial.Enum

 SUMMARY     DETAIL

Base interface for all enum objects. This class allows containers to use constants for fields that are usually have a common set of values. There are two main ways to use this class.

If your gadget just wants to display how much of a smoker someone is, it can simply use:

html = "This person smokes: " + person.getField('smoker').getValue();

This value field will be correctly set up by the container. This is a place where the container can even localize the value for the gadget so that it always shows the right thing.

If your gadget wants to have some logic around the smoker field it can use:

if (person.getField('smoker').getKey() != "NO") { //gadget logic here }

Note: The key may be null if the person's smoker field cannot be coerced into one of the standard enum types. The value, on the other hand, is never null.

Method Summary

 String getDisplayValue()
The value of this enum.
 String getKey()
Use this for logic within your gadget.
 

Method Detail

getDisplayValue

String getDisplayValue()

getKey

String getKey()

Back to top

Static Class opensocial.Enum.Drinker

 SUMMARY     DETAIL

The enum keys used by the drinker field.

See also: opensocial.Person.Field.Drinker

Field Summary

<static> object HEAVILY
This field may be used interchangeably with the string 'HEAVILY'.
<static> object NO
This field may be used interchangeably with the string 'NO'.
<static> object OCCASIONALLY
This field may be used interchangeably with the string 'OCCASIONALLY'.
<static> object QUIT
This field may be used interchangeably with the string 'QUIT'.
<static> object QUITTING
This field may be used interchangeably with the string 'QUITTING'.
<static> object REGULARLY
This field may be used interchangeably with the string 'REGULARLY'.
<static> object SOCIALLY
This field may be used interchangeably with the string 'SOCIALLY'.
<static> object YES
This field may be used interchangeably with the string 'YES'.
 

Field Detail

HEAVILY

<static> object HEAVILY

NO

<static> object NO

OCCASIONALLY

<static> object OCCASIONALLY

QUIT

<static> object QUIT

QUITTING

<static> object QUITTING

REGULARLY

<static> object REGULARLY

SOCIALLY

<static> object SOCIALLY

YES

<static> object YES

Back to top

Static Class opensocial.Enum.Gender

 SUMMARY     DETAIL

The enum keys used by the gender field.

See also: opensocial.Person.Field.Gender

Field Summary

<static> object FEMALE
This field may be used interchangeably with the string 'FEMALE'.
<static> object MALE
This field may be used interchangeably with the string 'MALE'.
 

Field Detail

FEMALE

<static> object FEMALE

MALE

<static> object MALE

Back to top

Static Class opensocial.Enum.LookingFor

 SUMMARY     DETAIL

The enum keys used by the lookingFor field.

See also: opensocial.Person.Field.LookingFor

Field Summary

<static> object ACTIVITY_PARTNERS
This field may be used interchangeably with the string 'ACTIVITY_PARTNERS'.
<static> object DATING
This field may be used interchangeably with the string 'DATING'.
<static> object FRIENDS
This field may be used interchangeably with the string 'FRIENDS'.
<static> object NETWORKING
This field may be used interchangeably with the string 'NETWORKING'.
<static> object RANDOM
This field may be used interchangeably with the string 'RANDOM'.
<static> object RELATIONSHIP
This field may be used interchangeably with the string 'RELATIONSHIP'.
 

Field Detail

ACTIVITY_PARTNERS

<static> object ACTIVITY_PARTNERS

DATING

<static> object DATING

FRIENDS

<static> object FRIENDS

NETWORKING

<static> object NETWORKING

RANDOM

<static> object RANDOM

RELATIONSHIP

<static> object RELATIONSHIP

Back to top

Static Class opensocial.Enum.Presence

 SUMMARY     DETAIL

The enum keys used by the networkPresence field.

See also: opensocial.Person.Field.NetworkPresence

Field Summary

<static> object AWAY
The entity or resource is temporarily away.
<static> object CHAT
The entity or resource is actively interested in chatting.
<static> object DND
The entity or resource is busy (dnd = "Do Not Disturb").
<static> object OFFLINE
The entity or resource is off line.
<static> object ONLINE
The entity or resource is on line.
<static> object XA
The entity or resource is away for an extended period (xa = "eXtended Away").
 

Field Detail

AWAY

<static> object AWAY

CHAT

<static> object CHAT

DND

<static> object DND

OFFLINE

<static> object OFFLINE

ONLINE

<static> object ONLINE

XA

<static> object XA

Back to top

Static Class opensocial.Enum.Smoker

 SUMMARY     DETAIL

The enum keys used by the smoker field.

See also: opensocial.Person.Field.Smoker

Field Summary

<static> object HEAVILY
This field may be used interchangeably with the string 'HEAVILY'.
<static> object NO
This field may be used interchangeably with the string 'NO'.
<static> object OCCASIONALLY
This field may be used interchangeably with the string 'OCCASIONALLY'.
<static> object QUIT
This field may be used interchangeably with the string 'QUIT'.
<static> object QUITTING
This field may be used interchangeably with the string 'QUITTING'.
<static> object REGULARLY
This field may be used interchangeably with the string 'REGULARLY'.
<static> object SOCIALLY
This field may be used interchangeably with the string 'SOCIALLY'.
<static> object YES
This field may be used interchangeably with the string 'YES'.
 

Field Detail

HEAVILY

<static> object HEAVILY

NO

<static> object NO

OCCASIONALLY

<static> object OCCASIONALLY

QUIT

<static> object QUIT

QUITTING

<static> object QUITTING

REGULARLY

<static> object REGULARLY

SOCIALLY

<static> object SOCIALLY

YES

<static> object YES

Back to top

Class opensocial.Environment

 SUMMARY     DETAIL

Represents the current environment for a gadget.

See also: opensocial.getEnvironment(),

Method Summary

 String getDomain()
Returns the current domain ? for example, "orkut.com" or "myspace.com".
 Boolean supportsField(objectType, fieldName)
Returns true if the specified field is supported in this container on the given object type, and returns false otherwise.
 

Method Detail

getDomain

String getDomain()

supportsField

Boolean supportsField(objectType, fieldName)

Back to top

Static Class opensocial.Environment.ObjectType

 SUMMARY     DETAIL

The types of objects in this container.

See also: Environment.supportsField()

Field Summary

<static> object ACTIVITY
This field may be used interchangeably with the string 'activity'.
<static> object ADDRESS
This field may be used interchangeably with the string 'address'.
<static> object BODY_TYPE
This field may be used interchangeably with the string 'bodyType'.
<static> object EMAIL
This field may be used interchangeably with the string 'email'.
<static> object FILTER_TYPE
This field may be used interchangeably with the string 'filterType'.
<static> object MEDIA_ITEM
This field may be used interchangeably with the string 'mediaItem'.
<static> object MESSAGE
This field may be used interchangeably with the string 'message'.
<static> object MESSAGE_TYPE
This field may be used interchangeably with the string 'messageType'.
<static> object NAME
This field may be used interchangeably with the string 'name'.
<static> object ORGANIZATION
This field may be used interchangeably with the string 'organization'.
<static> object PERSON
This field may be used interchangeably with the string 'person'.
<static> object PHONE
This field may be used interchangeably with the string 'phone'.
<static> object SORT_ORDER
This field may be used interchangeably with the string 'sortOrder'.
<static> object URL
This field may be used interchangeably with the string 'url'.
 

Field Detail

ACTIVITY

<static> object ACTIVITY

ADDRESS

<static> object ADDRESS

BODY_TYPE

<static> object BODY_TYPE

EMAIL

<static> object EMAIL

FILTER_TYPE

<static> object FILTER_TYPE

MEDIA_ITEM

<static> object MEDIA_ITEM

MESSAGE

<static> object MESSAGE

MESSAGE_TYPE

<static> object MESSAGE_TYPE

NAME

<static> object NAME

ORGANIZATION

<static> object ORGANIZATION

PERSON

<static> object PERSON

PHONE

<static> object PHONE

SORT_ORDER

<static> object SORT_ORDER

URL

<static> object URL

Back to top

Static Class opensocial.EscapeType

 SUMMARY     DETAIL

The types of escaping that can be applied to person data or fields.

Field Summary

<static> object HTML_ESCAPE
When used will HTML-escape the data.
<static> object NONE
When used will not escape the data.
 

Field Detail

HTML_ESCAPE

<static> object HTML_ESCAPE

NONE

<static> object NONE

Back to top

Class opensocial.IdSpec

 SUMMARY     DETAIL

Base interface for all id spec objects.

Method Summary

 String getField(key, opt_params)
Gets the id spec's data that's associated with the specified key.
setField(key, data)
Sets data for this id spec associated with the given key.
 

Method Detail

getField

String getField(key, opt_params)

setField

setField(key, data)

Back to top

Static Class opensocial.IdSpec.Field

 SUMMARY     DETAIL

All of the fields that id specs can have.

See also: opensocial.IdSpec.getField()

Field Summary

<static> object GROUP_ID
A string representing the group id or one of the opensocial.IdSpec.GroupId values.
<static> object NETWORK_DISTANCE
An optional numeric parameter, used to specify how many "hops" are allowed between two people still considered part of the same group.
<static> object USER_ID
A string or an array of strings representing the user id.
 

Field Detail

GROUP_ID

<static> object GROUP_ID

NETWORK_DISTANCE

<static> object NETWORK_DISTANCE

USER_ID

<static> object USER_ID

Back to top

Static Class opensocial.IdSpec.GroupId

 SUMMARY     DETAIL

Constant group IDs available when fetching collections of people.

Field Summary

<static> object ALL
This field may be used interchangeably with the string 'ALL'.
<static> object FRIENDS
This field may be used interchangeably with the string 'FRIENDS'.
<static> object SELF
This field may be used interchangeably with the string 'SELF'.
 

Field Detail

ALL

<static> object ALL

FRIENDS

<static> object FRIENDS

SELF

<static> object SELF

Back to top

Static Class opensocial.IdSpec.PersonId

 SUMMARY     DETAIL

Constant person IDs available when fetching person information.

Field Summary

<static> object OWNER
This field may be used interchangeably with the string 'OWNER'.
<static> object VIEWER
This field may be used interchangeably with the string 'VIEWER'.
 

Field Detail

OWNER

<static> object OWNER

VIEWER

<static> object VIEWER

Back to top

Class opensocial.MediaItem

 SUMMARY     DETAIL

Represents images, movies, and audio. Create a MediaItem object using the opensocial.newMediaItem() method.

Method Summary

 String getField(key, opt_params)
Gets the media item data that's associated with the specified key.
setField(key, data)
Sets data for this media item associated with the given key.
 

Method Detail

getField

String getField(key, opt_params)

setField

setField(key, data)

Back to top

Static Class opensocial.MediaItem.Field

 SUMMARY     DETAIL

All of the fields that media items have.

See also: opensocial.MediaItem.getField()

Field Summary

<static> object MIME_TYPE
The MIME type of media, specified as a string.
<static> object TYPE
The type of media, specified as a MediaItem.Type object.
<static> object URL
A string specifying the URL where the media can be found.
 

Field Detail

MIME_TYPE

<static> object MIME_TYPE

TYPE

<static> object TYPE

URL

<static> object URL

Back to top

Static Class opensocial.MediaItem.Type

 SUMMARY     DETAIL

The possible types of media items.

See also: opensocial.MediaItem.Field

Field Summary

<static> object AUDIO
This field may be used interchangeably with the string 'audio'.
<static> object IMAGE
This field may be used interchangeably with the string 'image'.
<static> object VIDEO
This field may be used interchangeably with the string 'video'.
 

Field Detail

AUDIO

<static> object AUDIO

IMAGE

<static> object IMAGE

VIDEO

<static> object VIDEO

Back to top

Class opensocial.Message

 SUMMARY     DETAIL

Base interface for all message objects. *

See also: opensocial.newMessage(), opensocial.requestSendMessage()

Method Summary

 String getField(key, opt_params)
Gets the message data that's associated with the specified key.
setField(key, data)
Sets data for this message associated with the given key.
 

Method Detail

getField

String getField(key, opt_params)

setField

setField(key, data)

Back to top

Static Class opensocial.Message.Field

 SUMMARY     DETAIL

All of the fields that messages can have.

See also: opensocial.Message.getField()

Field Summary

<static> object BODY
The main text of the message.
<static> object BODY_ID
The main text of the message as a message template.
<static> object TITLE
The title of the message.
<static> object TITLE_ID
The title of the message as a message template.
<static> object TYPE
The title of the message, specified as an opensocial.Message.Type.
 

Field Detail

BODY

<static> object BODY

BODY_ID

<static> object BODY_ID

TITLE

<static> object TITLE

TITLE_ID

<static> object TITLE_ID

TYPE

<static> object TYPE

Back to top

Static Class opensocial.Message.Type

 SUMMARY     DETAIL

The types of messages that can be sent.

Field Summary

<static> object EMAIL
An email.
<static> object NOTIFICATION
A short private message.
<static> object PRIVATE_MESSAGE
A message to a specific user that can be seen only by that user.
<static> object PUBLIC_MESSAGE
A message to a specific user that can be seen by more than that user.
 

Field Detail

EMAIL

<static> object EMAIL

NOTIFICATION

<static> object NOTIFICATION

PRIVATE_MESSAGE

<static> object PRIVATE_MESSAGE

PUBLIC_MESSAGE

<static> object PUBLIC_MESSAGE

Back to top

Class opensocial.Name

 SUMMARY     DETAIL

Base interface for all name objects.

Method Summary

 String getField(key, opt_params)
Gets data for this name that is associated with the specified key.
 

Method Detail

getField

String getField(key, opt_params)

Back to top

Static Class opensocial.Name.Field

 SUMMARY     DETAIL

All of the fields that a name has. These are the supported keys for the Name.getField() method.

Field Summary

<static> object ADDITIONAL_NAME
The additional name, specified as a string.
<static> object FAMILY_NAME
The family name, specified as a string.
<static> object GIVEN_NAME
The given name, specified as a string.
<static> object HONORIFIC_PREFIX
The honorific prefix, specified as a string.
<static> object HONORIFIC_SUFFIX
The honorific suffix, specified as a string.
<static> object UNSTRUCTURED
The unstructured name, specified as a string.
 

Field Detail

ADDITIONAL_NAME

<static> object ADDITIONAL_NAME

FAMILY_NAME

<static> object FAMILY_NAME

GIVEN_NAME

<static> object GIVEN_NAME

HONORIFIC_PREFIX

<static> object HONORIFIC_PREFIX

HONORIFIC_SUFFIX

<static> object HONORIFIC_SUFFIX

UNSTRUCTURED

<static> object UNSTRUCTURED

Back to top

Class opensocial.NavigationParameters

 SUMMARY     DETAIL

Parameters used by RequestShareApp to instruct the container on where to go after the request is made. It could be used, for example, to specify where viewers get routed in one of two cases: 1) After a user gets a shareApp invitation or receives a message a gadget developer should be able to send that user to a context sensitive place. 2) After a viewer actually shares an app with someone else the gadget developer should be able to redirect the viewer to a context sensitive place.

Method Summary

 String getField(key, opt_params)
Gets the NavigationParameters' data that's associated with the specified key.
setField(key, data)
Sets data for this NavigationParameters associated with the given key.
 

Method Detail

getField

String getField(key, opt_params)

setField

setField(key, data)

Back to top

Static Class opensocial.NavigationParameters.DestinationType

 SUMMARY     DETAIL

The destinations available for navigation in requestShareApp and requestSendMessage.

Field Summary

<static> object RECIPIENT_DESTINATION
This field may be used interchangeably with the string 'recipientDestination'.
<static> object VIEWER_DESTINATION
This field may be used interchangeably with the string 'viewerDestination'.
 

Field Detail

RECIPIENT_DESTINATION

<static> object RECIPIENT_DESTINATION

VIEWER_DESTINATION

<static> object VIEWER_DESTINATION

Back to top

Static Class opensocial.NavigationParameters.Field

 SUMMARY     DETAIL

All of the fields that NavigationParameters can have.

See also: opensocial.NavigationParameters.getField()

Field Summary

<static> object OWNER
A string representing the owner id.
<static> object PARAMETERS
An optional list of parameters passed to the gadget once the new view, with the new owner, has been loaded.
<static> object VIEW
The View to navigate to.
 

Field Detail

OWNER

<static> object OWNER

PARAMETERS

<static> object PARAMETERS

VIEW

<static> object VIEW

Back to top

Class opensocial.Organization

 SUMMARY     DETAIL

Base interface for all organization objects.

Method Summary

 String getField(key, opt_params)
Gets data for this body type that is associated with the specified key.
 

Method Detail

getField

String getField(key, opt_params)

Back to top

Static Class opensocial.Organization.Field

 SUMMARY     DETAIL

All of the fields that a organization has. These are the supported keys for the Organization.getField() method.

Field Summary

<static> object ADDRESS
The address of the organization, specified as an opensocial.Address.
<static> object DESCRIPTION
A description or notes about the person's work in the organization, specified as a string.
<static> object END_DATE
The date the person stopped at the organization, specified as a Date.
<static> object FIELD
The field the organization is in, specified as a string.
<static> object NAME
The name of the organization, specified as a string.
<static> object SALARY
The salary the person receieves from the organization, specified as a string.
<static> object START_DATE
The date the person started at the organization, specified as a Date.
<static> object SUB_FIELD
The subfield the Organization is in, specified as a string.
<static> object TITLE
The title or role the person has in the organization, specified as a string.
<static> object WEBPAGE
A webpage related to the organization, specified as a string.
 

Field Detail

ADDRESS

<static> object ADDRESS

DESCRIPTION

<static> object DESCRIPTION

END_DATE

<static> object END_DATE

FIELD

<static> object FIELD

NAME

<static> object NAME

SALARY

<static> object SALARY

START_DATE

<static> object START_DATE

SUB_FIELD

<static> object SUB_FIELD

TITLE

<static> object TITLE

WEBPAGE

<static> object WEBPAGE

Back to top

Static Class opensocial.Permission

 SUMMARY     DETAIL

The permissions an app can ask for.

See also: opensocial.hasPermission(), opensocial.requestPermission()

Field Summary

<static> object VIEWER
Access to the viewer person object This field may be used interchangeably with the string 'viewer'.
 

Field Detail

VIEWER

<static> object VIEWER

Back to top

Class opensocial.Person

 SUMMARY     DETAIL

Base interface for all person objects.

Method Summary

 String getDisplayName()
Gets a text display name for this person; guaranteed to return a useful string.
 String getField(key, opt_params)
Gets data for this person that is associated with the specified key.
 String getId()
Gets an ID that can be permanently associated with this person.
 Boolean isOwner()
Returns true if this person object represents the owner of the current page.
 Boolean isViewer()
Returns true if this person object represents the currently logged in user.
 

Method Detail

getDisplayName

String getDisplayName()

getField

String getField(key, opt_params)

getId

String getId()

isOwner

Boolean isOwner()

isViewer

Boolean isViewer()

Back to top

Static Class opensocial.Person.Field

 SUMMARY     DETAIL

All of the fields that a person has. These are the supported keys for the Person.getField() method.

Field Summary

<static> object ABOUT_ME
A general statement about the person, specified as a string.
<static> object ACTIVITIES
Person's favorite activities, specified as an Array of strings.
<static> object ADDRESSES
Addresses associated with the person, specified as an Array of Addresses.
<static> object AGE
Person's age, specified as a number.
<static> object BODY_TYPE
Person's body characteristics, specified as an opensocial.BodyType.
<static> object BOOKS
Person's favorite books, specified as an Array of strings.
<static> object CARS
Person's favorite cars, specified as an Array of strings.
<static> object CHILDREN
Description of the person's children, specified as a string.
<static> object CURRENT_LOCATION
Person's current location, specified as an Address.
<static> object DATE_OF_BIRTH
Person's date of birth, specified as a Date object.
<static> object DRINKER
Person's drinking status, specified as an opensocial.Enum with the enum's key referencing opensocial.Enum.Drinker.
<static> object EMAILS
Emails associated with the person, specified as an Array of Emails.
<static> object ETHNICITY
Person's ethnicity, specified as a string.
<static> object FASHION
Person's thoughts on fashion, specified as a string.
<static> object FOOD
Person's favorite food, specified as an Array of strings.
<static> object GENDER
Person's gender, specified as an opensocial.Enum with the enum's key referencing opensocial.Enum.Gender.
<static> object HAPPIEST_WHEN
Describes when the person is happiest, specified as a string.
<static> object HAS_APP
A boolean indicating whether the person has used the current app.
<static> object HEROES
Person's favorite heroes, specified as an Array of strings.
<static> object HUMOR
Person's thoughts on humor, specified as a string.
<static> object ID
A string ID that can be permanently associated with this person.
<static> object INTERESTS
Person's interests, hobbies or passions, specified as an Array of strings.
<static> object JOB_INTERESTS
Person's favorite jobs, or job interests and skills, specified as a string.
<static> object JOBS
Jobs the person has held, specified as an Array of Organizations.
<static> object LANGUAGES_SPOKEN
List of the languages that the person speaks as ISO 639-1 codes, specified as an Array of strings.
<static> object LIVING_ARRANGEMENT
Description of the person's living arrangement, specified as a string.
<static> object LOOKING_FOR
Person's statement about who or what they are looking for, or what they are interested in meeting people for.
<static> object MOVIES
Person's favorite movies, specified as an Array of strings.
<static> object MUSIC
Person's favorite music, specified as an Array of strings.
<static> object NAME
A opensocial.Name object containing the person's name.
<static> object NETWORK_PRESENCE
Person's current network status.
<static> object NICKNAME
A String representing the person's nickname.
<static> object PETS
Description of the person's pets, specified as a string.
<static> object PHONE_NUMBERS
Phone numbers associated with the person, specified as an Array of Phones.
<static> object POLITICAL_VIEWS
Person's political views, specified as a string.
<static> object PROFILE_SONG
Person's profile song, specified as an opensocial.Url.
<static> object PROFILE_URL
Person's profile URL, specified as a string.
<static> object PROFILE_VIDEO
Person's profile video, specified as an opensocial.Url.
<static> object QUOTES
Person's favorite quotes, specified as an Array of strings.
<static> object RELATIONSHIP_STATUS
Person's relationship status, specified as a string.
<static> object RELIGION
Person's relgion or religious views, specified as a string.
<static> object ROMANCE
Person's comments about romance, specified as a string.
<static> object SCARED_OF
What the person is scared of, specified as a string.
<static> object SCHOOLS
Schools the person has attended, specified as an Array of Organizations.
<static> object SEXUAL_ORIENTATION
Person's sexual orientation, specified as a string.
<static> object SMOKER
Person's smoking status, specified as an opensocial.Enum with the enum's key referencing opensocial.Enum.Smoker.
<static> object SPORTS
Person's favorite sports, specified as an Array of strings.
<static> object STATUS
Person's status, headline or shoutout, specified as a string.
<static> object TAGS
Arbitrary tags about the person, specified as an Array of strings.
<static> object THUMBNAIL_URL
Person's photo thumbnail URL, specified as a string.
<static> object TIME_ZONE
Person's time zone, specified as the difference in minutes between Greenwich Mean Time (GMT) and the user's local time.
<static> object TURN_OFFS
Person's turn offs, specified as an Array of strings.
<static> object TURN_ONS
Person's turn ons, specified as an Array of strings.
<static> object TV_SHOWS
Person's favorite TV shows, specified as an Array of strings.
<static> object URLS
URLs related to the person, their webpages, or feeds.
 

Field Detail

ABOUT_ME

<static> object ABOUT_ME

ACTIVITIES

<static> object ACTIVITIES

ADDRESSES

<static> object ADDRESSES

AGE

<static> object AGE

BODY_TYPE

<static> object BODY_TYPE

BOOKS

<static> object BOOKS

CARS

<static> object CARS

CHILDREN

<static> object CHILDREN

CURRENT_LOCATION

<static> object CURRENT_LOCATION

DATE_OF_BIRTH

<static> object DATE_OF_BIRTH

DRINKER

<static> object DRINKER

EMAILS

<static> object EMAILS

ETHNICITY

<static> object ETHNICITY

FASHION

<static> object FASHION

FOOD

<static> object FOOD

GENDER

<static> object GENDER

HAPPIEST_WHEN

<static> object HAPPIEST_WHEN

HAS_APP

<static> object HAS_APP

HEROES

<static> object HEROES

HUMOR

<static> object HUMOR

ID

<static> object ID

INTERESTS

<static> object INTERESTS

JOB_INTERESTS

<static> object JOB_INTERESTS

JOBS

<static> object JOBS

LANGUAGES_SPOKEN

<static> object LANGUAGES_SPOKEN

LIVING_ARRANGEMENT

<static> object LIVING_ARRANGEMENT

LOOKING_FOR

<static> object LOOKING_FOR

MOVIES

<static> object MOVIES

MUSIC

<static> object MUSIC

NAME

<static> object NAME

NETWORK_PRESENCE

<static> object NETWORK_PRESENCE

NICKNAME

<static> object NICKNAME

PETS

<static> object PETS

PHONE_NUMBERS

<static> object PHONE_NUMBERS

POLITICAL_VIEWS

<static> object POLITICAL_VIEWS

PROFILE_SONG

<static> object PROFILE_SONG

PROFILE_URL

<static> object PROFILE_URL

PROFILE_VIDEO

<static> object PROFILE_VIDEO

QUOTES

<static> object QUOTES

RELATIONSHIP_STATUS

<static> object RELATIONSHIP_STATUS

RELIGION

<static> object RELIGION

ROMANCE

<static> object ROMANCE

SCARED_OF

<static> object SCARED_OF

SCHOOLS

<static> object SCHOOLS

SEXUAL_ORIENTATION

<static> object SEXUAL_ORIENTATION

SMOKER

<static> object SMOKER

SPORTS

<static> object SPORTS

STATUS

<static> object STATUS

TAGS

<static> object TAGS

THUMBNAIL_URL

<static> object THUMBNAIL_URL

TIME_ZONE

<static> object TIME_ZONE

TURN_OFFS

<static> object TURN_OFFS

TURN_ONS

<static> object TURN_ONS

TV_SHOWS

<static> object TV_SHOWS

URLS

<static> object URLS

Back to top

Class opensocial.Phone

 SUMMARY     DETAIL

Base interface for all phone objects.

Method Summary

 String getField(key, opt_params)
Gets data for this phone that is associated with the specified key.
 

Method Detail

getField

String getField(key, opt_params)

Back to top

Static Class opensocial.Phone.Field

 SUMMARY     DETAIL

All of the fields that a phone has. These are the supported keys for the Phone.getField() method.

Field Summary

<static> object NUMBER
The phone number, specified as a string.
<static> object TYPE
The phone number type or label, specified as a string.
 

Field Detail

NUMBER

<static> object NUMBER

TYPE

<static> object TYPE

Back to top

Class opensocial.ResponseItem

 SUMMARY     DETAIL

Represents a response that was generated by processing a data request item on the server.

Method Summary

 Object getData()
Gets the response data.
 String getErrorCode()
If the request had an error, returns the error code.
 String getErrorMessage()
If the request had an error, returns the error message.
 Object getOriginalDataRequest()
Returns the original data request item.
 Boolean hadError()
Returns true if there was an error in fetching this data from the server.
 

Method Detail

getData

Object getData()

getErrorCode

String getErrorCode()

getErrorMessage

String getErrorMessage()

getOriginalDataRequest

Object getOriginalDataRequest()

hadError

Boolean hadError()

Back to top

Static Class opensocial.ResponseItem.Error

 SUMMARY     DETAIL

Error codes that a response item can return.

Field Summary

<static> object BAD_REQUEST
The request was invalid.
<static> object FORBIDDEN
The gadget can never have access to the requested data.
<static> object INTERNAL_ERROR
The request encountered an unexpected condition that prevented it from fulfilling the request.
<static> object LIMIT_EXCEEDED
The gadget exceeded a quota on the request.
<static> object NOT_IMPLEMENTED
This container does not support the request that was made.
<static> object UNAUTHORIZED
The gadget does not have access to the requested data.
 

Field Detail

BAD_REQUEST

<static> object BAD_REQUEST

FORBIDDEN

<static> object FORBIDDEN

INTERNAL_ERROR

<static> object INTERNAL_ERROR

LIMIT_EXCEEDED

<static> object LIMIT_EXCEEDED

NOT_IMPLEMENTED

<static> object NOT_IMPLEMENTED

UNAUTHORIZED

<static> object UNAUTHORIZED

Back to top

Class opensocial.Url

 SUMMARY     DETAIL

Base interface for all URL objects.

Method Summary

 String getField(key, opt_params)
Gets data for this URL that is associated with the specified key.
 

Method Detail

getField

String getField(key, opt_params)

Back to top

Static Class opensocial.Url.Field

 SUMMARY     DETAIL

All of the fields that a URL has. These are the supported keys for the Url.getField() method.

Field Summary

<static> object ADDRESS
The address the URL points to, specified as a string.
<static> object LINK_TEXT
The text of the link, specified as a string.
<static> object TYPE
The URL number type or label, specified as a string.
 

Field Detail

ADDRESS

<static> object ADDRESS

LINK_TEXT

<static> object LINK_TEXT

TYPE

<static> object TYPE

Back to top