Skip to content

azoff/facebook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Facebook Graph API Library In Go

Build Status

This is a Go library fully supports Facebook Graph API with file upload, batch request and FQL. It's simple but powerful.

Quick Tutorial

Here is a sample to read my Facebook username by uid.

    package main

    import (
        "fmt"
        fb "github.com/huandu/facebook"
    )

    func main() {
        res, _ := fb.Get("/538744468", fb.Params{
            "fields": "username",
        })
        fmt.Println("here is my facebook username:", res["username"])
    }

Type of res["username"] is interface{}. This library provides several helpful methods to decode fields to any Go type or even a custom Go struct.

    // Decode "username" to a go string.
    var username string
    res.DecodeField("username", &username)
    fmt.Println("alternative way to get username:", username)

    // It's also possible to decode the whole result into a predefined struct.
    type User struct {
        Username string
    }
    var user User
    res.Decode(&user)
    fmt.Println("print username in struct:", user.Username)

Full Document

Read http://godoc.org/github.com/huandu/facebook or use go doc.

Get It

Use go get github.com/huandu/facebook to get and install it.

Out of Scope

  1. No OAuth integration. This library only provides APIs to parse/verify access token and OAuth code.
  2. No old RESTful API support. Such APIs are deprecated for years. Forget about them.

License

This library is licensed under MIT license. See LICENSE for details.

About

A Facebook Graph API Library In Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%