tumblr

package
v0.0.0-...-e8a6a8c Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

https://www.tumblr.com/docs/en/API/v2#blog-info

Index

Constants

View Source
const (

	//BaseURL for all API calls
	BaseURL = "https://api.tumblr.com/v2"
)

Variables

This section is empty.

Functions

func AuthorizationURL

func AuthorizationURL(callback string) (string, *oauth.Credentials, error)

AuthorizationURL generates the authorization URL for the first part of the OAuth handshake. Redirect the user to this URL. This assumes that the consumer key has already been set (using SetConsumerKey).

func GetCredentials

func GetCredentials(tempCred *oauth.Credentials, verifier string) (*oauth.Credentials, url.Values, error)

GetCredentials from Oauth provider

func SetConsumerKey

func SetConsumerKey(consumerKey string)

SetConsumerKey will set the application-specific consumer_key used in the initial OAuth process This key is listed on https://dev.twitter.com/apps/YOUR_APP_ID/show

func SetConsumerSecret

func SetConsumerSecret(consumerSecret string)

SetConsumerSecret will set the application-specific secret used in the initial OAuth process This secret is listed on https://dev.twitter.com/apps/YOUR_APP_ID/show

Types

type API

type API struct {
	Credentials *oauth.Credentials

	HTTPClient *http.Client
	// contains filtered or unexported fields
}

API wraps a session representing a access token/secret, and is the root object to call methods from

func NewAPI

func NewAPI(accessToken string, accessTokenSecret string) (api *API)

NewAPI takes an user-specific access token and secret and returns a Api struct for that user.

func (*API) Close

func (a *API) Close()

Close query queue

func (*API) DisableThrottling

func (a *API) DisableThrottling()

DisableThrottling is used to enable query throttling with the tokenbucket algorithm

func (*API) EnableThrottling

func (a *API) EnableThrottling(rate time.Duration, bufferSize int64)

EnableThrottling is used to enable query throttling with the tokenbucket algorithm

func (*API) GetBlogAvatar

func (a *API) GetBlogAvatar(baseHostname string, size int) (avatarUrl string, err error)

You can get a blog's avatar in 9 different sizes. The default size is 64x64.

func (*API) GetBlogFollowers

func (a *API) GetBlogFollowers(baseHostname string, params url.Values) (users []User, err error)

Retrieve a Blog's Followers

func (*API) GetBlogInfo

func (a *API) GetBlogInfo(baseHostname string) (blog Blog, err error)

This method returns general information about the blog, such as the title, number of posts, and other high-level data.

func (*API) GetBlogLikes

func (a *API) GetBlogLikes(baseHostname string, params url.Values) (likedPosts []Post, likedCount int, err error)

This method can be used to retrieve the publicly exposed likes from a blog.

func (*API) GetBlogPosts

func (a *API) GetBlogPosts(baseHostname string, params url.Values) (blogs []Blog, posts []Post, totalPosts int, err error)

Retrieve Published Posts

func (*API) GetBlogPostsDraft

func (a *API) GetBlogPostsDraft(baseHostname string, params url.Values) (blogs []Blog, posts []Post, err error)

func (*API) GetBlogPostsQueue

func (a *API) GetBlogPostsQueue(baseHostname string, params url.Values) (blogs []Blog, posts []Post, err error)

Retrieve Queued Posts

func (*API) GetBlogPostsSubmission

func (a *API) GetBlogPostsSubmission(baseHostname string, params url.Values) (blogs []Blog, posts []Post, err error)

func (*API) GetDelay

func (a *API) GetDelay() time.Duration

GetDelay retrives the delay currently set between throttled queries

func (*API) GetTagged

func (a *API) GetTagged(tag string, params url.Values) (posts []Post, err error)

Get posts with tag

func (*API) GetUserDashboard

func (a *API) GetUserDashboard() (posts []Post, err error)

Use this method to retrieve the dashboard that matches the OAuth credentials submitted with the request.

func (*API) GetUserFollowing

func (a *API) GetUserFollowing(params url.Values) (totalBlogs int, blogs []Blog, err error)

Use this method to retrieve the blogs followed by the user whose OAuth credentials are submitted with the request.

func (*API) GetUserInfo

func (a *API) GetUserInfo() (user User, err error)

Use this method to retrieve the user's account information that matches the OAuth credentials submitted with the request.

func (*API) GetUserLikes

func (a *API) GetUserLikes(params url.Values) (likedPosts []Post, likedCount int, err error)

Use this method to retrieve the liked posts that match the OAuth credentials submitted with the request.

func (*API) PostBlog

func (a *API) PostBlog(bastHostname string, params url.Values) (err error)

func (*API) PostBlogDelete

func (a *API) PostBlogDelete(baseHostname string, postID int) (err error)

func (*API) PostBlogEdit

func (a *API) PostBlogEdit(baseHostname string, postID int) (err error)

func (*API) PostBlogReblog

func (a *API) PostBlogReblog(baseHostname string, params url.Values) (err error)

func (*API) PostUserFollow

func (a *API) PostUserFollow(blogUrl string) (err error)

Follow a blog

func (*API) PostUserFollowDelete

func (a *API) PostUserFollowDelete(blogUrl string) (err error)

Unfollow a blog

func (*API) PostUserLikePost

func (a *API) PostUserLikePost(postID int, reblogKey string) (err error)

Like a post

func (*API) PostUserLikePostDelete

func (a *API) PostUserLikePostDelete(postID int, reblogKey string) (err error)

Unlike a post

func (*API) PostUserUnfollow

func (a *API) PostUserUnfollow(blogUrl string) (err error)

func (*API) PostUserUnlikePost

func (a *API) PostUserUnlikePost(postID int, reblogKey string) (err error)

Unlike a post

func (*API) ReturnRateLimitError

func (a *API) ReturnRateLimitError(b bool)

ReturnRateLimitError specifies behavior when the Twitter API returns a rate-limit error. If set to true, the query will fail and return the error instead of automatically queuing and retrying the query when the rate limit expires

func (*API) SetDelay

func (a *API) SetDelay(t time.Duration)

SetDelay will set the delay between throttled queries To turn of throttling, set it to 0 seconds

type Blog

type Blog struct {
	Title               string
	Name                string
	Posts               int
	Url                 string
	Updated             int
	Description         string
	IsNSFW              bool `json:"is_nsfw"`
	Ask                 bool
	AskPageTitle        string
	AskAnon             bool `json:"ask_anon"`
	SubmissionPageTitle string
	ShareLikes          bool
	Likes               int
}

type BodyContainer

type BodyContainer struct {
	Response ResponseContainer `json:"response"`
}

type Post

type Post struct {
}

type ResponseContainer

type ResponseContainer struct {
	Blog Blog `json:"blog"`
}

type User

type User struct {
}

Jump to

Keyboard shortcuts

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