Skip to content

DocSpring/docspring-javascript

Repository files navigation

docspring

DocSpring - JavaScript client for docspring Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures. This SDK is automatically generated by the OpenAPI Generator project:

  • API version: v1
  • Package version: 3.0.0
  • Generator version: 7.16.0-DOCSPRING
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install docspring --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your docspring from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var DocSpring = require('docspring');

var defaultClient = DocSpring.ApiClient.instance;
// Configure HTTP basic authorization: api_token_basic
var api_token_basic = defaultClient.authentications['api_token_basic'];
api_token_basic.username = 'YOUR USERNAME'
api_token_basic.password = 'YOUR PASSWORD'

var api = new DocSpring.Client()
var template_id = "tpl_1234567890abcdef02"; // {String} 
var data = new DocSpring.AddFieldsData(); // {AddFieldsData} 
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.addFieldsToTemplate(template_id, data, callback);

Documentation for API Endpoints

All URIs are relative to https://sync.api.docspring.com/api/v1

Class Method HTTP request Description
DocSpring.Client addFieldsToTemplate PUT /templates/{template_id}/add_fields Add new fields to a Template
DocSpring.Client batchGeneratePdfs POST /submissions/batches Generate multiple PDFs
DocSpring.Client combinePdfs POST /combined_submissions Merge submission PDFs, template PDFs, or custom files
DocSpring.Client copyTemplate POST /templates/{template_id}/copy Copy a template
DocSpring.Client createCustomFileFromUpload POST /custom_files Create a new custom file from a cached S3 upload
DocSpring.Client createDataRequestEvent POST /data_requests/{data_request_id}/events Create a new event for emailing a signee a request for signature
DocSpring.Client createDataRequestToken POST /data_requests/{data_request_id}/tokens Create a new data request token for form authentication
DocSpring.Client createFolder POST /folders/ Create a folder
DocSpring.Client createHtmlTemplate POST /templates?endpoint_variant=create_html_template Create a new HTML template
DocSpring.Client createPdfTemplate POST /templates Create a new PDF template with a form POST file upload
DocSpring.Client createPdfTemplateFromUpload POST /templates?endpoint_variant=create_template_from_cached_upload Create a new PDF template from a cached S3 file upload
DocSpring.Client deleteFolder DELETE /folders/{folder_id} Delete a folder
DocSpring.Client deleteTemplate DELETE /templates/{template_id} Delete a template
DocSpring.Client expireCombinedSubmission DELETE /combined_submissions/{combined_submission_id} Expire a combined submission
DocSpring.Client expireSubmission DELETE /submissions/{submission_id} Expire a PDF submission
DocSpring.Client generatePdf POST /templates/{template_id}/submissions Generate a PDF
DocSpring.Client generatePreview POST /submissions/{submission_id}/generate_preview Generate a preview PDF for partially completed data requests
DocSpring.Client getCombinedSubmission GET /combined_submissions/{combined_submission_id} Check the status of a combined submission (merged PDFs)
DocSpring.Client getDataRequest GET /data_requests/{data_request_id} Look up a submission data request
DocSpring.Client getFullTemplate GET /templates/{template_id}?full=true Fetch the full attributes for a PDF template
DocSpring.Client getPresignUrl GET /uploads/presign Get a presigned S3 URL for direct file upload
DocSpring.Client getSubmission GET /submissions/{submission_id} Check the status of a PDF
DocSpring.Client getSubmissionBatch GET /submissions/batches/{submission_batch_id} Check the status of a submission batch job
DocSpring.Client getTemplate GET /templates/{template_id} Check the status of an uploaded template
DocSpring.Client getTemplateSchema GET /templates/{template_id}/schema Fetch the JSON schema for a template
DocSpring.Client listCombinedSubmissions GET /combined_submissions Get a list of all combined submissions
DocSpring.Client listFolders GET /folders/ Get a list of all folders
DocSpring.Client listSubmissions GET /submissions List all submissions
DocSpring.Client listTemplateSubmissions GET /templates/{template_id}/submissions List all submissions for a given template
DocSpring.Client listTemplates GET /templates Get a list of all templates
DocSpring.Client moveFolderToFolder POST /folders/{folder_id}/move Move a folder
DocSpring.Client moveTemplateToFolder POST /templates/{template_id}/move Move Template to folder
DocSpring.Client publishTemplateVersion POST /templates/{template_id}/publish_version Publish a template version
DocSpring.Client renameFolder POST /folders/{folder_id}/rename Rename a folder
DocSpring.Client restoreTemplateVersion POST /templates/{template_id}/restore_version Restore a template version
DocSpring.Client testAuthentication GET /authentication Test authentication
DocSpring.Client updateDataRequest PUT /data_requests/{data_request_id} Update a submission data request
DocSpring.Client updateTemplate PUT /templates/{template_id} Update a Template
DocSpring.Client updateTemplateDocument PUT /templates/{template_id}?endpoint_variant=update_template_pdf_with_form_post Update a template's document with a form POST file upload
DocSpring.Client updateTemplateDocumentFromUpload PUT /templates/{template_id}?endpoint_variant=update_template_pdf_with_cached_upload Update a template's document with a cached S3 file upload

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

api_token_basic

  • Type: HTTP basic authentication

About

JavaScript API Client for DocSpring

Resources

License

Stars

Watchers

Forks

Packages

No packages published