Documentation ¶
Index ¶
- Variables
- func DeletePost(client ClientInterface, name string, postId uint64) error
- func EditPost(client ClientInterface, blogName string, postId uint64, params url.Values) error
- func Follow(client ClientInterface, blogName string) error
- func GetAvatar(client ClientInterface, name string) (string, error)
- func LikePost(client ClientInterface, postId uint64, reblogKey string) error
- func Unfollow(client ClientInterface, blogName string) error
- func UnlikePost(client ClientInterface, postId uint64, reblogKey string) error
- type AnswerPost
- type AudioPost
- type Blog
- type BlogRef
- func (b *BlogRef) CreatePost(params url.Values) (*PostRef, error)
- func (b *BlogRef) Follow() error
- func (b *BlogRef) GetAvatar() (string, error)
- func (b *BlogRef) GetDrafts(params url.Values) (*Posts, error)
- func (b *BlogRef) GetFollowers() (*FollowerList, error)
- func (b *BlogRef) GetInfo() (*Blog, error)
- func (b *BlogRef) GetPosts(params url.Values) (*Posts, error)
- func (b *BlogRef) GetQueue(params url.Values) (*Posts, error)
- func (b *BlogRef) ReblogPost(p *PostRef, params url.Values) (*PostRef, error)
- func (b *BlogRef) Unfollow() error
- type ChatPost
- type ClientInterface
- type Dashboard
- type Follower
- type FollowerList
- type FollowingList
- type Likes
- type LinkPost
- type MiniPost
- type Photo
- type PhotoPost
- type PhotoSize
- type Post
- type PostInterface
- type PostRef
- func CreatePost(client ClientInterface, name string, params url.Values) (*PostRef, error)
- func NewPostRef(client ClientInterface, post *MiniPost) *PostRef
- func NewPostRefById(client ClientInterface, id uint64) *PostRef
- func ReblogPost(client ClientInterface, blogName string, postId uint64, reblogKey string, ...) (*PostRef, error)
- type Posts
- func GetDrafts(client ClientInterface, name string, params url.Values) (*Posts, error)
- func GetPosts(client ClientInterface, name string, params url.Values) (*Posts, error)
- func GetQueue(client ClientInterface, name string, params url.Values) (*Posts, error)
- func GetSubmissions(client ClientInterface, name string, params url.Values) (*Posts, error)
- type QuotePost
- type ReblogTrailItem
- type Response
- type SearchResults
- type ShortBlog
- type TextPost
- type User
- type VideoPost
Constants ¶
This section is empty.
Variables ¶
var MixedPaginationMethodsError error = errors.New("Cannot mix pagination between SinceId and Offset")
Error generated when a Dashboard result set it attempting to change pagination methods
var NoNextPageError error = errors.New("No next page.")
Error returned for a collection's Next() invocation if no next page is possible
var NoPrevPageError error = errors.New("No prev page.")
Error returned for a collection's Prev() invocation if no previous page is possible
Functions ¶
func DeletePost ¶
func DeletePost(client ClientInterface, name string, postId uint64) error
Delete a given blog's post by ID, nil if successful, error on failure
func GetAvatar ¶
func GetAvatar(client ClientInterface, name string) (string, error)
Retrieve Blog's Avatar URI
func LikePost ¶
func LikePost(client ClientInterface, postId uint64, reblogKey string) error
Like a post on behalf of a user
func UnlikePost ¶
func UnlikePost(client ClientInterface, postId uint64, reblogKey string) error
Unlike a post on behalf of a user
Types ¶
type AnswerPost ¶
type AnswerPost struct { Post Answer string `json:"answer"` AskingName string `json:"asking_name"` AskingUrl string `json:"asking_url"` Publisher string `json:"publisher"` Question string `json:"question"` }
Post subtype
type AudioPost ¶
type AudioPost struct { Post AlbumArt string `json:"album_art"` Artist string `json:"artist"` AudioSourceUrl string `json:"audio_source_url"` AudioType string `json:"audio_type"` AudioUrl string `json:"audio_url"` Embed string `json:"embed"` Player string `json:"player"` Plays uint64 `json:"plays"` }
Post subtype
type Blog ¶
type Blog struct { BlogRef Url string `json:"url"` Title string `json:"title"` Posts int64 `json:"posts"` Ask bool `json:"ask"` AskAnon bool `json:"ask_anon"` AskAnonPageTitle string `json:"ask_page_title"` CanSendFanMail bool `json:"can_send_fan_mail"` CanSubmit bool `json:"can_submit"` CanSubscribe bool `json:"can_subscribe"` Description string `json:"description"` Followed bool `json:"followed"` IsBlockedFromPrimary bool `json:"is_blocked_from_primary"` IsNSFW bool `json:"is_nsfw"` SubmissionPageTitle string `json:"submission_page_title"` Subscribed bool `json:"subscribed"` TotalPosts int64 `json:"total_posts"` Updated int64 `json:"updated"` }
Tumblelog struct
func GetBlogInfo ¶
func GetBlogInfo(client ClientInterface, name string) (*Blog, error)
Retrieve information about a blog
type BlogRef ¶
type BlogRef struct { Name string `json:"name"` // contains filtered or unexported fields }
Reference to a blog which can be used to perform further blog actions
func (*BlogRef) CreatePost ¶
Creates a post on the blog represented by BlogRef
func (*BlogRef) GetFollowers ¶
func (b *BlogRef) GetFollowers() (*FollowerList, error)
Retrieves blog's followers for the given blog reference
func (*BlogRef) ReblogPost ¶
Reblogs a post to the blog represented by BlogRef
type ChatPost ¶
type ChatPost struct { Post Dialog []struct { Label string `json:"label"` Name string `json:"name"` Phrase string `json:"phrase"` } `json:"dialog"` }
Post subtype
type ClientInterface ¶
type ClientInterface interface { // Issue GET request to Tumblr API Get(endpoint string) (Response, error) // Issue GET request to Tumblr API with param values GetWithParams(endpoint string, params url.Values) (Response, error) // Issue POST request to Tumblr API Post(endpoint string) (Response, error) // Issue POST request to Tumblr API with param values PostWithParams(endpoint string, params url.Values) (Response, error) // Issue PUT request to Tumblr API Put(endpoint string) (Response, error) // Issue PUT request to Tumblr API with param values PutWithParams(endpoint string, params url.Values) (Response, error) // Issue DELETE request to Tumblr API Delete(endpoint string) (Response, error) // Issue DELETE request to Tumblr API with param values DeleteWithParams(endpoint string, params url.Values) (Response, error) }
If you wish to use your own client, simply make sure it implements this interface
type Dashboard ¶
type Dashboard struct { Posts []PostInterface `json:"posts"` // contains filtered or unexported fields }
func GetDashboard ¶
func GetDashboard(client ClientInterface, params url.Values) (*Dashboard, error)
Retreive a User's dashboard
func (*Dashboard) NextByOffset ¶
Returns the next page of a user's dashboard using the current page's offset
func (*Dashboard) NextBySinceId ¶
Returns the next page of a user's dashboard using the current page's last Post id
type Follower ¶
type Follower struct { Following bool `json:"following"` Name string `json:"name"` Updated int64 `json:"updated"` Url string `json:"url"` }
FollowerList substructure
type FollowerList ¶
type FollowerList struct { Total uint32 `json:"total_users"` Followers []Follower `json:"users"` // contains filtered or unexported fields }
Object from the lsit of followers response
func GetFollowers ¶
func GetFollowers(client ClientInterface, name string, offset, limit uint) (*FollowerList, error)
Retrieve User's followers
func (*FollowerList) Next ¶
func (f *FollowerList) Next() (*FollowerList, error)
Get next page of a user's followers
func (*FollowerList) Prev ¶
func (f *FollowerList) Prev() (*FollowerList, error)
Get previous page of a user's followers
type FollowingList ¶
type FollowingList struct { Total uint32 `json:"total_blogs"` Blogs []Blog `json:"blogs"` // contains filtered or unexported fields }
func GetFollowing ¶
func GetFollowing(client ClientInterface, offset, limit uint) (*FollowingList, error)
Retrieves the list of blogs this user follows
func (*FollowingList) Next ¶
func (f *FollowingList) Next() (*FollowingList, error)
Retrieves the next page of followers
func (*FollowingList) Prev ¶
func (f *FollowingList) Prev() (*FollowingList, error)
Retrieves the previous page of followers
type Likes ¶
type Likes struct { Posts []MiniPost `json:"liked_posts"` TotalLikes uint64 `json:"liked_count"` // contains filtered or unexported fields }
func GetLikes ¶
func GetLikes(client ClientInterface, params url.Values) (*Likes, error)
Retrieves a Users's list of Posts they have liked URL values can include:
limit (int) offset (int) before (timestamp) after (timestamp)
func (*Likes) Full ¶
func (l *Likes) Full() ([]PostInterface, error)
Return an array of full post objects (instead of the default array of MiniPosts initially created)
type LinkPost ¶
type LinkPost struct { Post Description string `json:"description"` Excerpt string `json:"excerpt"` LinkAuthor string `json:"link_author"` Title string `json:"title"` Url string `json:"url"` }
Post subtype
type MiniPost ¶
type MiniPost struct { Id uint64 `json:"id"` Type string `json:"type"` BlogName string `json:"blog_name"` ReblogKey string `json:"reblog_key"` }
The basics for what is needed in a Post
type Photo ¶
type Photo struct { AltSizes []PhotoSize `json:"alt_sizes"` Caption string `json:"caption"` OriginalSize PhotoSize `json:"original_size"` }
Photo post substructure
type PhotoPost ¶
type PhotoPost struct { Post ImagePermalink string `json:"image_permalink"` Photos []Photo `json:"photos"` }
Post subtype
type PhotoSize ¶
type PhotoSize struct { Height uint32 `json:"height"` Width uint32 `json:"width"` Url string `json:"url"` }
Photo substructure
type Post ¶
type Post struct { PostRef Body string `json:"body"` CanLike bool `json:"can_like"` CanReblog bool `json:"can_reblog"` CanReply bool `json:"can_reply"` CanSendInMessage bool `json:"can_send_in_message"` Caption string `json:"caption"` Date string `json:"date"` DisplayAvatar bool `json:"display_avatar"` Followed bool `json:"followed"` Format string `json:"format"` Highlighted []interface{} `json:"highlighted"` Liked bool `json:"liked"` NoteCount uint64 `json:"note_count"` PermalinkUrl string `json:"permalink_url"` PostUrl string `json:"post_url"` Reblog struct { Comment string `json:"comment"` TreeHTML string `json:"tree_html"` } `json:"reblog"` RecommendedColor string `json:"recommended_color"` RecommendedSource bool `json:"recommended_source"` ShortUrl string `json:"short_url"` Slug string `json:"slug"` SourceTitle string `json:"source_title"` SourceUrl string `json:"source_url"` State string `json:"state"` Summary string `json:"summary"` Tags []string `json:"tags"` Timestamp uint64 `json:"timestamp"` FeaturedTimestamp uint64 `json:"featured_timestamp,omitempty"` TrackName string `json:"track_name,omitempty"` Trail []ReblogTrailItem `json:"trail"` }
The common fields on any post, no matter what type
func (*Post) GetProperty ¶
Convenience method for easy retrieval of one-off values
type PostInterface ¶
PostInterface for use in typed structures which could contain any of the below subtypes
type PostRef ¶
type PostRef struct { MiniPost // contains filtered or unexported fields }
Starting point for performing operations on a post
func CreatePost ¶
Create a post, return the ID on success, error on failure
func NewPostRef ¶
func NewPostRef(client ClientInterface, post *MiniPost) *PostRef
Creates a PostRef with the given properties set
func NewPostRefById ¶
func NewPostRefById(client ClientInterface, id uint64) *PostRef
Creates a PostRef with the given properties set
func ReblogPost ¶
func ReblogPost(client ClientInterface, blogName string, postId uint64, reblogKey string, params url.Values) (*PostRef, error)
Reblog a given post to the given blog, returns the reblog's post id if successful, else the error
func (*PostRef) ReblogOnBlog ¶
Convenience method to allow calling post.Reblog(params)
type Posts ¶
type Posts struct { Posts []MiniPost `json:"posts"` TotalPosts int64 `json:"total_posts"` // contains filtered or unexported fields }
Representation of a list of Posts
func GetPosts ¶
Retrieve a blog's posts, in the API docs you can find how to filter by ID, type, etc
func GetSubmissions ¶
Retrieve a blog's submsisions
func (*Posts) All ¶
func (p *Posts) All() ([]PostInterface, error)
Method to retrieve fully fleshed post data from stubs and cache result
func (*Posts) Get ¶
func (p *Posts) Get(index uint) PostInterface
Method to retrieve a single Post entity at a given index; returns nil if index is out of bounds
type ReblogTrailItem ¶
type ReblogTrailItem struct { Blog Blog `json:"blog"` Content string `json:"content"` ContentRaw string `json:"content_raw"` IsCurrentItem bool `json:"is_current_item"` Post struct { // sometimes an actual int, sometimes a numeric string, always a headache Id interface{} `json:"id"` } `json:"post"` }
Post substructure
type Response ¶
type Response struct { Headers http.Header Meta map[string]interface{} `json:"meta"` Result map[string]interface{} `json:"response"` Errors map[string]interface{} `json:"errors"` // contains filtered or unexported fields }
API Response structure which we'll use to pass back to behaviors
func NewResponse ¶
Create a response object from the body bytestream and the headers structure
func (*Response) PopulateFromBody ¶
Utility function for populating the Response's fields
type SearchResults ¶
type SearchResults struct { Posts []PostInterface `json:"response"` // contains filtered or unexported fields }
func TaggedSearch ¶
func TaggedSearch(client ClientInterface, tag string, params url.Values) (*SearchResults, error)
gets page of posts
func (*SearchResults) Next ¶
func (s *SearchResults) Next() (*SearchResults, error)
returns next page of results
type ShortBlog ¶
type ShortBlog struct { BlogRef Url string `json:"url"` Title string `json:"title"` IsPrimary bool `json:"primary"` FollowerCount uint32 `json:"followers"` PostToTwitter string `json:"tweet"` PostToFacebook string `json:"facebook"` Visibility string `json:"type"` }
Subset of blog information, returned in the list of blogs belonging to a user (see: GetUserInfo)
type User ¶
type User struct { Following uint32 `json:"following"` DefaultPostFormat string `json:"default_post_format"` Name string `json:"name"` Likes uint64 `json:"likes"` Blogs []ShortBlog `json:"blogs"` }
func GetUserInfo ¶
func GetUserInfo(client ClientInterface) (*User, error)
Retrieves the current user's info (based on the client's token/secret values)
type VideoPost ¶
type VideoPost struct { Post Html5Capable bool `json:"html5_capable"` PermalinkUrl string `json:"permalink_url"` Players []struct { EmbedCode string `json:"embed_code"` Width interface{} `json:"width"` } `json:"player"` ThumbnailHeight uint32 `json:"thumbnail_height"` ThumbnailUrl string `json:"thumbnail_url"` ThumbnailWidth uint32 `json:"thumbnail_width"` Video map[string]struct { Height uint32 `json:"height"` Width uint32 `json:"width"` VideoId string `json:"video_id"` } `json:"video"` VideoType string `json:"video_type"` }
Post subtype