Coder Social home page Coder Social logo

blastify's Introduction

...

Blastify

Modern ES6 Promise based API client for BlastHack

Warning โš : Package not ready for use in production mode, check out what's left to do below. As soon as the package is ready, it will be available in NPM

Todo

  • Session
  • Auth
  • BlastHack API Methods
  • MessageBuilder
๐Ÿ“– Documentation

Version Version WakaTime Stats

Install ๐Ÿ“ฆ

# using npm
npm i blastify
# using yarn
yarn add blastify
# using pnpm
pnpm add blastify

Usage ๐Ÿ”ง

Check all available methods in ๐Ÿ“– Documentation.

import { BlastHack, Auth } from 'blastify'; // ESM
// OR
const { BlastHack, Auth } = require('blastify'); // CommonJS

// Create BlastHack client, without auth
const blasthack = new BlastHack();

// Find user by nickname
blasthack.findUser('neverlane')
  // Get user profile wall by id
  .then((user) => blasthack.getWall(user.id))
  .then((wall) => console.log(wall.posts))
  .catch((error) => console.log(error));

// With auth
const neverlaneAccount = new Auth({
  login: 'neverlane',
  password: 'someverystrongpassword',
  // if using 2FA Auth
  async onTwoFactor(payload, changeProvider, retry) {
    if (payload.type !== 'totp')
      return changeProvider('totp');
    const code = await magicFunctionThatGenerateCodeByUsername(payload.login);
    retry(code);
  }
});

neverlaneAccount.auth()
  .then(async (session) => {
    const blasthack = new BlastHack(session);
    await blasthack.sendMessageInProfile(blasthack.userId, 'hello from blastify');
  })
  .catch((error) => console.error(error));

Warning โš 

Since blast.hk (that using XenForo as engine for forum ) does not provide an open API, this library is based on the parsing of HTML site pages. If the site changes affect the HTML used for parsing, the library may break at any time and not give the expected result. I will try to update it as soon as possible. Use at your own risk!

Thanks ๐Ÿ™

MrCreepTon for his Shitty-BlastHack-Client-API

Project Stats

Alt

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.