Skip to main content

Getting Started with the SDK

The Typescript SDK is provided as an ease-of-use extension to the Legalesign GraphQL library. Both the SDK and the test library are provided with the minimum framework installations, as we want you to be able to be able to use this or a version of the SDK as easily as possible on any platform.

If you need help integrating this SDK with your platform please get in touch with our support team support@legalesign.com or post to the issues log of this repository.

Installation

In the root of your project use the following to install the SDK;

npm install legalesign-sdk-js

then use the following in the header of your code

import Legalesign from 'legalesign-sdk-js'

The Basics

All actions performed through the SDK utilise the Legalesign class which handles acquiring security credentials. The type of action want will determine which of the object extensions you should use selector, downloader, factory, sender or uploader.

selector

Provides the ability to retrieve data and supplies some shortcut methods to frequently used task, such as providing a list of groups. Also allows freeform GraphQL queries and mutations.

sender

Validates and packages various send methods including single document, multiple document and bulk send.

uploader

Allows the programmer to add new templates and other file formats to their group.

downloader

Does what it says on the tin. You pass in objects that contain the file link and it downloads the file to the location you specify.

factory

Allows you to archive or restore an object.

subscriber

Allows you to connect to and read the event service.

Types

The SDK contains a tested layout of the core types on the Legalesign platform (document, template, etc.) for you to use in your integrations. Sometimes these can be helpful even if you don't use the SDK api call framework.

import { Document } from "legalesign-sdk-js";

or alias it in case you are using other packages that contain Document exports with

import { Document as LegalesignDocument } from "legalesign-sdk-js";

Testing / Examples

If you need help using the SDK, you can find examples for most calls in the test library @legalesign-sdk-js-test. This is also a useful way to test some of the basic setup of your account.

git clone legalesign-sdk-tests https://github.com/legalesign/legalesign-sdk-test.git