1.3.1 • Published 3 years ago

short.io v1.3.1

Weekly downloads
26
License
Apache-2.0
Repository
github
Last release
3 years ago

short.io (NodeJS Module)

Easy to use module, made to interact with the short.io API, shorten links, delete them & more.

DeepScan grade DeepSource

How to use short.io ?

Here's some exemple to kickstart your short.io integration, if you need documentation, refer to the GitHub Repository's Wiki.

IchiiDev/short.io is not affiliated to the website and enterprise short.io

Basics

If you want to use your short.io account with this package, here's some data you should get from your account:

Get a list of specific links from your domain

const shortio = require("short.io");

// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");

// This* gets a maximum of 150 links from your domain
short.getLinks().then(links => {
    console.log(links); // Print your links
});

*More options available on the package's wiki page

Get a precise link from the API

const shortio = require("short.io");

// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");

// This gets a precise link informations, the 00000 is the link ID.
short.getLink(00000).then(link => {
    console.log(link);
});

Push a link to your shortner domain

const shortio = require("short.io");

// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");

// This* creates a link on your short.io service.
short.createLink({ originalURL: "https://discord.gg/fr" }).then(link => {
    console.log(link);
});

*More options available on the package's wiki page

Delete a link from your shortner domain

const shortio = require("short.io");

// Create your short.io API Wrapper Instance
const short = new shortio("short.domain.com", 00000, "ZdegKTLwycVBilTxW77hY8Zq4utAn7Xk");

// This deletes a link, the 00000 is the link ID.
short.deleteLink(00000) // Delete the link
    .then(result => console.log(result)) // Display the result for debug
    .catch(e => console.log(e)); // Catch error if one occures

How to contribute ?

Feel free to fork my work and propose changes. If you have any issues with my work, please open an Issue.

Contributors

  • @IchiiDev: contact@ichiidev.xyz (Contact E-Mail).

What's new ?

v1.1.O: Security update

  • Changed request dependency package from request to node-fetch (request was deprecated).
  • Added promises to the deleteLink() and archiveLink() function.

v1.1.1: Documentation Update

  • Fixed the getLinks() function, added more parameters like offset, tag and limit.
  • Added more documentation to the code

v1.2.0: Link Management Update

  • Added the updateLink() function to permit link edition
  • Added the getByOriginalURL() function to get a link object by querying it's originalURL.
  • Removed useless functions parameters
  • Corrected JS Doc errors

v1.3.0: Statistics 🥳

  • Added domain, clicks and links stats methods
  • Fixed some code execution errors
  • Removed useless constants from the code

What's coming ?

  • Add more classes to improve package ergonomics => V2 (TypeScript)
  • Global rewrite of the package in TS to improve documentation and code quality + user ergonomic => V2

V2 will come directly as the next update, there wont be any 1.4.0 for domain management (Theses methods will be added along with the V2)

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

4 years ago

0.0.1

4 years ago