Documentation
¶
Overview ¶
Package facebook implements methods for saving developer when they want to use Facebook Graph API using Golang
Index ¶
- type API
- type APIInterface
- type Call
- type CallInterface
- type Facebook
- func (fb *Facebook) API(path string) APIInterface
- func (fb *Facebook) GenerateAccessToken(redirectURI string, code string) (map[string]interface{}, error)
- func (fb *Facebook) GetAppID() string
- func (fb *Facebook) GetAppSecret() string
- func (fb *Facebook) GetVersion() string
- func (fb *Facebook) Raw(method string, path string, queryStr string, body io.Reader) (interface{}, error)
- func (fb *Facebook) SetAccessToken(accessToken string) Interface
- func (fb *Facebook) SetAppID(appID string) Interface
- func (fb *Facebook) SetAppSecret(appSecret string) Interface
- func (fb *Facebook) SetVersion(version string) Interface
- type Graph
- func (g *Graph) GenerateRawURL(path string, querystring string) string
- func (g *Graph) GenerateURL(path string) string
- func (g *Graph) GenerateURLWithFields(path string, fields string) string
- func (g *Graph) GetGraphURL() string
- func (g *Graph) GetVersion() string
- func (g *Graph) SetVersion(version string) GraphInterface
- type GraphInterface
- type Interface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
API contains information that can be passed to access facebook graph api
func (*API) Fields ¶
func (a *API) Fields(fields string) APIInterface
Fields is use to set selected fields to be return by facebook graph api
func (*API) Link ¶
func (a *API) Link(shareURL string) APIInterface
Link is use to define a share link that want to be posted into user's timeline
func (*API) Messages ¶
func (a *API) Messages(msg string) APIInterface
Messages is use to define message that want to be posted into user's timeline
type APIInterface ¶
type APIInterface interface {
Fields(fields string) APIInterface
Messages(msg string) APIInterface
Link(shareURL string) APIInterface
Get() (interface{}, error)
Post() (interface{}, error)
Delete() (interface{}, error)
}
APIInterface is the main functionality of facebook-go-sdk
type Call ¶
type Call struct {
HTTPClient http.Client
HTTPRequest *http.Request
HTTPHeader map[string]string
Method string
URL string
Body io.Reader
}
Call is a place where Facebook Graph API are being called. This is the HIT-man!
func (*Call) AddHeader ¶
func (c *Call) AddHeader(key string, value string) CallInterface
AddHeader is use to add request header
func (*Call) SetBody ¶
func (c *Call) SetBody(body io.Reader) CallInterface
SetBody is use to set the request body
func (*Call) SetMethod ¶
func (c *Call) SetMethod(method string) CallInterface
SetMethod is use to set the http method
func (*Call) SetURL ¶
func (c *Call) SetURL(url string) CallInterface
SetURL is use to set the target URL
type CallInterface ¶
type CallInterface interface {
New() CallInterface
SetMethod(method string) CallInterface
SetURL(url string) CallInterface
SetBody(body io.Reader) CallInterface
AddHeader(key string, value string) CallInterface
Submit() (interface{}, error)
}
CallInterface contains the common method to be setup before submitting request to facebook graph api
type Facebook ¶
Facebook is the base schema
func (*Facebook) API ¶
func (fb *Facebook) API(path string) APIInterface
API represents the Facebook Graph API that can be use by developers. It helps to simplify things
func (*Facebook) GenerateAccessToken ¶
func (fb *Facebook) GenerateAccessToken(redirectURI string, code string) (map[string]interface{}, error)
GenerateAccessToken returns access_token data
func (*Facebook) GetAppSecret ¶
GetAppSecret returns the current used app secret
func (*Facebook) GetVersion ¶
GetVersion returns the current used API version
func (*Facebook) Raw ¶
func (fb *Facebook) Raw(method string, path string, queryStr string, body io.Reader) (interface{}, error)
Raw is use to call Facebook Graph API in raw method @method string e.g. `GET`, `POST` @path strin e.g. `/me` @queryStr string e.g. `?fields=id,name` @body io.Reader e.g. ... (optional)
func (*Facebook) SetAccessToken ¶
SetAccessToken is use to set current access token
func (*Facebook) SetAppSecret ¶
SetAppSecret is use to set your application secret
func (*Facebook) SetVersion ¶
SetVersion is use to set the version of graph api
type Graph ¶
Graph represents a default configuration for facebook graph api
func (*Graph) GenerateRawURL ¶
GenerateRawURL is use to generate a URL with raw query string
func (*Graph) GenerateURL ¶
GenerateURL is use to generate a URL to be used when requesting to Facebook Graph API
func (*Graph) GenerateURLWithFields ¶
GenerateURLWithFields is use to generate a URL to be used when accessing Facebook Graph API with `fields` as query string
func (*Graph) GetGraphURL ¶
GetGraphURL is use to get current graph API URL
func (*Graph) GetVersion ¶
GetVersion is use to get current version used by graph functions
func (*Graph) SetVersion ¶
func (g *Graph) SetVersion(version string) GraphInterface
SetVersion is use to set the Facebook Graph API version and also the default Graph API url
type GraphInterface ¶
type GraphInterface interface {
SetVersion(version string) GraphInterface
GetVersion() string
GetGraphURL() string
GenerateURL(path string) string
GenerateURLWithFields(path string, fields string) string
GenerateRawURL(path string, querystring string) string
}
GraphInterface represents all methods for using Facebook Graph API
type Interface ¶
type Interface interface {
SetAppID(appID string) Interface
SetAppSecret(appSecret string) Interface
SetVersion(version string) Interface
SetAccessToken(accessToken string) Interface
GetVersion() string
GetAppID() string
GetAppSecret() string
GenerateAccessToken(redirectURI string, code string) (map[string]interface{}, error)
Raw(method string, path string, queryStr string, body io.Reader) (interface{}, error)
API(path string) APIInterface
}
Interface is the map interface for facebook-go-sdk