This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.
No, but that sounds like a useful addition to the API binding. It should be simple to get a list of page IDs for the pages the user administers. Getting a list of Page objects may be a bit more tricky, but still might be possible.
Please open an issue in JIRA for this. Or, if you want to try implementing it, then give it a go and submit a pull request.
I saw that all of the classes in Impl (AccountList, GroupList etc) are scoped to default (i guess private package). Because of this i cannot use fetchConnection method in FacebookTemplate to actually get a list of Accounts (Which will list the pages for me) using the below code in my class:
The stuff in impl is not considered part of the public API. AccountList, GroupList, etc are just container classes to help with the JSON deserialization. It's not those types that should be exposed in the API, but the list returned from their getList() methods.
In PageTemplate, fetchConnections() is used to fetch a list of Account objects already. Those aren't exposed through the API, although with a little bit of rework they could be. But it should be a List<Account> returned, not AccountList.
This is my observation, may be i am missing something here.
By scoping the classes in Impl package-private, you have removed a lot of flexibility. For example now if need to get a list of accounts, i am bound to the methods offered by the interface.
Now to get around this, I created a class called AccountList which is an exact copy of AccountList class in impl package of spring social facebook. Then to make the call to get a list of Accounts i did this:
I'm in the same boat, and agree that this should be exposed. fetchConnections would imply a List is returned, so why not type it as a List<T> based on the type passed? It would require some work in the implementation to go from the singular to the plural (Account uses AccountList, etc.) but makes the most since from a developer's perspective (mine).
AccountList and the various List subclasses are workarounds for the fact that parameterized type information cannot be provided in any other way when working with the RestTemplate API. This is unfortunate, and leads to a proliferation of such subclasses. The fact we consider this a workaround is why we've strictly kept these types package-private thus far.
What seems clear is we need the ability to instruct the REST client to map a JSON array result to a typed List. We should explore if this can be done without requiring an ArrayList subclass to be defined each time this kind of mapping is needed. We should also re-evaluate the Facebook GraphApi fetchConnections signature, as suggested by Nick.
I see what you're saying....as it is, fetchConnections() isn't much use in the public API without either exposing those list wrapper types or forcing you to recreate them yourselves (neither of which is ideal). Moreover, Nick makes a good point that fetchConnections() could be more intuitive if it was given the type of element returned in the list instead of the type of element it returns.
I just pushed a snapshot build that I think will address the concerns expressed in this thread. Externally, the only changes are (1) the fetchConnections() signature has changed to return List<T> instead of T. Internally, I've done away with the wrapper types in favor of handling a small amount of the parsing within FacebookTemplate (just enough to get to the "data" element of the returned JSON).
Try it out and let me know if it works for you. Thanks!
The original request seems to have been hijacked in this thread. Back to the original request, is there a way to get a list of pages? In PageOperations (PageTemplate), there is a public Page getPage(String pageId) and a public List<Account> getAccounts(), but not a public List<Page> getPages(). Can that be added to the API? I was going to try to implement it myself, but I couldn't extend PageTemplate because the class is not public. Can you make the class public, so we can extend it as needed? Many thanks.