@wral/sdk-tag

0.1.0 • Public • Published

sdk-tag

The sdk-tag is a JavaScript SDK (Software Development Kit) designed to interact with an API that generates and validates JWTs.

Installation

You can install the `sdk-tag

npm install @wral/sdk-tag

Usage

To use the sdk-tag, you first need to import it into your JavaScript or TypeScript project:

import { createClient } from '@wral/sdk-tag';

Then, you can create a client instance with your configuration:

const config = {
  baseUrl: 'YOUR_BASE_URL', // Base URL of your API
};

const client = createClient(config);

After creating the client instance, you can use its methods to interact with the API. Here are some examples:

// List tags related to weather
let tags = await client.listTags({ query: 'weather' });
let result = await client.attachTag(tags[0].id, { url: 'https://www.wral.com/weather/' });

API

createClient(config)

Creates a new client instance with the provided configuration.

  • config: An object containing API configuration parameters:
    • baseUrl: The base URL of the API.

Returns a client instance with methods for interacting with the API.

Methods

  • api: (path, options = {}): fetch wrapper for the API.
  • listTags({ query } = {}): list tags
  • putTag(tag): create a tag
  • getTag(tagId): read a tag
  • deleteTag(tagId): delete a tag
  • attachTag(tagId, resource): attach a tag to a resource
  • detachTag(tagId, { url }): detach a tag from a resource
  • query({ query } = {}): query tagged resource

Readme

Keywords

none

Package Sidebar

Install

npm i @wral/sdk-tag

Weekly Downloads

5

Version

0.1.0

License

UNLICENSED

Unpacked Size

47 kB

Total Files

10

Last publish

Collaborators

  • jforbes
  • kbarbour
  • sburbridge
  • cbcnewmedia