kutt
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.0 • Public • Published

    Kutt

    Node.js & browser (TypeScript) client for Kutt url shortener.

    NPM Version Test NPM Monthly Downloads NPM Total Downloads NPM Bundle Size (minified) NPM Bundle Size (minified + gzip) Known Vulnerabilities Pull Requests License Github Stars Github Forks

    Table of Contents

    Installation

    npm i kutt

    Usage

    CommonJS

    const Kutt = require("kutt").default;

    or

    const { Kutt } = require("kutt");

    ECMAScript

    import Kutt from "kutt";

    or

    import { Kutt } from "kutt";

    Default Config

    Get

    const api: string = Kutt.get("api");
    
    const key: string = Kutt.get("key");
    
    const timeout: number = Kutt.get("timeout");

    Set

    Kutt
      .set("api", "https://kutt.it/api/v2") // API base url (Default value)
      .set("key", "") // API key (Default value)
      .set("timeout", 1e4); // Request timeout (Default value)

    Instance

    const kutt = new Kutt();

    Instance Config

    Override the default config only for the instance.

    Get

    const api: string = kutt.get("api");
    
    const key: string = kutt.get("key");
    
    const timeout: number = kutt.get("timeout");

    Set

    kutt
      .set("api", "https://kutt.it/api/v2") // API base url
      .set("key", "") // API key
      .set("timeout", 1e4); // Request timeout

    Domains

    const domains = kutt.domains();

    Create

    Create a domain.

    const domain = await domains.create({
      address: "string",
      homepage: "string",
    });

    Delete

    Delete a domain.

    const message = await domains.remove(domain.id);

    Health

    const health = kutt.health();

    Check

    Check API health.

    const isHealthy = await health.check();

    Links

    const links = kutt.links();

    List

    Get list of links.

    const result = await links.list();

    You can also pass in pagination params.

    const result = await links.list({
      skip: 0, // Default value
      limit: 10, // Default value
      all: 10, // Default value
    });

    Create

    Create a short link.

    const link = await links.create({
      target: "string",
      description: "string",
      expire_in: "2 minutes/hours/days",
      password: "string",
      customurl: "string",
      reuse: false,
      domain: "string",
    });

    Stats

    Get link stats.

    const stats = await links.stats(link.id);

    Update

    Update a link.

    const updatedLink = await links.update(link.id, {
      target: "string",
      address: "string",
      description: "string",
      expire_in: "2 minutes/hours/days",
    });

    Delete

    Delete a link.

    const message = await links.remove(link.id);

    Users

    const users = kutt.users();

    Info

    Get user info.

    const info = await users.info();

    Versioning

    We use SemVer for versioning. For the versions available, see the releases on this repository.

    Authors

    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

    Install

    npm i kutt

    Homepage

    kutt.it

    DownloadsWeekly Downloads

    231

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    114 kB

    Total Files

    77

    Last publish

    Collaborators

    • ardalanamini