0.0.1 • Published 7 months ago

@pebblely/pebblely-js v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

pebblely

Building and linking the package

  1. Ensure @pebblely/shared has been linked.
  2. 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
}