Skip to content

Latest commit

 

History

History
88 lines (46 loc) · 4.11 KB

README.md

File metadata and controls

88 lines (46 loc) · 4.11 KB

BunnyCDN Node.js client

A simple client for the BunnyCDN API.

Notice!

I started writing this module, before I found out there was already a similar module, which is complete and tested. So, I have stopped developing this module for now, and I recommend using the other one. I will resume development if the other module is deprecated.

Installation

NOTICE: I have unpublished this module from npm to prevent cluttering the registry.

npm install bunnycdn

Usage

const bunnycdn = require('bunnycdn')

const client = bunnycdn({
  apiKey: 'YOUR-API-KEY'
})

client.pullzone.list()
  .then(console.log)
  .catch(console.error)

Methods

client.purge(data)

client.statistics(data)

client.billing.list()

client.billing.applycode(data)

Pullzone

client.pullzone.list()

client.pullzone.create(data)

client.pullzone.get(id)

client.pullzone.update(id, data)

client.pullzone.delete(id)

client.pullzone.purgeCache(id)

client.pullzone.addHostname(data)

client.pullzone.deleteHostname(data)

client.pullzone.setForceSSL(data)

client.pullzone.loadFreeCertificate(data)

client.pullzone.addCertificate(data)

client.pullzone.addBlockedIp(data)

client.pullzone.removeBlockedIp(data)

Storage zone

client.storagezone.list()

client.storagezone.create(data)

client.storagezone.delete(id)

Storage

The storage API documentation is separate from the main API docs.

client.storage.download(path)

client.storage.upload(path)

client.storage.delete(path)

client.storage.list(path)

Errors

All HTTP errors will have a status and message property. Where status will be the HTTP status code (ex. 500), and message will be the corresponding error message (ex. Internal Server Error). If the API response contains a body property, it will also be present on the error object.