JSPM

clik

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q35944F
  • License MIT

WIP

Package Exports

  • clik

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (clik) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

clik build status codecov

WIP

Install

$ npm install --save clik

Usage

import * as clik from 'clik';

// setup client
const client = clik.setup('<insert apikey secret>', 'ApiKey');

// interact w/ API, passing client

await clik.exists(client, 'foobar');
//=> true | false

await clik.create(client, 'https://...');
//=> { uid: "<generated>", href: "https://...", ... }

await clik.create(client, 'https://...', 'desired');
//=> { uid: "desired", href: "https://...", ... }

await clik.update(client, 'desired', 'https://<new link>');
//=> { uid: "desired", href: "https://<new link>", ... }

const links = await clik.list(client);
//=> [{ uid: "desired", ...}, { uid: "<generated>", ...}]

API

clik.setup(token, type?)

Returns: ClikIO.Client

The HTTP client prepared to interact with the Clik.io API.

token

Type: string

The value of your Bearer or ApiKey token.

Important: Keep this value secret!

type

Type: Enum
Default: Bearer
Values: Bearer or ApiKey

The kind of token you are providing.

Please note that Bearer tokens have an expiration date, thus making them more secure.
You should use an ApiKey token for long-lived — albeit less secure — access.

clik.exists(client, uid)

Returns: Promise<boolean>

Checks if a ClikIO.Link already exists using the uid value.

client

Type: ClikIO.Client

The prepared client via clik.setup.

uid

Type: string

The desired uid value to check.

clik.list(client)

Returns: Promise<ClikIO.Link[]>

Returns a list of ClikIO.Links that belong to the authenticated user.

client

Type: ClikIO.Client

The prepared client via clik.setup.

clik.create(client, href, uid?)

Returns: Promise<ClikIO.Link>

Creates a new ClikIO.Link with the target href destination.

client

Type: ClikIO.Client

The prepared client via clik.setup.

href

Type: string

The target destination.

uid

Type: string
Optional: true

The desired uid value to reserve.

Note: When an undefined, a unique uid value will be generated.

clik.update(client, uid, href)

Returns: Promise<ClikIO.Link>

Updates the href property of an existing ClikIO.Link – but only if the authenticated user owns it!

client

Type: ClikIO.Client

The prepared client via clik.setup.

uid

Type: string

The uid value of an existing ClikIO.Link.

href

Type: string

The updated target destination.

License

MIT © Luke Edwards