English | Site Directory

opensocial (v0.6)

 SUMMARY     DETAIL

Static Class opensocial

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> makeRequest(url, callback, opt_params)
Fetches content from the provided URL and feeds that content into the callback function.
<static>  opensocial.Activity newActivity(title, opt_params)
Creates an activity object, which represents an activity on the server.
<static>  opensocial.Activity.MediaItem newActivityMediaItem(mimetype, url, opt_params)
Creates a media item associated with an activity.
<static>  opensocial.DataRequest newDataRequest()
Creates a data request object to use for sending and fetching data from the server.
<static> requestCreateActivity(activity, priority, opt_callback)
Takes an activity and tries to create it, without waiting for the operation to complete.
<static> requestNavigateTo(surface, opt_params)
Attempts to navigate to this gadget on a different surface.
<static> requestPermission(permissions, reason, opt_callback)
Requests the user to grant access to the specified permissions.
 

Method Detail

getEnvironment

<static> opensocial.Environment getEnvironment()
    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.
    Returns:

hasPermission

<static> Boolean hasPermission(permission)
    Returns true if the current gadget has access to the specified permission.
    Parameters:
      opensocial.Permission permission - The permission
    Returns:
      Boolean True if the gadget has access for the permission; false if it doesn't

makeRequest

<static> makeRequest(url, callback, opt_params)
    Fetches content from the provided URL and feeds that content into the callback function.
    Parameters:
      String url - The URL where the content is located
      Function callback - The function to call with the data from the URL once it is fetched
      Map.<opensocial.ContentRequestParameters, Object> opt_params - Additional parameters to pass to the request

newActivity

<static> opensocial.Activity newActivity(title, opt_params)
    Parameters:
      String title - The title of an activity
      Map.<opensocial.Activity.Field, Object> opt_params - Any other fields that should be set on the activity object; all of the defined Fields are supported
    Returns:
      opensocial.Activity The new activity object

newActivityMediaItem

<static> opensocial.Activity.MediaItem newActivityMediaItem(mimetype, url, opt_params)
    Creates a media item associated with an activity. Represents images, movies, and audio. Used when creating activities on the server.
    Parameters:
      MediaItem.Type mimetype - MIME type of the media
      String url - Where the media can be found
      Map.<opensocial.Activity.MediaItem.Field, Object> opt_params - Any other fields that should be set on the media item object; all of the defined Fields are supported
    Returns:
      opensocial.Activity.MediaItem The new media item object

newDataRequest

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

requestCreateActivity

<static> requestCreateActivity(activity, priority, opt_callback)
    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.

    Parameters:
      Activity activity - The activity to create
      CreateActivityPriority priority - The priority for this request
      Function opt_callback - The function to call once the request has been processed. This callback will either be called or the gadget will be reloaded from scratch

requestNavigateTo

<static> requestNavigateTo(surface, opt_params)
    Attempts to navigate to this gadget on a different surface. If the container supports parameters will pass the optional parameters along to the gadget on the new surface.
    Parameters:
      opensocial.Surface surface - The surface to navigate to
      Map.<String, String> opt_params - Params to pass to the gadget after it has been navigated to on the surface

requestPermission

<static> requestPermission(permissions, reason, opt_callback)
    Requests the user to grant access to the specified permissions.
    Parameters:
      Array.<opensocial.Permission> permissions - The permissions to request from the viewer
      String reason - Displayed to the user as the reason why these permissions are needed
      Function opt_callback - The function to call once the request has been processed; either this callback will be called or the gadget will be reloaded from scratch

Documentation generated by JsDoc Toolkit 1.3.3