Skip to main content

mbga.BlackList

Method​

mbga.BlackList.getId​

String getId()

mbga.BlackList.getTargetId​

String getTargetId()

mbga.BlackList.getField​

Object getField(name)

mbga.BlackList.setField​

void setField(name, value)

mbga.BlackList.Field​

mbga.BlackList.Field.ID​

User IDs of the Blacklist owner.

mbga.BlackList.Field.TARGET_ID​

User IDs of users who are blacklisted by users in mbga.BlackList.Field.ID.

mbga.BlackListRequestFields​

A list of fields that can be used with mbga.newFetchBlackListRequest and mbga.requestBlackList opt_params.

mbga.BlackListRequestFields.SORT_BY​

mbga.BlackList.Field.TARGET_IDs can be specified.

mbga.BlackListRequestFields.SORT_ORDER​

mbga.BlackList.SortOrder can be specified.

mbga.BlackListRequestFields.FIRST​

The starting position of blacklist object acquisition is assigned using natural numbers. Normally, it is used for paging data that is acquired at the same time as mbga.BlackListRequestFields.MAX. The default value is 1.

In the following sample, the blacklist object data to be acquired is first split into 5 per page, and then the 5 pieces of data on the third page from the top are acquired. If the assigned number of data units does not exist on the pertinent page, just enough data is acquired so that it can be returned.

Sample​
var idSpec = opensocial.newIdSpec();
idSpec.setField(opensocial.IdSpec.Field.USER_ID, [ opensocial.IdSpec.PersonId.VIEWER ]);
idSpec.setField(opensocial.IdSpec.Field.GROUP_ID, opensocial.IdSpec.GroupId.ALL);

var opt_params = {};
opt_params[mbga.BlackListRequestFields.MAX] = 5;
opt_params[mbga.BlackListRequestFields.FIRST] = 3;

mbga.requestFetchBlackList(idSpec, opt_params, function(response) {
if (response.hadError()) {
// error handling
}
var blacklist = response.getData();
blacklist.each(function(entry) {
// entry is an instance of mbga.BlackList
gadgets.log( "targetId: " + entry.getTargetId() );
});
});

mbga.BlackListRequestFields.MAX​

The maximum number of blacklist object acquisitions is assigned using natural numbers. Normally, it is used for paging data that is acquired at the same time as mbga.BlackListRequestFields.FIRST. The default value is 50.

mbga.BlackListRequestFields.PERSON_ID​

If an ID or an ID array is assigned here, only the blacklist object for which the assigned ID was set as the TARGET_ID will be acquired. The sample below illustrates how a user (a VIEWER in this case) can determine whether or not another user (the user with ID=10902 in this case) has been registered in the blacklist.

Sample​
var idSpec = opensocial.newIdSpec();
idSpec.setField(opensocial.IdSpec.Field.USER_ID, [ opensocial.IdSpec.PersonId.VIEWER ]);
idSpec.setField(opensocial.IdSpec.Field.GROUP_ID, opensocial.IdSpec.GroupId.ALL);

var opt_params = {};
opt_params[mbga.BlackListRequestFields.PERSON_ID] = [10902];

mbga.requestFetchBlackList(idSpec, opt_params, function(response) {
if (response.hadError()) {
if ( response.getErrorCode() === opensocial.ResponseItem.Error.BAD_REQUEST ) {
// 10902 is not in the blacklist of the viewer
}
else {
// error handling
}
}
else {
// 10902 is in the blacklist of the viewer
}
});

mbga.BlackListRequestFields.FORMAT​

mbga.BlackList.Format can be specified.

mbga.BlackListRequestFields.FIELDS​

Specifies arrays with fields to be acquired from those in mbga.BlackList.Field arranged.

mbga.BlackListRequest.SortBy​

mbga.BlackListRequest.SortBy.TARGET_ID​

Sorts blacklist objects using mbga.Blacklist.Field.TARGET_ID as a key.

mbga.BlackListRequest.SortOrder​

mbga.BlackListRequest.SortOrder.ASCENDING​

Sorts blacklist objects in ascending order of key value.

mbga.BlackListRequest.SortOrder.DESCENDING​

Sorts blacklist objects in descending order of key value.

mbga.BlackListRequest.Format​

mbga.BlackListRequest.Format.JSON​

Revision History​

  • 12/2010
    • Initial Release.