facebook

package
v0.0.0-...-ed9fe1d Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const LoggerKey = "speedland.net.services.facebook"

LoggerKey is a key for this package

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Link        string `json:"link,omitempty"`
	Picture     string `json:"picture,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	VideoID     string `json:"video_id,omitempty"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a API client for facebook graph API.

func NewClient

func NewClient(client *http.Client, accessToken string) *Client

NewClient returns a new facebook client

func (*Client) CreateSlideshow

func (c *Client) CreateSlideshow(ctx context.Context, id string, params *VideoParams) (string, error)

CreateSlideshow creates a slideshow video on the page specified by page id.

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, query url.Values, v interface{}) error

Get to call GET request on the given path

func (*Client) GetMe

func (c *Client) GetMe(ctx context.Context) (*Me, error)

GetMe gets the *Profile of an authorized user.

func (*Client) GetVideo

func (c *Client) GetVideo(ctx context.Context, path string, query url.Values, v interface{}) error

GetVideo to call GET request on the given path for video endpoints

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, query url.Values, content interface{}, v interface{}) error

Post to call POST request on the given path with json body specified by `content` argument.

func (*Client) PostVideo

func (c *Client) PostVideo(ctx context.Context, path string, query url.Values, content interface{}, v interface{}) error

PostVideo to call POST request on the given path with json body specified by `content` argument.

func (*Client) PublishPost

func (c *Client) PublishPost(ctx context.Context, id string, params *PagePostParams) (*PagePostResponse, error)

PublishPost publishes a page post on the page specified by page id.

func (*Client) ScrapeURL

func (c *Client) ScrapeURL(ctx context.Context, urlstr string) (*URLObject, error)

func (*Client) SetVersion

func (c *Client) SetVersion(v string)

SetVersion specifies the version used for the client.

type Me

type Me struct {
	ID string `json:"id"`
}

Me is an struct returned by /me endpoint.

type MultipartParams

type MultipartParams struct {
	ContentType string
	Body        io.Reader
}

MultipartParams is a struct to upload multipart/form data to the endpoint

type PagePostParams

type PagePostParams struct {
	Message     string `json:"message,omitempty"`
	Link        string `json:"link,omitempty"`
	ActionLinks []struct {
		Name string `json:"name,omitempty"`
		Link string `json:"link,omitempty"`
	} `json:"action_links,omitempty"`
	Place                    string        `json:"place,omitempty"`
	Tags                     string        `json:"string,omitempty"`
	ObjectAttachment         string        `json:"object_attachment,omitempty"`
	Published                *bool         `json:"published,omitempty"`
	ScheduledPublishTime     int           `json:"scheduled_publish_time,omitempty"`
	BackdatedTime            int           `json:"backdated_time,omitempty"`
	BackdatedTimeGranularity string        `json:"backdated_time_granularity,omitempty"`
	ChildAttachments         []*Attachment `json:"child_attachments,omitempty"`
	MultiShareOptimized      *bool         `json:"multi_share_optimized,omitempty"`
	MultiShareEndCard        *bool         `json:"multi_share_end_card,omitempty"`
}

type PagePostResponse

type PagePostResponse struct {
	PageID string `json:"page_id"`
	PostID string `json:"post_id"`
	Href   string `json:"href"`
}

type SlideshowSpec

type SlideshowSpec struct {
	ImagesURLs   []string `json:"images_urls"`
	DurationMs   int      `json:"duration_ms,omitempty"`
	TransitionMs int      `json:"transition_ms,omitempty"`
}

type URLObject

type URLObject struct {
	ID          string           `json:"id"`
	URL         string           `json:"url"`
	Type        string           `json:"type"`
	Title       string           `json:"title"`
	UpdatedTime *xtime.Timestamp `json:"updated_time"`
	Image       []struct {
		URL    string `json:"url"`
		Width  int    `json:"width"`
		Height int    `json:"height"`
	} `json:"image,omitempty"`
	Pages []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
		URL  string `json:"url"`
	} `json:"pages,omitempty"`
	Application struct {
		ID   string `json:"id"`
		Name string `json:"name"`
		URL  string `json:"url"`
	} `json:"application,omitempty"`
}

URLObject is a object returned by scraping URL

type VideoParams

type VideoParams struct {
	Title                string           `json:"title,omitempty"`
	Description          string           `json:"description,omitempty"`
	FileURL              string           `json:"file_url,omitempty"`
	Published            *bool            `json:"published,omitempty"`
	ScheduledPublishTime *xtime.Timestamp `json:"scheduled_publish_time,omitempty"`
	SponsorID            string           `json:"sponsor_id,omitempty"`
	SlideshowSpec        *SlideshowSpec   `json:"slideshow_spec,omitempty"`
}

func NewSlideshowParams

func NewSlideshowParams(imagesURLs []string) *VideoParams

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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