1.0.1 • Published 7 months ago

causality-ts v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Causality Client

A simple TypeScript/JavaScript client library for interacting with the Causality API.


Installation

Install the library via npm:

npm install causality-ts

Usage

Once imported into your project, you can use the client like so in a regular JS project

import CausalityClient from "causality-ts";


function main() {
  const key = "YOUR_EXPERIENCE_KEY";
  const token = "YOUR_EXPERIENCE_TOKEN";

  const client = new CausalityClient(key, token);

  try {
    const response = await client.requestQrCode();
    console.log("QR Code: ", response.qrcode);
    console.log("Deeplink: ", response.deeplink);
  } catch (error) {
    console.error("Oops: ", error);
  }
}

or in a TS project

import CausalityClient, { RequestQrCodeResponse } from "causality-ts";

async function main(): Promise<void> {
  const key: string = "YOUR_EXPERIENCE_KEY";
  const token: string = "YOUR_EXPERIENCE_TOKEN";

  const client = new CausalityClient(key, token);

  try {
    const response: RequestQrCodeResponse = await client.requestQrCode();
    console.log("QR Code: ", response?.qrcode);
    console.log("Deeplink: ", response?.deeplink);
  } catch (error) {
    console.error("Oops: ", error);
  }
}
1.0.1

7 months ago

1.0.0

7 months ago