WIP
$ npm install --save clik
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>", ...}]
Returns: ClikIO.Client
The HTTP client prepared to interact with the Clik.io API.
Type: string
The value of your Bearer or ApiKey token.
Important: Keep this value secret!
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.
Returns: Promise<boolean>
Checks if a ClikIO.Link already exists using the uid value.
Type: ClikIO.Client
The prepared client via clik.setup.
Type: string
The desired uid value to check.
Returns: Promise<ClikIO.Link[]>
Returns a list of ClikIO.Links that belong to the authenticated user.
Type: ClikIO.Client
The prepared client via clik.setup.
Returns: Promise<ClikIO.Link>
Creates a new ClikIO.Link with the target href destination.
Type: ClikIO.Client
The prepared client via clik.setup.
Type: string
The target destination.
Type: string
Optional: true
The desired uid value to reserve.
Note: When an undefined, a unique
uidvalue will be generated.
Returns: Promise<ClikIO.Link>
Updates the href property of an existing ClikIO.Link – but only if the authenticated user owns it!
Type: ClikIO.Client
The prepared client via clik.setup.
Type: string
The uid value of an existing ClikIO.Link.
Type: string
The updated target destination.
MIT © Luke Edwards