0.1.2 • Published 2 years ago

tirij-api v0.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

tirij-api

Install

npm i tirij-api

Example

Free use

Links created in free use 7-day type and qr cannot be created.

import { LinkService } from "tirij-api"

const service = new LinkService()
await service.createFree(longUrl);

Basic Auth use

FeildTypeDescription
usernamestringApi public key
passwordstringApi secret key
slugstringStore slug
expireTypestring ("never" or "date", or "count")Expire type
expireAtstring ( "Date(1650611871048)" or "Date(2022-04-22T07:08:34.090Z)" or "2022-04-22T07:08:34.090Z")Expire date
clickCount{ max: number, count: number }Click Count

You can shorten any type of link you want through a store belonging to your account.

import { LinkService } from "tirij-api"

const service = new LinkService({}, { username, password })
await service.create(slug, {
  longUrl: longUrl,
  expireType: expireType,
  expireAt: expireAt,
  clickCount:{
    max: max,
    count: count
  },
});

Create Qr

FeildTypeDescription
usernamestringApi public key
passwordstringApi secret key
slugstringStore slug
_idstringLink id
typestring ("short" or "long")Link type
optionsILinkQrOptionsqr-code-styling-node-options

While creating qr, qr-code-styling-node package was used. You can forward all qr-code-styling-node settings from options.

import { LinkService } from "tirij-api"

const service = new LinkService({}, { username, password })
const result = await service.createQr(slug, _id, "short" || "long", { type: "svg"});

require("fs").writeFile(`${result.data._id}.svg`, result.data.base64, 'base64', function(err) {
  console.log(err);
});
0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago