/bunny-client

The TypeScript API Client for BunnyCDN

Primary LanguageTypeScriptOtherNOASSERTION

bunny-client The TypeScript API Client for BunnyCDN 🐰

Motivation

Provide an unofficial TypeScript API Client for BunnyCDN with few dependencies.

Documentation

Supported APIs

  • 🏗️ API
    • ✅ Countries
      • ✅ Get Country List
    • ✅ Support
      • ✅ Get Ticket List
      • ✅ Get Ticket Details
      • ✅ Close Ticket
      • ✅ Reply Ticket
      • ✅ Create Ticket
    • ✅ Region
      • ✅ Region List
    • 🏗️ Stream Video Library
    • 🏗️ DNS Zone
    • 🏗️ Pull Zone
      • 🏗️ List Pull Zones
      • 🏗️ Add Pull Zone
      • 🏗️ Get Pull Zone
      • 🏗️ Update Pull Zone
      • 🏗️ Delete Pull Zone
      • 🏗️ Delete Edge Rule
      • 🏗️ Add/Update Edge Rule
      • 🏗️ Set Edge Rule Enabled
      • 🏗️ Get Origin Shield Queue Statistics
      • 🏗️ Get SafeHop Statistics
      • 🏗️ Get Optimizer Statistics
      • 🏗️ Load Free Certificate
      • 🏗️ Purge Cache
      • 🏗️ Check the pull zone availability
      • 🏗️ Add Custom Certificate
      • 🏗️ Remove Certificate
      • 🏗️ Add Custom Hostname
      • 🏗️ Remove Custom Hostname
      • 🏗️ Set Force SSL
      • 🏗️ Reset token Key
      • 🏗️ Add Allowed Referer
      • 🏗️ Remove Allowed Referer
      • 🏗️ Add Blocked Referer
      • 🏗️ Remove Blocked Referer
      • 🏗️ Add Blocked IP
      • 🏗️ Remove Blocked IP
    • 🏗️ Purge
    • ✅ Statistics
      • ✅ Get Statistics
    • ✅ Storage Zone
      • ✅ List Storage Zones
      • ✅ Add Storage Zone
      • ✅ Check the Storage Zone Availability
      • ✅ Get Storage Zone
      • ✅ Update Storage Zone
      • ✅ Delete Storage Zone
      • ✅ Get Storage Zone Statistics
      • ✅ Reset Password
      • ✅ Reset Read-Only Password
  • ✅ Edge Storage API
    • ✅ Manage Files
      • ✅ Download File
      • ✅ Upload File
      • ✅ Delete File
    • ✅ Browse Files
      • ✅ List Files
  • 🏗️ Stream API
    • 🏗️ TUS
    • 🏗️ Manage Collections
    • 🏗️ Manage Videos

Quick start

Installation

Install via npm:

npm install bunny-client

Required polyfills

  • fetch API
  • Web Streams API

Supports Node.js 18+ and evergreen browsers

Account Access Key

Get your API Key from your account settings

API Key example:

cb1a7c68-89a0-462a-9495-13ebd7366cfe

Client

Each client matches with a menu item in the Bunny CDN docs

  1. Import the client
  2. Optionally set globals, like the apiKey
  3. Use the client methods to call the API

The main differences between the API and the TypeScript Client are:

  • camelCase inputs and outputs to match TypeScript style guides
  • tsdoc examples for all inputs and outputs
  • Replace the generic AccessKey with apiKey and storageZonePassword
  • More default parameters
const storageZoneClient = createStorageZoneClient({
  apiKey: API_ACCESS_KEY,
});

const response = await storageZoneClient("addStorageZone", {
  Name: "api-example",
  Region: "NY",
  ZoneTier: 1,
});

License

bunny-client by John L. Armstrong IV is licensed under Attribution-NonCommercial-ShareAlike 4.0 International

Alternative licenses available by request.

Contributing

PRs welcome! All contributors must sign the CLA Agreement so that the project license can be changed to MIT when sponsored. Thank you for your contributions.