FYI, this is now in master.

The client defaults to XML (Node), but if you want to use JSON you can
create a client like this:

 def jsonClient(session:FacebookSession) = new FacebookClient[JValue]
(session, is => {
   JsonParser.parse(new BufferedReader(new InputStreamReader(is)))
 }, FacebookFormat.json)

for (client <- FacebookConnect.session.map(jsonClient)){
  val jsonUser = client !? GetUser
}

On Feb 10, 2:08 pm, Jonathan Hoffman <[email protected]> wrote:
> With connect you can also get a client:
>
> for (client <- FacebookConnect.client){
>         client !? ...
>
> }
>
> On Feb 9, 2010, at 8:56 AM, Leo Lännenmäki wrote:
>
>
>
> > Hi,
>
> > I'll definitely take a look. But I think FB connect is not applicable
> > for our use..
>
> > Here a simple version of the use:
> > - We have a Lift application providing a RESTfull JSON API for our
> > clients. Through that API a client application can share a photo to
> >Facebook
> > - We have a Web client for the API provided by the Lift server looming
> > on a different machine. That client does the FB login in order to get
> > a token for the user.
> > - That token is sent to the Lift server which uses it to create a new
> > client (val client = FacebookClient.fromAuthToken(authToken).get)
> > - When the user shares a photo through our API that fb client is used
> > to upload the photo toFacebook
>
> > On Feb 9, 6:06 am, Jonathan Hoffman <[email protected]> wrote:
> >> Hi All,
>
> >> I just created issue #336 to provide aFacebookConnect helper and example 
> >> application.  You can take a look at what I've got 
> >> here:http://github.com/dpp/liftweb/commit/3b6686201e3b7f22100e52a04734fd4c...
>
> >> Leo, if you're trying to use fb connect, hopefully this will help you out 
> >> (I would suggest using connect rather than redirecting to FB)
>
> >> Will push out to master pending your comments and RB.
>
> >> - Jon
>
> >> On Feb 5, 2010, at 10:35 AM, Leo Lännenmäki wrote:
>
> >>> Hi,
>
> >>> I have only tried to do a couple of things with theFacebookmodule
> >>> (I'm using 2.0-M1) and I have gotten some of the stuff to actually
> >>> work :)
>
> >>> Photo upload would be something like this:
>
> >>> import java.io.File
> >>> import org.apache.commons.io.FileUtils
> >>> import net.liftweb.ext_api.facebook._
> >>> import scala.xml._
>
> >>> FacebookRestApi.apiKey = "your api key"
> >>> FacebookRestApi.secret = "secret"
>
> >>> // Get a user to login toFacebookwith a link like
> >>>http://www.facebook.com/login.php?v=1.0&api_key="your api key"
> >>> // If you mess around with theFacebooksettings you will get FB to
> >>> // redirect the user back to your app with a token as a query param
>
> >>> val authToken = "as described previously"
> >>> val client = FacebookClient.fromAuthToken(authToken).get
> >>> val photo = new File(...)
> >>> val bytes = FileUtils.readFileToByteArray(photo)
> >>> val resp = client !? UploadPhoto("test.jpg", "jpg", bytes)
> >>> val photoUrl = (resp \\ "link").text
>
> >>> Getting a list of friends:
> >>> val resp = client !? GetFriends()
>
> >>> Some real documentation and examples sure would be nice!
>
> >>> Leo
>
> >>> On Feb 3, 9:00 am, celestocalculus <[email protected]>
> >>> wrote:
> >>>> Hello,
> >>>> I'm an intermediate lift developer. Suddenly, it has become my first
> >>>> choice framework for web applications. I really think it's a nice
> >>>> framework you guys are doing a great job.
> >>>> I'm new onfacebookapplication development and I have been looking at
> >>>> the liftwebfacebookAPI. I really don't know how to put this but I'm
> >>>> just blank, I don't know where to start. I would really appreciate it
> >>>> if I get a step by step explanation. All the book I got onfacebook
> >>>> apps are on php and I find it difficult to match the php codes to
> >>>> their corresponding lift counterparts.
>
> >>>> Please I'll also appreciate sample codes, please let it be step by
> >>>> step and on point.
>
> >>>> Thanks in advance.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups 
> >>> "Lift" group.
> >>> To post to this group, send email to [email protected].
> >>> To unsubscribe from this group, send email to 
> >>> [email protected].
> >>> For more options, visit this group 
> >>> athttp://groups.google.com/group/liftweb?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Lift" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/liftweb?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to