bobolounna / restfb

Automatically exported from code.google.com/p/restfb
0 stars 0 forks source link

deleteObject(String connection) ought to be able to take Parameters. #181

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Try to call a deleteObject operation that requires parameters.
2.Discover that FacebookClient.deleteObject(String connection) doesn't take 
parameters.
3.Cry into beer.

What is the expected output?
One should be able to invoke Facebook API DELETE operations that take 
parameters.

What do you see instead?
There seems to be no provision for passing parameters with DELETE operations.

What version of the product are you using? On what operating system?
RestFB 1.6.9 on Fedora Core Linux.

Please provide any additional information below.

While following https://developers.facebook.com/docs/reference/api/realtime/ I 
came across the need to delete a realtime update I had previously subscribed 
to.  To do this, I must send a DELETE request to /<UID>/subscriptions passing 
Parameter object="permissions", fields=[ "email", "publish_actions" ].

I have added a suitable deleteObject() call to the code and will attach a patch.

I hesitate to remove the existing deleteObject(String) method entirely in case 
this may break existing code somehow.  If this can be safely removed, leaving 
only the new method deleteObject(String, Parameter...), then remove it.

Example code:

JsonArray fields = new JsonArray();
fields.put("email");
fields.put("publish_actions");

boolean ret = facebookClient.deleteObject("/" + appId + "/subscriptions",
    Parameter.with("object", "permissions"),
    Parameter.with("fields", fields));
logger.info("Got from delete: " + ret);

Seems to work fine for me.

Original issue reported on code.google.com by neekfenw...@gmail.com on 30 Mar 2012 at 9:15

Attachments:

GoogleCodeExporter commented 8 years ago
Huh, I don't know what to say other than maybe at the time this was originally 
written there was no need to send parameters along for delete calls.  Anyway, 
thanks for the detailed report and the patch!  I've integrated it here: 
https://github.com/revetkn/restfb/commit/6a12fc10173d80a8befa1ef404f901fbc0260fd
d

 I decided to run the risk of breaking existing code by changing the signature, since this break would likely affect very few people and I'm toying with the idea of making the next release 1.7 instead of 1.6.10, so there may be other breakages anyway.

Original comment by m...@xmog.com on 1 Apr 2012 at 1:07