Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jlarmstrongiv/bunny-client

The TypeScript API Client for BunnyCDN
https://github.com/jlarmstrongiv/bunny-client

api bunny bunny-cdn bunny-client bunnycdn bunnynet cdn typescript

Last synced: about 1 month ago
JSON representation

The TypeScript API Client for BunnyCDN

Awesome Lists containing this project

README

        

# `bunny-client` The TypeScript API Client for BunnyCDN 🐰

## Motivation

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

## Documentation

- [quick start guide](https://github.com/jlarmstrongiv/bunny-client#quick-start)
- [official API documentation](https://docs.bunny.net/docs)
- [generated TypeScript documentation](https://bunny-client.surge.sh)

### 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](https://www.npmjs.com/package/bunny-client):

```shell
npm install bunny-client
```

### Required polyfills

- `fetch` API
- Web Streams API

Supports [Node.js 18+](https://nodejs.org/en/blog/announcements/v18-release-announce#fetch-experimental) and [evergreen browsers](https://caniuse.com/fetch)

### Account Access Key

Get your API Key from your [account settings](https://dash.bunny.net/account/settings)

API Key example:

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

### Client

Each client matches with a menu item in the Bunny CDN [docs](https://docs.bunny.net/reference/bunnynet-api-overview)

1. Import the client
1. Optionally set globals, like the `apiKey`
1. 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

```ts
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.