You are not logged in.   Log in | Register

UserAction object

From $1

Description

The UserAction object represents a user action. The UserAction object is used for publishing actions using the socialize.showShareUI or the socialize.publishUserAction API methods. The UserAction object is constructed by the application. See the constructor description below for an example on how to construct a UserAction object. To learn more about using the UserAction object, please read the Publish User Actions page in the Developer Guide.

 

Constructor

UserAction()

Creates a new UserAction instance.

For example:

var act = new gigya.services.socialize.UserAction();  

 

Member Methods 

Method Name
Description
addMediaItem(mediaObject) Adds a media (Images \ Flash \ Mp3 \ Video) to the User Action. The method receives a mediaObject parameter which is a JSON-encoded object containing the media's type and data. To learn more about using this method, please refer to the Including Media Item/s section.
addActionLink(title, href) Adds a link that will appear in the links' area at the bottom of the post.

Parameters:
   title - link's text.
   href - link URL.

setUserMessage(userMessage) Sets the "User Message" string of the User Action. The User Message is typically text entered by the user.
Note: the user message should consist of simple text only. Gigya will remove any HTML tags from the user message string.
setTitle(title) Sets the Title string of the User Action. Typically this is the title of the posted content.
setDescription(description) Sets the Description string of the User Action. Typically this is the textual content of the post.
setLinkback(href) Sets the Link Back URL of the User Action. The Link Back is a link, typically to the content source.
setTemplate(string) Sets the template string attribute of the User Action. The template string parameter defines the structure of the action message.
For example:
act.setTemplate('{actor} {action} {thing}';
Please refer to the Action Template String section for extended explanation.
setActionName(actionName) Sets the value of the {action} field in the template string. Please refer to the Action Template String section for extended explanation.
setTemplateField(fieldName, text, href) Sets value of an application specific template field.

Parameters:
   fieldName - a custom field name.
   text - a text to replace the field placeholder in the template.
   href - an optional URL to link the text to.
For example - for the custom field {thing} in a template (refer to the example in the setTemplate method description above):

action.setTemplateField("thing", "Moby Dick", "http://www.amazon.com/Moby-Dick-Peng...5216585&sr=8-1");
addImage(imageSrc, imageHref) Deprecated. Please use the addMediaItem(mediaObject) method instead.
setIconURL(urlToIconImage) Deprecated. Sets a URL for an image that will be used as the icon associated with this action.
addTarget(userObject) Deprecated. Sets the value of the {target} field in the template string. Accepts a User object as the target of the operation.
addTarget(UID) Deprecated. Sets the value of the {target} field in the template string. Accepts a UID as the target of the operation.
Note: all the methods in the table above do not have a return value.

 

Media Object

A JSON-encoded object containing information about a media. The Media Object structure depends on its type. All media objects include the following basic fields:

Field Name Type Description
type string The media type. The valid values for this field are: 'image', 'flash' or 'mp3'.
src string The URL to the media source.

The following subsections elaborate the set of fields of each Media type:

type: 'image'

Field Name Type Description
href string URL of a link to associate with the image.

type: 'flash'

Field Name Type Description
width number The width of the Flash object to be rendered.
height number The height of the Flash object to be rendered.
previewImageURL URL The URL of an photo that should be displayed in place of the Flash object until the user clicks to prompt the Flash object to play.
previewImageWidth number The width of the preview image.
previewImageHeight number The height of the preview image.

type: 'mp3'

Field Name Type Description
title string The "Title" property of the mp3 file.
artist string The "Artist" property of the mp3 file.
album string The "Album" property of the mp3 file.

 

Usage Examples

Refer to the socialize.publishUserAction Code sample for a typical usage of the UserAction object. 

Tags:
Files (0)