README
Kutt
Node.js & browser client for Kutt.it url shortener
Table of Contents
Installation
npm i kutt
Usage
// es5
const Kutt = require("kutt");
// es6
import Kutt from "kutt";
// es6 & typescript
import * as Kutt from "kutt";
Static
setAPI
Set global API address
Kutt.setAPI(api_address: string): string;
setKey
Set global API key
Kutt.setKey(key: string): string;
setDomain
Set global custom domain
Kutt.setDomain(domain?: string): string;
setTimeout
Set global timeout
Kutt.setTimeout(timeout: number): timeout;
Instance
const kutt = new Kutt();
setAPI
Set instance's API address
kutt.setAPI(api_address: string): this;
setKey
Set instance's API key
kutt.setKey(key: string): this;
setDomain
Set instance's custom domain
kutt.setDomain(domain?: string): this;
setTimeout
Set instance's timeout
kutt.setTimeout(timeout: number): this;
list
Retrieve the short urls
kutt.list(): Promise<Kutt.ListResult>;
kutt.list(callback: Kutt.Callback<Kutt.ListResult>): void;
submit
Create a new short url
kutt.submit(data: Kutt.NewUrl): Promise<Kutt.Url>;
kutt.submit(data: Kutt.NewUrl, callback: Kutt.Callback<Kutt.Url>): void;
delete
Remove the short url
kutt.delete(id: string): Promise<Kutt.Url>;
kutt.delete(id: string, callback: Kutt.Callback<Kutt.Url>): void;
stats
Remove the short url
kutt.stats(id: string): Promise<Kutt.StatResult>;
kutt.stats(id: string, callback: Kutt.Callback<Kutt.StatResult>): void;
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Ardalan Amini - Core Maintainer - @ardalanamini
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE file for details
Support
If my work helps you, please consider