Documentation
¶
Index ¶
- type AltSize
- type AnswerPost
- type AudioPost
- type AvatarResponse
- type BasePost
- type BlogInfo
- type BlogInfoResponse
- type ChatPost
- type CompleteResponse
- type DialogueInfo
- type DraftsResponse
- type FollowedBlog
- type FollowersResponse
- type FollowingResponse
- type LikesResponse
- type LinkPost
- type MetaInfo
- type Note
- type OwnedBlog
- type PhotoObject
- type PhotoPost
- type PlayerInfo
- type PostsResponse
- type QuotePost
- type TextPost
- type TumblrRequest
- type TumblrRestClient
- func (trc *TumblrRestClient) Avatar(blogname string, size int) AvatarResponse
- func (trc *TumblrRestClient) BlogInfo(blogname string) BlogInfoResponse
- func (trc *TumblrRestClient) BlogLikes(blogname string, options map[string]string) LikesResponse
- func (trc *TumblrRestClient) CreateAudio(blogname string, options map[string]string) error
- func (trc *TumblrRestClient) CreateChatPost(blogname string, options map[string]string) error
- func (trc *TumblrRestClient) CreateLink(blogname string, options map[string]string) error
- func (trc *TumblrRestClient) CreatePhoto(blogname string, options map[string]string) error
- func (trc *TumblrRestClient) CreateQuote(blogname string, options map[string]string) error
- func (trc *TumblrRestClient) CreateText(blogname string, options map[string]string) error
- func (trc *TumblrRestClient) CreateVideo(blogname string, options map[string]string) error
- func (trc *TumblrRestClient) Dashboard(options map[string]string) DraftsResponse
- func (trc *TumblrRestClient) DeletePost(blogname, id string) error
- func (trc *TumblrRestClient) Drafts(blogname string, options map[string]string) DraftsResponse
- func (trc *TumblrRestClient) EditPost(blogname string, options map[string]string) error
- func (trc *TumblrRestClient) Follow(blogname string) error
- func (trc *TumblrRestClient) Followers(blogname string, options map[string]string) FollowersResponse
- func (trc *TumblrRestClient) Following(options map[string]string) FollowingResponse
- func (trc *TumblrRestClient) Info() UserInfoResponse
- func (trc *TumblrRestClient) Like(id, reblogKey string) error
- func (trc *TumblrRestClient) Likes(options map[string]string) LikesResponse
- func (trc *TumblrRestClient) Posts(blogname, postsType string, options map[string]string) PostsResponse
- func (trc *TumblrRestClient) Queue(blogname string, options map[string]string) DraftsResponse
- func (trc *TumblrRestClient) Reblog(blogname string, options map[string]string) error
- func (trc *TumblrRestClient) Submission(blogname string, options map[string]string) DraftsResponse
- func (trc *TumblrRestClient) Tagged(tag string, options map[string]string) []json.RawMessage
- func (trc *TumblrRestClient) Unfollow(blogname string) error
- func (trc *TumblrRestClient) Unlike(id, reblogKey string) error
- type User
- type UserInfo
- type UserInfoResponse
- type VideoPost
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnswerPost ¶
type AvatarResponse ¶
type AvatarResponse struct {
Avatar_url string
}
type BasePost ¶
type BasePost struct { Blog_name string Id int64 Post_url string PostType string `json:"type"` Timestamp int64 Date string Format string Reblog_key string Tags []string Bookmarklet bool Mobile bool Source_url string Source_title string Liked bool State string Total_Posts int64 Note_count int64 Notes []Note }
type BlogInfoResponse ¶
type BlogInfoResponse struct {
Blog BlogInfo
}
type ChatPost ¶
type ChatPost struct { BasePost Title, Body string Dialogue []DialogueInfo }
type CompleteResponse ¶
type CompleteResponse struct { Meta MetaInfo Response json.RawMessage }
type DialogueInfo ¶
type DialogueInfo struct {
Name, Label, Phrase string
}
type DraftsResponse ¶
type DraftsResponse struct {
Posts []json.RawMessage
}
type FollowedBlog ¶
type FollowersResponse ¶
type FollowingResponse ¶
type FollowingResponse struct { Total_blogs int64 Blogs []FollowedBlog }
type LikesResponse ¶
type LikesResponse struct { Liked_posts []json.RawMessage Liked_count int64 }
type PhotoObject ¶
type PhotoPost ¶
type PhotoPost struct { BasePost Photos []PhotoObject Caption string Width, Height int64 }
type PlayerInfo ¶
type PostsResponse ¶
type PostsResponse struct { Blog BlogInfo Posts []json.RawMessage Total_posts int64 }
type TumblrRequest ¶
type TumblrRequest struct {
// contains filtered or unexported fields
}
Make queries to the Tumblr API through TumblrRequest.
func NewTumblrRequest ¶
func NewTumblrRequest(consumerKey, consumerSecret, oauthToken, oauthSecret, callbackUrl, host string) *TumblrRequest
Initializes the TumblrRequest. consumerKey is the consumer key of your Tumblr Application. consumerSecret is the consumer secret of your Tumblr Application. callbackUrl is the callback URL of your Tumblr Application. oauthToken is the user specific token, received from the /access_token endpoint. oauthSecret is the user specific secret, received from the /access_token endpoint. host is the host that you are tryng to send information to (e.g. http://api.tumblr.com).
func (*TumblrRequest) Get ¶
func (tr *TumblrRequest) Get(requestUrl string, params map[string]string) CompleteResponse
Make a GET request to the API with properly formatted parameters. requestUrl: the url you are making the request to. params: the parameters needed for the request.
func (*TumblrRequest) JSONParse ¶
func (tr *TumblrRequest) JSONParse(content []byte) CompleteResponse
Parse JSON response. content: the content returned from the web request to be parsed as JSON.
func (*TumblrRequest) Post ¶
func (tr *TumblrRequest) Post(requestUrl string, params map[string]string) CompleteResponse
Makes a POST request to the API, allows for multipart data uploads. requestUrl: the url you are making the request to. params: all the parameters needed for the request.
type TumblrRestClient ¶
type TumblrRestClient struct {
// contains filtered or unexported fields
}
defines a Go Client for the Tumblr API.
func NewTumblrRestClient ¶
func NewTumblrRestClient(consumerKey, consumerSecret, oauthToken, oauthSecret, callbackUrl, host string) *TumblrRestClient
Initializes the TumblrRestClient, creating TumblrRequest that deals with all request formatting. consumerKey is the consumer key of your Tumblr Application. consumerSecret is the consumer secret of your Tumblr Application. oauthToken is the user specific token, received from the /access_token endpoint. oauthSecret is the user specific secret, received from the /access_token endpoint. host is the host that you are tryng to send information to (e.g. http://api.tumblr.com).
func (*TumblrRestClient) Avatar ¶
func (trc *TumblrRestClient) Avatar(blogname string, size int) AvatarResponse
Retrieves the url of the blog's avatar. size can be: 16, 24, 30, 40, 48, 64, 96, 128 or 512.
func (*TumblrRestClient) BlogInfo ¶
func (trc *TumblrRestClient) BlogInfo(blogname string) BlogInfoResponse
Gets general information about the blog. blogname: name of the blog you want to get information about(e.g. mgterzieva.tumblr.com).
func (*TumblrRestClient) BlogLikes ¶
func (trc *TumblrRestClient) BlogLikes(blogname string, options map[string]string) LikesResponse
Gets the likes of blog given. blogname: name of the blog whose likes you want to get. options can be: limit: how many likes do you want to get; offset: the number of the like you want to start from.
func (*TumblrRestClient) CreateAudio ¶
func (trc *TumblrRestClient) CreateAudio(blogname string, options map[string]string) error
Create an audio post on a blog. blogname: the url of the blog you want to post to. options can be: (with * are marked required options) state: the state of the post(e.g. published, draft, queue, private); tags: a list of tags you want applied to the post; tweet: manages the autotweet for this post: set to off for no tweet or enter text to override the default tweet; date: the GMT date and time of the post as a string; format: sets the format type of the post(html or markdown); slug: add a short text summary to the end of the post url; caption: the caption of the post; *external_url: the url of the site that hosts the audio file.
func (*TumblrRestClient) CreateChatPost ¶
func (trc *TumblrRestClient) CreateChatPost(blogname string, options map[string]string) error
Create a chat post on a blog. blogname: the url of the blog you want to post to. options can be: (with * are marked required options) state: the state of the post(e.g. published, draft, queue, private); tags: a list of tags you want applied to the post; tweet: manages the autotweet for this post: set to off for no tweet or enter text to override the default tweet; date: the GMT date and time of the post as a string; format: sets the format type of the post(html or markdown); slug: add a short text summary to the end of the post url; title: the title of the chat; *conversation: the text of the conversation/chat, with dialogue labels.
func (*TumblrRestClient) CreateLink ¶
func (trc *TumblrRestClient) CreateLink(blogname string, options map[string]string) error
Create a link post on a blog. blogname: the url of the blog you want to post to. options can be: (with * are marked required options) state: the state of the post(e.g. published, draft, queue, private); tags: a list of tags you want applied to the post; tweet: manages the autotweet for this post: set to off for no tweet or enter text to override the default tweet; date: the GMT date and time of the post as a string; format: sets the format type of the post(html or markdown); slug: add a short text summary to the end of the post url; title: the title of the page the link points to; *url: the link you are posting; description: the description of the link you are posting.
func (*TumblrRestClient) CreatePhoto ¶
func (trc *TumblrRestClient) CreatePhoto(blogname string, options map[string]string) error
Create a photo post or photoset on a blog. blogname: the url of the blog you want to post to. options can be: (with * are marked required options) state: the state of the post(e.g. published, draft, queue, private); tags: a list of tags you want applied to the post; tweet: manages the autotweet for this post: set to off for no tweet or enter text to override the default tweet; date: the GMT date and time of the post as a string; format: sets the format type of the post(html or markdown); slug: add a short text summary to the end of the post url; caption: the caption that you want applied to the photo; link: the 'click-through' url for the photo; *source: the photo source url.
func (*TumblrRestClient) CreateQuote ¶
func (trc *TumblrRestClient) CreateQuote(blogname string, options map[string]string) error
Create a quote post on a blog. blogname: the url of the blog you want to post to. options can be: (with * are marked required options) state: the state of the post(e.g. published, draft, queue, private); tags: a list of tags you want applied to the post; tweet: manages the autotweet for this post: set to off for no tweet or enter text to override the default tweet; date: the GMT date and time of the post as a string; format: sets the format type of the post(html or markdown); slug: add a short text summary to the end of the post url; *quote: the full text of the quote; source: the cited source of the quote.
func (*TumblrRestClient) CreateText ¶
func (trc *TumblrRestClient) CreateText(blogname string, options map[string]string) error
Create a text post on a blog. blogname: the url of the blog you want to post to. options can be: (with * are marked required options) state: the state of the post(e.g. published, draft, queue, private); tags: a list of tags you want applied to the post; tweet: manages the autotweet for this post: set to off for no tweet or enter text to override the default tweet; date: the GMT date and time of the post as a string; format: sets the format type of the post(html or markdown); slug: add a short text summary to the end of the post url; title: the optional title of the post; *body: the full text body.
func (*TumblrRestClient) CreateVideo ¶
func (trc *TumblrRestClient) CreateVideo(blogname string, options map[string]string) error
Create a video post on a blog. blogname: the url of the blog you want to post to. options can be: (with * are marked required options) state: the state of the post(e.g. published, draft, queue, private); tags: a list of tags you want applied to the post; tweet: manages the autotweet for this post: set to off for no tweet or enter text to override the default tweet; date: the GMT date and time of the post as a string; format: sets the format type of the post(html or markdown); slug: add a short text summary to the end of the post url; caption: the caption for the post; *embed: the html embed code for the video.
func (*TumblrRestClient) Dashboard ¶
func (trc *TumblrRestClient) Dashboard(options map[string]string) DraftsResponse
Gets the dashboard of the user. options can be: limit: number of results to return; offset: post number to start at; type: the type of posts to return(text, photo, quote, link, chat, audio, video, answer); since_id: return posts that have apeared after this id; reblog_info: whether to return reblog information about the posts; notes_info: whether to return notes information about the posts.
func (*TumblrRestClient) DeletePost ¶
func (trc *TumblrRestClient) DeletePost(blogname, id string) error
Deletes a post with a given id. blogname: the url of the blog you want to delete from. id: the id of the post you want to delete.
func (*TumblrRestClient) Drafts ¶
func (trc *TumblrRestClient) Drafts(blogname string, options map[string]string) DraftsResponse
Gets posts that are currently in the blog's drafts. options can be: filter: specify posts' format(e.g. format="html", format="text", format="raw").
func (*TumblrRestClient) EditPost ¶
func (trc *TumblrRestClient) EditPost(blogname string, options map[string]string) error
Edits a post with a given id. blogname: the url of the blog you want to post to. options can be: (with * are marked required options) tags: a list of tags you want applied to the post; tweet: manages the autotweet for this post: set to off for no tweet or enter text to override the default tweet; date: the GMT date and time of the post as a string; format: sets the format type of the post(html or markdown); slug: add a short text summary to the end of the post url; *id: the id of the post. The other options are specific to the type of post you want to edit.
func (*TumblrRestClient) Follow ¶
func (trc *TumblrRestClient) Follow(blogname string) error
Follow the url of a given blog. blogname: the url of the blog to follow.
func (*TumblrRestClient) Followers ¶
func (trc *TumblrRestClient) Followers(blogname string, options map[string]string) FollowersResponse
Gets the followers of the blog given. blogname: name of the blog whose followers you want to get. optons can be: limit: the number of results to return, inclusive; offset: result to start at.
func (*TumblrRestClient) Following ¶
func (trc *TumblrRestClient) Following(options map[string]string) FollowingResponse
Gets the blogs that the user is following. options can be: limit: the number of results to return; offset: result number to start at.
func (*TumblrRestClient) Info ¶
func (trc *TumblrRestClient) Info() UserInfoResponse
Gets the user information.
func (*TumblrRestClient) Like ¶
func (trc *TumblrRestClient) Like(id, reblogKey string) error
Like post of a given blog. id: the id of the post you want to like. reblog_key: the reblog key for the post id.
func (*TumblrRestClient) Likes ¶
func (trc *TumblrRestClient) Likes(options map[string]string) LikesResponse
Gets the likes of the given user. options can be: limit: the number of results to return, inclusive; offset: liked post number to start at.
func (*TumblrRestClient) Posts ¶
func (trc *TumblrRestClient) Posts(blogname, postsType string, options map[string]string) PostsResponse
Gets a list of posts from a blog. blogname: the name of the blog you want to get posts from (e.g. mgterzieva.tumblr.com). postsType: the type of the posts you want to get (e.g. text, quote, link, answer, video, audio, photo, chat, all). options can be: id: the id of the post you are looking for; tag: return only posts with this tag; limit: the number of posts to return; offset: the number of the post you want to start from; filter: return only posts with a specific format(e.g. html, text, raw).
func (*TumblrRestClient) Queue ¶
func (trc *TumblrRestClient) Queue(blogname string, options map[string]string) DraftsResponse
Gets posts that are currently in the blog's queue. options can be: limit: the number of results to return; offset: post number to start at; filter: specify posts' format(e.g. format="html", format="text", format="raw").
func (*TumblrRestClient) Reblog ¶
func (trc *TumblrRestClient) Reblog(blogname string, options map[string]string) error
Creates a reblog on the given blog. blogname: the url of the blog you want to reblog to. options should be: (with * are marked required options) *id: the id of the reblogged post; *reblog_key: the reblog key of the rebloged post.
func (*TumblrRestClient) Submission ¶
func (trc *TumblrRestClient) Submission(blogname string, options map[string]string) DraftsResponse
Retrieve submission posts. options can be: offset: post number to start at; filter: specify posts' format(e.g. format="html", format="text", format="raw").
func (*TumblrRestClient) Tagged ¶
func (trc *TumblrRestClient) Tagged(tag string, options map[string]string) []json.RawMessage
Gets a list of posts with the given tag. tag: the tag you want to look for. options can be: before: the timestamp of when you'd like to see posts before; limit: the number of results to return; filter: the post format you want to get(e.g html, text, raw).
func (*TumblrRestClient) Unfollow ¶
func (trc *TumblrRestClient) Unfollow(blogname string) error
Unfollow the url of a given blog. blogname: the url of the blog to unfollow.
func (*TumblrRestClient) Unlike ¶
func (trc *TumblrRestClient) Unlike(id, reblogKey string) error
Unlike a post of a given blog. id: the id of the post you want to unlike. reblog_key: the reblog key for the post id.
type UserInfoResponse ¶
type UserInfoResponse struct {
User UserInfo
}
type VideoPost ¶
type VideoPost struct { BasePost Caption string Player []PlayerInfo }