Opensocial (v0.9)

From VZ Developer Wiki
Revision as of 12:10, 29 July 2010 by Seba (talk | contribs) (Created page with '{{NeedsExamples}} <div style="float:right; margin: 0 0 10px 10px;">__TOC__</div> <span style="font-size:150%"><strong>opensocial</strong></span> Namespace for top-level people …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This documentation is not completed yet and will be extended by more examples in future.

opensocial

Namespace for top-level people functions.

Methods

opensocial.getEnvironment

<static> opensocial.Environment opensocial.getEnvironment()
Returns
Type Description
opensocial.Environment The current environment
Description
Gets the current environment for this gadget. You can use the environment to make queries such as what profile fields and surfaces are supported by this container, what parameters were passed to the current gadget, and so on.

opensocial.hasPermission

<static> Boolean opensocial.hasPermission(permission)
Parameters
Name Type Description
permission opensocial.Permission The permission
Returns
Type Description
Boolean True if the gadget has access for the permission; false if it doesn't
Description
Returns true if the current gadget has access to the specified permission. If the gadget calls opensocial.requestPermission and permissions are granted then this function must return true on all subsequent calls.

opensocial.invalidateCache

<static> opensocial.invalidateCache()
Description
Invalidates all resources cached for the current viewer.

opensocial.newActivity

<static> opensocial.Activity opensocial.newActivity(params)
Parameters
Name Type Description
params Map.<opensocial.Activity.Field|Object> Parameters defining the activity
Returns
Type Description
opensocial.Activity The new activity object
Description
Creates an activity object, which represents an activity on the server.

See also: requestCreateActivity(),

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, and may choose to ignore additional parameters.

See Field for more details.

opensocial.newAlbum

<static> opensocial.MediaItem opensocial.newAlbum(opt_params)
Parameters
Name Type Description
opt_params Map.<opensocial.Album.Field|Object> Any other fields that should be set on the Album object; all of the defined Field s are supported
Returns
Type Description
opensocial.MediaItem The new album object
Description
Creates a album. Represents a collection of images, movies, and audio. Used when creating albums on the server.

opensocial.newDataRequest

<static> opensocial.DataRequest opensocial.newDataRequest()
Returns
Type Description
opensocial.DataRequest The request object
Description
Creates a data request object to use for sending and fetching data from the server.

opensocial.newIdSpec

<static> opensocial.IdSpec opensocial.newIdSpec(parameters)
Parameters
Name Type Description
parameters Map.<opensocial.IdSpec.Field|Object> Parameters defining the id spec.
Returns
Type Description
opensocial.IdSpec The new IdSpec object
Description
Creates an IdSpec object.

opensocial.newMediaItem

<static> opensocial.MediaItem opensocial.newMediaItem(mimeType, url, opt_params)
Parameters
Name Type Description
mimeType String MIME type of the media
url String Where the media can be found
opt_params Map.<opensocial.MediaItem.Field|Object> Any other fields that should be set on the media item object; all of the defined Field s are supported
Returns
Type Description
opensocial.MediaItem The new media item object
Description
Creates a media item. Represents images, movies, and audio. Used when creating activities on the server.

opensocial.newMessage

<static> opensocial.Message opensocial.newMessage(body, opt_params)
Parameters
Name Type Description
body String The main text of the message
opt_params Map.<opensocial.Message.Field|Object> Any other fields that should be set on the message object; all of the defined Field s are supported
Returns
Type Description
opensocial.Message The new message object
Description
Creates a new message object for use with opensocial.requestSendMessage.

opensocial.newNavigationParameters

<static> opensocial.NavigationParameters opensocial.newNavigationParameters(parameters)
Parameters
Name Type Description
parameters Map.<opensocial.NavigationParameters.Field|Object> Parameters defining the navigation
Returns
Type Description
opensocial.NavigationParameters The new NavigationParameters object
Description
Creates a NavigationParameters object.

See also: requestShareApp()

opensocial.requestCreateActivity

<static> opensocial.requestCreateActivity(activity, priority, opt_callback)
Parameters
Name Type Description
activity opensocial.Activity The activity to create
priority opensocial.CreateActivityPriority The priority for this request
opt_callback Function The function to call once the request has been processed. The callback function will not be called until after the existing callstack has completed execution.
Description
Takes an activity and tries to create it, without waiting for the operation to complete. Optionally calls a function when the operation completes.

See also: newActivity()

Note: If this is the first activity that has been created for the user and the request is marked as HIGH priority then this call may open a user flow and navigate away from your gadget.

This callback will either be called or the gadget will be reloaded from scratch. 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, the activity was created. If there was an error, you can use the response item's getErrorCode method to determine how to proceed. The data on the response item will not be set.

If the container does not support this method the callback will be called with a opensocial.ResponseItem. The response item will have its error code set to NOT_IMPLEMENTED.

opensocial.requestPermission

<static> opensocial.requestPermission(permissions, reason, opt_callback)
Parameters
Name Type Description
permissions Array.<opensocial.Permission> The permissions to request from the viewer
reason String Displayed to the user as the reason why these permissions are needed
opt_callback Function The function to call once the request has been processed; either this callback will be called or the gadget will be reloaded from scratch. 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, all permissions were granted. If there was an error, you can use opensocial.hasPermission to check which permissions are still denied. The data on the response item will be set. It will be an array of the opensocial.Permissions that were granted. The callback function will not be called until after the existing callstack has completed execution.
Description
Requests the user to grant access to the specified permissions. If the container does not support this method the callback will be called with a opensocial.ResponseItem. The response item will have its error code set to NOT_IMPLEMENTED.

opensocial.requestSendMessage

<static> opensocial.requestSendMessage(An, message, opt_callback, opt_params)
Parameters
Name Type Description
An opensocial.IdSpec IdSpec used to specify which people/groups to send the message to.
message opensocial.Message The message to send to the specified users
opt_callback Function The function to call once the request has been processed; either this callback will be called or the gadget will be reloaded from scratch.The callback function will not be called until after the existing callstack has completed execution.
opt_params opensocial.NavigationParameters The optional parameters indicating where to send a user when a request is made, or when a request is accepted; options are of type NavigationParameters.DestinationType
Description
Requests the container to send a specific message to the specified users.

The callback function is 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, the message was sent. If there was an error, you can use the response item's getErrorCode method to determine how to proceed. The data on the response item will not be set.

If the container does not support this method the callback will be called with an opensocial.ResponseItem that has an error code of NOT_IMPLEMENTED.

opensocial.requestShareApp

<static> opensocial.requestShareApp(recipients, reason, opt_callback, opt_params)
Parameters
Name Type Description
recipients opensocial.IdSpec An IdSpec used to specify which people/groups to send the ShareApp request to.
reason opensocial.Message The reason the user wants the gadget to share itself. This reason can be used by the container when prompting the user for permission to share the app. It may also be ignored.
opt_callback Function The function to call once the request has been processed; either this callback will be called or the gadget will be reloaded from scratch. The callback function will not be called until after the existing callstack has completed execution.
opt_params opensocial.NavigationParameters The optional parameters indicating where to send a user when a request is made, or when a request is accepted; options are of type NavigationParameters.DestinationType
Description
Requests the container to share this gadget with the specified users.

The callback function is 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, the sharing request was sent. If there was an error, you can use the response item's getErrorCode method to determine how to proceed. The data on the response item will not be set.

If the container does not support this method the callback will be called with a opensocial.ResponseItem. The response item will have its error code set to NOT_IMPLEMENTED.

opensocial.requestUploadMediaItem

<static> opensocial.requestUploadMediaItem(albumId, opt_callback)
Parameters
Name Type Description
albumId string Indicates which album/collection to insert the items into. If not present or set to null|undefined, the items go into the default location for the container. Partial upload is possible, such that if the container allows for multiple items, some items may fail to be added.
opt_callback Function Method is called when the upload completes. The callback function is 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, the message was sent. If there was an error, you can use the response item's getErrorCode method to determine how to proceed. getErrorMessage will contain a comma separated list of files that failed to upload. The data on the response item will be set to an array of media item objects for successful items.
Description
Uploads a media item. Allows the container to provide some standard UI and other items to post files to a site.



OpenSocial (v0.9)

gadgets

gadgets.io

gadgets.json

gadgets.Prefs

gadgets.util

gadgets.views

gadgets.flash

gadgets.MiniMessage

gadgets.oauth.Popup

gadgets.rpc

gadgets.skins

gadgets.pubsub

gadgets.Tab

gadgets.TabSet

gadgets.window

gadgets.i18n

opensocial

opensocial.Activity

opensocial.Address

opensocial.Album

opensocial.BodyType

opensocial.Collection

opensocial.CreateActivityPriority

opensocial.DataRequest

opensocial.DataResponse

opensocial.Email

opensocial.Enum

opensocial.Environment

opensocial.EscapeType

opensocial.IdSpec

opensocial.MediaItem

opensocial.Message

opensocial.MessageCollection

opensocial.Name

opensocial.NavigationParameters

opensocial.Organization

opensocial.Permission

opensocial.Person

opensocial.Phone

opensocial.ResponseItem

opensocial.Url

osapi.Request

osapi.BatchRequest

osapi.people

osapi.activities

osapi.appdata

osapi.messages

osapi.http