new TumblrClient([options])
Creates a Tumblr API client using the given options
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options
|
Object |
optional
|
client options |
↳
credentials
|
Object |
optional
|
OAuth credentials |
↳
baseUrl
|
string |
optional
|
API base URL |
↳
request
|
Object |
optional
|
library to use for making requests |
Methods
(static) blogInfo(blogIdentifier, [params], [callback]) → {Request|Promise}
Gets information about a given blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object |
optional
|
optional data sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) blogAvatar(blogIdentifier, [size], [params], [callback]) → {Request|Promise}
Gets the avatar URL for a blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
size
|
number |
optional
|
avatar size, in pixels |
params
|
Object |
optional
|
optional data sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) blogLikes(blogIdentifier, [params], [callback]) → {Request|Promise}
Gets the likes for a blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object |
optional
|
optional data sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) blogFollowers(blogIdentifier, [params], [callback]) → {Request|Promise}
Gets the followers for a blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object |
optional
|
optional data sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) blogPosts(blogIdentifier, [type], [params], [callback])
Gets a list of posts for a blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
type
|
string |
optional
|
filters returned posts to the specified type |
params
|
Object |
optional
|
optional data sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
(static) blogQueue(blogIdentifier, [params], [callback]) → {Request|Promise}
Gets the queue for a blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object |
optional
|
optional data sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) blogDrafts(blogIdentifier, [params], [callback]) → {Request|Promise}
Gets the drafts for a blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object |
optional
|
optional data sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) blogSubmissions(blogIdentifier, [params], [callback]) → {Request|Promise}
Gets the submissions for a blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object |
optional
|
optional parameters sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) userInfo([params], [callback]) → {Request|Promise}
Gets information about the authenticating user and their blogs
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params
|
Object |
optional
|
optional parameters sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) userDashboard([params], [callback]) → {Request|Promise}
Gets the dashboard posts for the authenticating user
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params
|
Object |
optional
|
optional parameters sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) userFollowing([params], [callback]) → {Request|Promise}
Gets the blogs the authenticating user follows
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params
|
Object |
optional
|
optional parameters sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) userLikes([params], [callback]) → {Request|Promise}
Gets the likes for the authenticating user
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params
|
Object |
optional
|
optional parameters sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) taggedPosts([tag], [params], [callback]) → {Request|Promise}
Gets posts tagged with the specified tag
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tag
|
string |
optional
|
tag to search for |
params
|
Object |
optional
|
optional parameters sent with the request |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) createPost(blogIdentifier, params, [callback]) → {Request|Promise}
Creates a post on the given blog.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) editPost(blogIdentifier, params, [callback]) → {Request|Promise}
Edits a given post
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) reblogPost(blogIdentifier, params, [callback]) → {Request|Promise}
Edits a given post
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) deletePost(blogIdentifier, params, [callback]) → {Request|Promise}
Edits a given post
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
↳
id
|
Object | ID of the post to delete |
|
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) followBlog(params, [callback]) → {Request|Promise}
Follows a blog as the authenticating user
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params
|
Object | parameters sent with the request |
|
↳
url
|
Object | URL of the blog to follow |
|
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) unfollowBlog(params, [callback]) → {Request|Promise}
Unfollows a blog as the authenticating user
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params
|
Object | parameters sent with the request |
|
↳
url
|
Object | URL of the blog to unfollow |
|
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) likePost(params, [callback]) → {Request|Promise}
Likes a post as the authenticating user
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params
|
Object | parameters sent with the request |
|
↳
id
|
Object | ID of the post to like |
|
↳
reblog_key
|
Object | Reblog key for the post ID |
|
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) unlikePost(params, [callback]) → {Request|Promise}
Unlikes a post as the authenticating user
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params
|
Object | parameters sent with the request |
|
↳
id
|
Object | ID of the post to unlike |
|
↳
reblog_key
|
Object | Reblog key for the post ID |
|
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) createTextPost(blogIdentifier, params, [callback]) → {Request|Promise}
Creates a text post on the given blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
↳
title
|
string |
optional
|
post title text |
↳
body
|
string | post body text |
|
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) createPhotoPost(blogIdentifier, params, [callback]) → {Request|Promise}
Creates a photo post on the given blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
↳
source
|
string | image source URL |
|
↳
data
|
Stream | Array | an image or array of images |
|
↳
data64
|
string | base64-encoded image data |
|
↳
caption
|
string |
optional
|
post caption text |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) createQuotePost(blogIdentifier, params, [callback]) → {Request|Promise}
Creates a quote post on the given blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
↳
quote
|
string | quote text |
|
↳
source
|
string |
optional
|
quote source |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) createLinkPost(blogIdentifier, params, [callback]) → {Request|Promise}
Creates a link post on the given blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
↳
title
|
string |
optional
|
post title text |
↳
url
|
string | the link URL |
|
↳
thumbnail
|
string |
optional
|
the URL of an image to use as the thumbnail |
↳
excerpt
|
string |
optional
|
an excerpt from the page the link points to |
↳
author
|
string |
optional
|
the name of the author of the page the link points to |
↳
description
|
string |
optional
|
post caption text |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) createChatPost(blogIdentifier, params, [callback]) → {Request|Promise}
Creates a chat post on the given blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
↳
title
|
string |
optional
|
post title text |
↳
conversation
|
string | chat text |
|
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) createAudioPost(blogIdentifier, params, [callback]) → {Request|Promise}
Creates an audio post on the given blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
↳
external_url
|
string | image source URL |
|
↳
data
|
Stream | an audio file |
|
↳
caption
|
string |
optional
|
post caption text |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
(static) createVideoPost(blogIdentifier, params, [callback]) → {Request|Promise}
Creates a video post on the given blog
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
blogIdentifier
|
string | blog name or URL |
|
params
|
Object | parameters sent with the request |
|
↳
embed
|
string | embed code or a video URL |
|
↳
data
|
Stream | a video file |
|
↳
caption
|
string |
optional
|
post caption text |
callback
|
TumblrClient~callback |
optional
|
invoked when the request completes |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
getRequest(apiPath, params, [callback]) → {Request|Promise}
Performs a GET request
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiPath
|
string | URL path for the request |
|
params
|
Object | query parameters |
|
callback
|
TumblrClient~callback |
optional
|
request callback |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
postRequest(apiPath, params, [callback]) → {Request|Promise}
Performs a POST request
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
apiPath
|
string | URL path for the request |
|
params
|
Object | form parameters |
|
callback
|
TumblrClient~callback |
optional
|
request callback |
Returns:
Request object, or Promise if returnPromises
was used
- Type
- Request | Promise
returnPromises()
Sets the client to return Promises instead of Request objects by patching the getRequest
and
postRequest
methods on the client
addGetMethods(methods)
Adds GET methods to the client
Parameters:
Name | Type | Description |
---|---|---|
methods
|
Object | mapping of method names to endpoints |
addPostMethods(methods)
Adds POST methods to the client
Parameters:
Name | Type | Description |
---|---|---|
methods
|
Object | mapping of method names to endpoints |
Type Definitions
callback(errnullable, respnullable, [response]nullable)
Handles the response from a client reuest
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err
|
Error |
nullable
|
error message |
resp
|
Object |
nullable
|
response body |
response
|
string |
optional
nullable
|
raw response |