npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

clicksign-library

v0.1.3-beta

Published

This is a Node.js library to facilitate contract sending using the ClickSign REST API. The library is written in TypeScript and uses functional programming to provide an easy-to-use and scalable interface.

Downloads

11

Readme

ClickSign Library (Node.js)

This is a Node.js library to facilitate contract sending using the ClickSign REST API. The library is written in TypeScript and uses functional programming to provide an easy-to-use and scalable interface.

Implemented Features

The library already has the following features implemented:

  • Send contracts to ClickSign
  • Retrieve the list of documents in ClickSign

How to Use

Installation

To use the library in your project, you can install it via npm or yarn:

npm install clicksign-library --save

or

yarn add clicksign-library

Configuration

Before using the library, you need to configure the ClickSign API with your access key, and the enviroment:

import { clickSignService } from 'clicksign-library';
import { ClickSignEnvironment } from 'clicksign-library/types';

const accessToken = 'YOUR_CLICKSIGN_ACCESS_KEY';
const environment = ClickSignEnvironment.Production;

const clickSignAPI = clickSignService({
  apiKey: accessToken,
  environment,
  debug: false, // optional, default is false
  maxRequests: 10, // optional, default is 10
  perMilliseconds: 2000, // optional, default is 2000
  retryConfig: { retries: 3 }, // optional, default is { retries: 3 }
});

Documents

Create Document by Template

To create a document by template on ClickSign, you can use this function:

async function createDocumentByTemplate() {
  try {
    const data = {
      path: '/Models/Test-123.docx',
      templateKey: 'a250d85b-1688-4145-838a-122f4a4febf7',
      data: {
        company: 'Test',
        full_address: 'Test Address',
        zip: '31080-231',
        cnpj: '12.123.321/0001-12',
        value: '$ 10.0000',
      },
    } as TemplateDocument;

    const document = await clickSignService.documents.createDocumentByTemplate(data);
    console.log(document);
  } catch (error) {
    console.error('Error creating document by template:', error.message);
  }
}

Create Document by Upload

To create a document by upload on ClickSign, you can use this function:

async function createDocumentByUpload() {
  try {
    const data = {
      path: "/document.pdf",
      content_base64: 'base64 file' ,
      deadline_at: "2020-01-05T14:30:59-03:00", // optional
      auto_close: true, // optional - default true
      remind_interval: 14, // optional - default 3
      locale: "pt-BR", // optional - default pt-BR
      sequence_enabled: false, // optional - default fase
      block_after_refusal: true // optional - default true
    } as CreateDocumentByUpload;

    const document = await clickSignService.documents.createDocumentByUpload(data);
    console.log(document);
  } catch (error) {
    console.error('Error creating document by template:', error.message);
  }
}

List Documents

To retrieve the list of documents in ClickSign, you can use the getDocuments function:

  const fetchDocuments = async () => {
    const documents = await clickSignAPI.documents.getDocuments();
    return documents;
  }

Get Document by key

To get a document by key in ClickSign, you can use:

  const fetchDocument = async (documentKey: string) => {
    const document = await clickSignAPI.documents.getDocument(documentKey);
  }

Cancel document by key:

To Cancel a document by key, you can use:

  const cancelDocument = async (documentKey: string) => {
    await clickSignAPI.documents.cancelDocument(documentKey);
  }

Delete document by key:

To Delete a document by key, you can use:

  const deleteDocument = async (documentKey: string) => {
    await clickSignAPI.documents.deleteDocument(documentKey);
  }

Signers

Create Signer

Creates a new signer in ClickSign.

  const createNewSigner = async () => {
     const data: CreateSigner = {
      auths: ['email'],
      email: '[email protected]',
      name: 'Test User',
      documentation: '', // cpf number
      birthday: new Date('11/11/1998'),
      phone_number: '11988667788',
    };

    await clickSignAPI.signers.createSigner(data);
  }

Get a Signer

Get a signer in ClickSign.

  const getASigner = async () => {
    const signerKey = 'key'
    const signerData = await clickSignAPI.signers.getSigner(signerKey);
    console.log({ signerData })
  }

Add a Signer in Document

Get a signer in ClickSign.

  const addAginerInDoc = async () => {
    const data: AddSignerInDocument = {
      document_key: document.key,
      signer_key: signerKey,
      sign_as: 'sign',
      message: 'Olá, assine aqui',
      refusable: true,
    };
    await clickSignAPI.signers.addSignerInDocument(data);
  }

Add a Signer in Document

To add signer in Document in ClickSign.

  const addAginerInDoc = async () => {
    const data: AddSignerInDocument = {
      document_key: document.key,
      signer_key: signerKey,
      sign_as: 'sign',
      message: 'Olá, assine aqui',
      refusable: true,
    };
    await clickSignAPI.signers.addSignerInDocument(data);
  }

Remove Signer of Document

To remove a signer of Document in ClickSign.

  const removeSignerofDoc = async () => {
    const { document } = await clickSignAPI.documents.getDocument(documentKey);

    await clickSignAPI.signers.removeSignerOfDocument(
      document.signers[0].list_key,
    );
  }

Contribution

Contributions are welcome! If you want to contribute to this project, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

This is a brief guide on how to use the ClickSign library in your Node.js project. Feel free to expand the README with more relevant information for users and developers. Remember to keep the README updated as new features are added to the project. Happy coding!


Make sure to replace `YOUR_CLICKSIGN_ACCESS_KEY` with your actual ClickSign access key in the code. This README.md file provides instructions on how to install, configure, and use the ClickSign library in your project. It also includes a contribution section and license information to facilitate collaboration from other developers.

Remember to keep the README.md updated with relevant information for the project and its users. A good README is essential for providing clear and friendly documentation and helping users understand how to use the library effectively.