Skip to content

PreviewLinks/node-previewlinks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PreviewLinks for Node.js

This is the official PreviewLinks client for Node.js.

Installation

You can install the package via NPM:

npm install @previewlinks/node-previewlinks

Usage

Creating an instance

const { PreviewLinks } = require('@previewlinks/node-previewlinks')

const previewlinks = new PreviewLinks({ apiToken: '<YOUR_API_TOKEN>' })

Methods

// List sites
previewlinks
    .listSites()
    .then(response => response.data)

// Show site
let siteId = 1

previewlinks
    .showSite(siteId)
    .then(response => response.data)

// Show site's templates
let siteId = 1

previewlinks
    .listSiteTemplates(siteId)
    .then(response => response.data)

// Generate a direct image URL (useful for downloading and storing images yourself)
let siteId = 1
let templateId = 1
let fields = {
    'previewlinks:title': 'Hello from Node.js!',
    'previewlinks:subtitle': 'This is an example...',
}

previewlinks
    .downloadImage({
        siteId,
        templateId,
        fields,
    })
    .then(response => response.data)

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.