fblib

package module
v0.0.0-...-c531251 Latest Latest
Warning

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

Go to latest
Published: May 9, 2013 License: Apache-2.0 Imports: 11 Imported by: 1

README

fblib

A simple Facebook library.

Installing

Best way to isntall this package is by running goinstall:

go get github.com/robteix/fblib

And then you can import it in your code like this:

import (
	...
	"github.com/robteix/fblib"
	...
)

License

Copyright (c) 2011, Roberto Teixeira r@robteix.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOAuth = errors.New("OAuth authorization failure")
)
View Source
var (
	UserNotConnectedError = errors.New("User Not Connected")
)

Functions

This section is empty.

Types

type FacebookClient

type FacebookClient struct {
	APIKey      string
	AppSecret   string
	AccessToken string
	Transport   http.RoundTripper
}

func NewFacebookClient

func NewFacebookClient(key, secret string) *FacebookClient

func (*FacebookClient) AuthURL

func (fc *FacebookClient) AuthURL(redirectURI, scope string) string

func (*FacebookClient) Call

func (fc *FacebookClient) Call(httpMethod, endpoint string, params url.Values) ([]byte, error)

Performs API call based on httpMethod returns the response body as string and error/nil

func (*FacebookClient) CurrentUser

func (fc *FacebookClient) CurrentUser() (*User, error)

func (*FacebookClient) GetUser

func (fc *FacebookClient) GetUser(id string) (*User, error)

func (*FacebookClient) PostCall

func (fc *FacebookClient) PostCall(endpoint, header string, body []byte) ([]byte, error)

Performs POST-based API call with a prepared body. Returns the response body as string and error/nil

func (fc *FacebookClient) PostLink(link Link) error

func (*FacebookClient) PostPhoto

func (fc *FacebookClient) PostPhoto(photo Photo) error

func (*FacebookClient) PostStatus

func (fc *FacebookClient) PostStatus(message string) error

func (*FacebookClient) RequestAccessToken

func (fc *FacebookClient) RequestAccessToken(code, redirectURI string) error

func (*FacebookClient) User

func (fc *FacebookClient) User(id string) (*User, error)
type Link struct {
	Text  string // Additional text added to the post
	Image string // URL for the Image to be used
	Url   string // URL to be shared
}

Link represents a link to be posted

type ObjectRef

type ObjectRef struct {
	Id   string
	Name string
}

This type is used by various facebook objects to represent a user ID. The reason for having both Id and Name is to avoid ambiguity in cases where a user name is a valid Id

type Photo

type Photo struct {
	Source   []byte // the photo data to be uploaded
	FileName string // name of the photo file to be uploaded (e.g. "photo.png")
	Message  string // some descriptive text
}

Photo represents a photo resource to be shared

type TempToken

type TempToken struct {
	Token  string
	Secret string
}

type User

type User struct {
	Id             string
	Name           string
	First_name     string
	Middle_name    string
	Last_name      string
	Gender         string
	Locale         string
	Languages      []ObjectRef
	Link           string
	Username       string
	Third_party_id string
	Timezone       int64
	Update_time    string
	Verified       bool
	Bio            string
	Birthday       string // MM/DD/YYYY
	//Education ODO
	Email               string
	Hometown            string
	Interested_in       []string
	Location            ObjectRef
	Political           string
	Favorite_athletes   []ObjectRef
	Quotes              string
	Relationship_status string
	Religion            string
	Significant_other   ObjectRef
	// Video_upload_limits
	Website string

	Client *FacebookClient
}

User object. See http://developers.facebook.com/docs/reference/api/user/

func NewUser

func NewUser(Id string, fc *FacebookClient) *User

Useful if all you want is to have an Id to perform actions This prevents having to query a user object from FB.

func (user *User) PostLink(link, message string) error

func (*User) PostStatus

func (user *User) PostStatus(message string) error

Jump to

Keyboard shortcuts

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