Socket
Book a DemoInstallSign in
Socket

clik

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clik

WIP

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

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

Keywords

clik

FAQs

Package last updated on 07 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts