Opensocial (v0.9)
NeedsExamples
opensocial
Namespace for top-level people functions.
Methods
opensocial.getEnvironment
;<static> opensocial.Environment opensocial.getEnvironment()
Returns
TypeDescription |
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
NameTypeDescription |
permission |
opensocial.Permission |
The permission |
Returns
TypeDescription |
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
NameTypeDescription |
params |
Map.<opensocial.Activity.Field |
Object> |
Parameters defining the activity |
Returns
TypeDescription |
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
NameTypeDescription |
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
TypeDescription |
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
TypeDescription |
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
NameTypeDescription |
parameters |
Map.<opensocial.IdSpec.Field |
Object> |
Parameters defining the id spec. |
Returns
TypeDescription |
opensocial.IdSpec |
The new IdSpec object |
Description
Creates an IdSpec object.
opensocial.newMediaItem
;<static> opensocial.MediaItem opensocial.newMediaItem(mimeType, url, opt_params)
Parameters
NameTypeDescription |
Returns
TypeDescription |
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
NameTypeDescription |
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
TypeDescription |
The new message object |
Description
Creates a new message object for use with opensocial.requestSendMessage.
opensocial.newNavigationParameters
;<static> opensocial.NavigationParameters opensocial.newNavigationParameters(parameters)
Parameters
NameTypeDescription |
parameters |
Map.<opensocial.NavigationParameters.Field |
Object> |
Parameters defining the navigation |
Returns
TypeDescription |
opensocial.NavigationParameters |
The new NavigationParameters object |
Description
Creates a NavigationParameters object. See also: requestShareApp()
opensocial.requestCreateActivity
;<static> opensocial.requestCreateActivity(activity, priority, opt_callback)
Parameters
NameTypeDescription |
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
NameTypeDescription |
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
NameTypeDescription |
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
NameTypeDescription |
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
NameTypeDescription |
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.
{{ JsApiAlphaList_(v0.9) }}