@pebblely/pebblely-js
v0.0.1
Published
## Building and linking the package 1. Ensure `@pebblely/shared` has been linked. 2. Build and link `pebblely` ```bash npm link @pebblely/shared npm run build npm link ```
Downloads
2
Readme
pebblely
Building and linking the package
- Ensure
@pebblely/shared
has been linked. - Build and link
pebblely
npm link @pebblely/shared
npm run build
npm link
Getting started
Import pebblely client
import pebblely from 'pebblely'
Ensure you have the Pebblely API key inside your .env
file
PEBBLELY_API_KEY=YOUR_API_KEY
Get credits
async function getCredits() {
const { credits } = await pebblely.getCredits()
return credits
}
Create background (with theme)
async function createBackground(imgFile: File, theme: string) {
// Convert image to base64 representation
const images = [await pebblely.convertFile(imgFile)]
const { data, credits } = await pebblely.createBackground({
images,
theme
})
return data // Return base64 image string
}