Documentation ¶
Overview ¶
Package facebook wraps the Facebook API in Go.
See the README on Github for more info: https://github.com/deiwin/facebook
Index ¶
Constants ¶
View Source
const ISO8601 = "2006-01-02T15:04:05-0700"
Variables ¶
View Source
var ( ErrMissingState = errors.New("A Facebook redirect request is missing the 'state' value") ErrInvalidState = errors.New("A Facebook redirect request's 'state' value does not match the session") ErrMissingCode = errors.New("A Facebook redirect request is missing the 'code' value") ErrNoSuchPage = errors.New("The user does not have access to that page") )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { // GET /me // // https://developers.facebook.com/docs/graph-api/reference/v2.4/user#read Me() (*model.User, error) // GET /me/accounts // // https://developers.facebook.com/docs/graph-api/reference/v2.4/user/accounts#read Accounts() (*model.Accounts, error) // GET /{page-id} // // https://developers.facebook.com/docs/graph-api/reference/page/ Page(pageID string) (*model.Page, error) // POST /{page-id}/feed // // https://developers.facebook.com/docs/graph-api/reference/v2.4/page/feed#publish PagePublish(pageAccessToken, pageID string, post *model.Post) (*model.PostResponse, error) // POST /{page_id}/photos // // https://developers.facebook.com/docs/graph-api/reference/page/photos/#Creating PagePhotoCreate(pageAccessToken, pageID string, photo *model.Photo) (*model.PhotoResponse, error) // GET /{post-id} // // https://developers.facebook.com/docs/graph-api/reference/v2.4/post#read Post(pageAccessToken, postID string) (*model.PostResponse, error) // POST /{post-id} // // https://developers.facebook.com/docs/graph-api/reference/v2.4/post#updating PostUpdate(pageAccessToken, postID string, post *model.Post) error // DELETE /{post-id} // // https://developers.facebook.com/docs/graph-api/reference/v2.4/post#deleting PostDelete(pageAccessToken, postID string) error }
API provides access to the Facebook API graph methods
type Authenticator ¶
type Authenticator interface { // AuthURL returns a Facebook URL the user should be redirect to. The user // will then be asked to log in by Facebook at that URL and will be redirected // back to the configured RedirectURL. AuthURL(state string) string // Token get's the longer term user access token from the redirect request. // Also checks that the provided state matches that of the redirect request and // returns "", ErrInvalidState if it doesn't. Token(state string, r *http.Request) (*oauth2.Token, error) // APIConnection returns an API instance that can be used to make authenticated // requests to the Facebook API. APIConnection(tok *oauth2.Token) API // PageAccessToken retrieves a page access token of the specified page if the // user has access to that page and returns "", ErrNoSuchPage if they don't. PageAccessToken(tok *oauth2.Token, pageID string) (string, error) }
Authenticator provides the authentication functionality for Facebook users using Facebook's OAuth
func NewAuthenticator ¶
func NewAuthenticator(conf Config) Authenticator
NewAuthenticator initializes and returns an Authenticator
Click to show internal directories.
Click to hide internal directories.