0.0.7 • Published 6 years ago

tumblrinbrowser v0.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

tumblrinbrowser

npm npm Build Status Coverage Status

Due to CORS restrictions, you're going to have a really hard time using this library in the browser. Although GET endpoints on the Tumblr API support JSONP, this library is not intended for in-browser use. Sorry!

tumblr/tumblr.js

The unofficial JavaScript client library for both Tumblr API v2 and v1 intended for use in browser. (splitted from chooslr/chooslr-api)

Installation

cdn

npm

yarn add tumblrinbrowser

v2

import Tumblr from 'tumblrinbrowser'

const tumblr = new Tumblr({ api_key, proxy })

new Tumblr({ api_key, proxy })

Required at least one either.

.blog(name)

result: Promise<Blog>

.posts(name, params)

result: Promise<Post[]>

params
  • type
  • tag
  • id
  • limit
  • offset
  • reblog_info
  • notes_info
  • filter

.total(name, params)

result: Promise<number>

params
  • type
  • tag

.post(name, id, params)

result: Promise<Post>

params
  • reblog_info
  • notes_info

.samplingPosts(options) / .samplingTags(options)

result: Promise<Post[]> / Promise<Tag[]>

options
  • name
  • denom
  • maxLimit
  • params

.generatePosts(options)

const supply = await tumblr.generatePosts({ name })
const { done, value: posts } = await supply()
const { done, value: posts } = await supply()

result: Promise<SupplyFn> (tiloop's)

options
  • name
  • random
  • params

modules

import * as v2 from 'tumblrinbrowser'

const url = v2.avatar(name[, size])

const blog = await v2.blog({ api_key, proxy, name })
const posts = await v2.posts({ api_key, proxy, name, params })
const total = await v2.total({ api_key, proxy, name, params })
const post = await v2.post({ api_key, proxy, name, id, params })

const posts = await v2.samplingPosts({ api_key, proxy, name, denom, maxLimit, params })
const tags = await v2.samplingTags({ api_key, proxy, name, denom, maxLimit, params })

const supply = await v2.generatePosts({ api_key, proxy, name, random, params })

v1

import * as v1 from 'tumblrinbrowser/v1'

const blog = await v1.blog(name[, timeout])
const posts = await v1.posts(name[, params, timeout])
const total = await v1.total(name[, params, timeout])
const post = await v1.post(name, id[, params, timeout])
const posts = await v1.search(name, word[, page, timeout])

const posts = await v1.samplingPosts({ name, params, denom, maxLimit, timeout })
const tags = await v1.samplingTags({ name, params, denom, maxLimit, timeout })

const supply = await v1.generatePosts({ name, params, random, timeout })
const supply = await v1.generateSearch({ name, word, timeout })

License

MIT (http://opensource.org/licenses/MIT)

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago