journy-io / js-sdk

πŸ’š The official Node.js SDK that you can use to easily interact with our API

Home Page:https://developers.journy.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

journy.io

journy.io Node.js SDK

npm npm downloads

This is the official Node.js SDK for journy.io.

πŸ’Ύ Installation

You can use your package manager (npm or yarn) to install the SDK:

npm install --save @journyio/sdk

or

yarn add @journyio/sdk

πŸ”Œ Getting started

Import

To start, first import the client.

import { Client } from "@journyio/sdk";

Configuration

To be able to use the journy.io SDK you need to generate an API key. If you don't have one you can create one in journy.io.

If you don't have an account yet, you can create one in journy.io or request a demo first.

Go to your settings, under the Connections-tab, to create and edit API keys. Make sure to give the correct permissions to the API Key.

const client = Client.withDefaults("your-api-key");

If you want to use a custom HttpClient:

const http = new OwnHttpClientImplementation();
const client = new Client(http, { apiKey: "your-api-key" });

Methods

Get API key details

const result = await client.getApiKeyDetails();

if (result.success) {
  console.log(result.data.permissions); // string[]
  console.log(result.callsRemaining); // number
}

Handling errors

Every call will return a result, we don't throw errors when a call fails. We don't want to break your application when things go wrong. An exception will be thrown for required arguments that are empty or missing.

You can check whether the call succeeded using result.success:

const result = await client.getTrackingSnippet({
  domain: "www.journy.io",
});

if (!result.success) {
  console.log(result.error); // string
  console.log(result.requestId); // string
}

await client.getTrackingSnippet({
  domain: "", // empty string will throw
});

The request ID can be useful when viewing API logs in journy.io.

πŸ“¬ API Docs

API reference

πŸ’― Tests

To run the tests:

npm run test

❓ Help

We welcome your feedback, ideas and suggestions. We really want to make your life easier, so if we’re falling short or should be doing something different, we want to hear about it.

Please create an issue or contact us via the chat on our website.

πŸ”’ Security

If you discover any security related issues, please email security at journy io instead of using the issue tracker.

About

πŸ’š The official Node.js SDK that you can use to easily interact with our API

https://developers.journy.io

License:MIT License


Languages

Language:TypeScript 98.3%Language:JavaScript 1.7%