AS3 API: Deleting App Invites

2020-08-01 13:17发布

问题:

I'm using the ActionScript-Facebook API for my project. Facebook now leaves it up to us to delete app invites once they are used.

In their documentation, they have a JavaScript snippet to do what I need to do:

FB.api(requestId, 'delete', function(response) {console.log(response);});

Cool. The AS3 API call is like such:

Facebook.api(referID, callback, "POST");

For the life of me, I'm not sure how to work this. I've tried:

Facebook.api(referID, function(){trace("callback");}, "delete");

Facebook.api(referID, function(){trace("callback");});

Facebook.api(referID, {access_token:accessTokenString}, "delete");

Here's the documentation:

https://developers.facebook.com/docs/reference/dialogs/requests/#deleting

回答1:

The following worked for removal of application requests:

var full_request_id : String = request_id + "_" + user_id;
var method : String =  "/" + full_request_id;
Facebook.deleteObject(method, callback);

@see AbstractFacebook.as The actionscript-api will then add the property 'method' with value 'delete' to the parameters of your call:

protected function deleteObject(method:String, callback:Function = null):void {
        var params:Object = {method:'delete'};
        api(method, callback, params, URLRequestMethod.POST);
    }

if (params.access_token == null) { params.access_token = accessToken; }