npm.io
0.0.10 • Published 5 years ago

@websiteshot/nodejs-client

Licence
ISC
Version
0.0.10
Deps
1
Size
22 kB
Vulns
23
Weekly
0

Websiteshot NodeJS Client


Never spend time again to create awesome screenshots of your websites.


Installation

npm i @websiteshot/nodejs-client --save

Usage

Import Controller and Types
import {
  Config,
  CreateRequest,
  ScreenshotParameter,
  Url,
  WebsiteshotController,
} from '@websiteshot/nodejs-client'
Init Client
const config: Config = {
  projectId: '...',
  apikey: '...',
}

const websiteshotController = new WebsiteshotController(config)
Create Screenshot Job
const screenshotParameter: ScreenshotParameter = {
  width: 1200,
  height: 720,
}

const urls: Url[] = [
  {
    url: 'https://websiteshot.app',
    name: 'Websiteshot',
  },
]

const createRequest: CreateRequest = {
  screenshotParameter,
  urls,
}

await websiteshotController.create(createRequest)
Create Screenshot Job with Template
const createRequest: CreateRequest = {
  templateId: '...',
}

await websiteshotController.create(createRequest)
Get Screenshot Jobs
const config: Config = {
  projectId: '...',
  apikey: '...',
}

const websiteshotController = new WebsiteshotController(config)

const response: GetResponse = await websiteshotController.get(jobId)