@linktoqr/l2qr-sdk
v1.1.2
Published
L2QR SDK for JavaScript
Downloads
338
Readme
L2QR SDK for JavaScript
Installation
npm install @linktoqr/l2qr-sdk
REST API
You can also use our REST API Docs
Usage
Initialize the SDK with the L2qr project API token. You can generate one here: L2QR app -> settings -< api
⚠️ Don't forget to set "Website restrictions".
ES5
import L2qr from '@linktoqr/l2qr-sdk';
const l2qr = new L2qr('${API_KEY}');
CJS
const L2qr = require('@linktoqr/l2qr-sdk').default;
const l2qr = new L2qr('${API_KEY}');
Make a request. You will have to await
all requests.
const options = {...}
const staticQrCode = await l2qr.staticQrCodes.create(options);
Methods
I will be adding new methods. Please open issues of the methods you need and I'll add them.
Static QR codes
// Create a static qr code
const options = {...}
const newStaticQrCode = await l2qr.staticQrCodes.create(options);
// newStaticQrCode: { url: "${STATIC_QR_CODE_URL}", ... }
Static QR codes file
// Get a static qr code file
const options = {
format: '', // suppered formats
...
}
const staticQrCodeFile = await l2qr.staticQrCodesFile.get(options);
// staticQrCodeFile: File (with defined format)
Using with Nuxt js
// nuxt.config.js
export default {
// ...
build: {
transpile: ['@linktoqr/l2qr-sdk'],
},
}
Some options
| Option | Type | Default | Value | |--------|--------|---------|---------------------------------| | Format | String | Svg | png, svg, webp, jpeg, gif, avif |