fbapi

package module
v0.0.0-...-07c8964 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2015 License: BSD-3-Clause Imports: 9 Imported by: 1

README

fbapi Build Status

Package fbapi provides a client for the Facebook API: https://godoc.org/github.com/facebookgo/fbapi

Documentation

Overview

Package fbapi provides a client for the Facebook API.

Index

Constants

This section is empty.

Variables

View Source
var DateFormat = ParamDateFormat(`Y-m-d\TH:i:s\Z`)

Sets the RFC 3339 format that Go expects when unmarshalling time.Time JSON values.

Functions

func ParamValues

func ParamValues(params ...Param) (v url.Values, err error)

ParamValues builds url.Values from the given Params.

func UnmarshalResponse

func UnmarshalResponse(res *http.Response, result interface{}) error

UnmarshalResponse will unmarshal a http.Response from a Facebook API request into result, possibly returning an error if the process fails or if the API returned an error.

Types

type Client

type Client struct {
	// The underlying http.RoundTripper to perform the individual requests. When
	// nil http.DefaultTransport will be used.
	Transport http.RoundTripper `inject:""`

	// The base URL to parse relative URLs off. If you pass absolute URLs to Client
	// functions they are used as-is. When nil https://graph.facebook.com/ will
	// be used.
	BaseURL *url.URL
}

Client for the Facebook API.

func (*Client) Do

func (c *Client) Do(req *http.Request, result interface{}) (*http.Response, error)

Do performs a Graph API request and unmarshal it's response. If the response is an error, it will be returned as an error, else it will be unmarshalled into the result.

type Error

type Error struct {
	// These are provided by the Facebook API and may not always be available.
	Message string `json:"message"`
	Type    string `json:"type"`
	Code    int    `json:"code"`
}

An Error from the API.

func (*Error) Error

func (e *Error) Error() string

type Param

type Param interface {
	Set(v url.Values) error
}

Param augment given url.Values.

func ParamAccessToken

func ParamAccessToken(token string) Param

ParamAccessToken specifies the access_token parameter.

func ParamDateFormat

func ParamDateFormat(format string) Param

ParamDateFormat specifies the date_format parameter.

func ParamFields

func ParamFields(fields ...string) Param

ParamFields specifies the fields to include.

func ParamLimit

func ParamLimit(limit uint64) Param

ParamLimit specifies a limit. Note, 0 values are also sent.

func ParamOffset

func ParamOffset(offset uint64) Param

ParamOffset specifies the number of items to offset. Note, 0 values are not sent.

Directories

Path Synopsis
Package fbbatch provides a Client with single call semantics which will automatically use Facebook Graph Batch implementation under the hood.
Package fbbatch provides a Client with single call semantics which will automatically use Facebook Graph Batch implementation under the hood.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL