Giter Club home page Giter Club logo

typeble's Introduction

Typeble

GitHub Workflow Status codecov GitHub GitHub search hit counter

Typeble is an unofficial Tumblr API library written entirely in typescript to fill the gap left by the official Tumblr JS lib that doesn't supply type information nor seems to support the OAuth2 standard. It's still heavily WIP, but many of the important endpoints of the API are covered.

⚠️ Notice ⚠️

This library is NOT official, endorsed, sponsored by, or otherwise associated with Tumblr in any way, shape, or form.

It was built using the API reference documents, and like any other project built using the API (including those made using this library) should conform to the Tumblr Application Developer and API License Agreement. Be sure you also follow it.

How to use

  1. Install the package into your project with NPM with the command npm install typeble
  2. Import the functions you need for your project as you would any library, documentation here
  3. Obtain an OAuth 2 token for tumblr using my tumblr authentication library or some other method
  4. DON'T SHARE THE TOKEN WITH ANYONE! It will expire (unless it has the offline_access scope) but someone could do damage to your account if they get access to the token
  5. Pass the token as the first argument to any of the functions

Contributing

First and foremost, once again, make sure to honour the Tumblr Application Developer and API License Agreement. Don't try to bypass any rate limits, and make sure that this project isn't in any way percievable as officially endorsed by Tumblr.

Code that is not documented, is poorly documented, or is "hacky" in some way, especially parts close to the API, will likely not be added to the codebase. Code that isn't at least somewhat covered by unit tests is heavily discouraged.

Testing (Local)

Create a .env file with the following contents (You can also just set them as environment variables, but afaik that's less secure):

CONSUMER_ID=[your Tumblr OAuth App ID here]
CONSUMER_SECRET=[your Tumblr OAuth App secret here]

Then run npm test. A browser window will open up a Tumblr authentication page, asking you to approve the scopes. REMEMBER THAT THE TESTS WILL BE RUN USING WHATEVER ACCOUNT YOU ARE LOGGED INTO! Create a bot account if you need to.

Testing (Github)

Truth be told, CI (tests) will likely only run on master as there is a chance of destructive actions being taken using the bot used for testing. If you want to run CI on your own fork, be sure to set the following github secrets:

  • SECRETS_ACCESS_TOKEN: A github PAT (can be fine-grained) with write access to your fork's secrets (used to update the refresh token)
  • TUMBLR_CLIENT_ID: The client ID from your Tumblr OAuth App (Can just be a normal environment variable, but oh well)
  • TUMBLR_CLIENT_SECRET: The client secret from your Tumblr OAuth App
  • TUMBLR_REFRESH_TOKEN: A refresh token from a successful login to a Tumblr OAuth App with the offline_access scope, you can use my tumblr authentication library from the command line with the scope parameter set to include offline_access and the json option set to get the full response (which includes the refresh token). REMEMBER THAT THE RUN USING WHATEVER ACCOUNT YOU ARE LOGGED INTO! You really want to use a bot account for this, since if you accidentally merge malicious code, it could run on your main account.

Roadmap

Other Resources

typeble's People

Contributors

marksuckerberg avatar

Stargazers

 avatar

Watchers

 avatar  avatar

typeble's Issues

Tests

  • Find a way to make OAuth work without someone signing in
  • Make test for each endpoint
  • Hopefully don't upset Tumblr

Remaining Endpoints

Blog methods

  • GET /avatar
  • GET /likes
  • GET /followed_by
  • GET /posts
  • GET /posts/queue
  • GET /posts/queue/reorder
  • GET /posts/queue/shuffle
  • GET /posts/draft
  • GET /posts/submission
  • GET /notifications
  • POST /posts (Reblog)
  • GET /notes

User methods

  • GET /user/limits
  • GET /user/dashboard
  • GET /user/likes
  • POST /user/follow
  • POST /user/unfollow
  • POST /user/like
  • POST /user/unlike
  • GET/POST/DELETE /user/filtered_tags
  • GET/POST/DELETE /user/filtered_content

Other

  • GET /tagged

Important Endpoints

Endpoints that most people will probably use the most frequently

  • /blog/posts - Create
  • /blog/posts - Retrieve
  • /blog/posts - Edit
  • /blog/info
  • /blog/blocks - Block
  • /blog/following
  • /blog/followers
  • /post/delete
  • /user/info
  • /user/following

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.