Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefanmaric/cloudflare-bread
JavaScript fetch API client for Cloudflare's API with TypeScript definitions generated from the new Cloudflare's OpenAPI schema.
https://github.com/stefanmaric/cloudflare-bread
api browser cloudflare fetch node openapi typescript
Last synced: about 2 months ago
JSON representation
JavaScript fetch API client for Cloudflare's API with TypeScript definitions generated from the new Cloudflare's OpenAPI schema.
- Host: GitHub
- URL: https://github.com/stefanmaric/cloudflare-bread
- Owner: stefanmaric
- License: mit
- Created: 2022-11-17T12:35:21.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-18T08:30:32.000Z (over 1 year ago)
- Last Synced: 2024-04-15T04:40:33.388Z (9 months ago)
- Topics: api, browser, cloudflare, fetch, node, openapi, typescript
- Language: TypeScript
- Homepage:
- Size: 2.25 MB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cloudflare-bread
JavaScript fetch API client for Cloudflare's API with TypeScript definitions generated from the new Cloudflare's OpenAPI schema.
## Project status
Alpha: being used in certain non-critical applications
## Usage
Install with your package manager of choice:
```shell
npm install cloudflare-bread# or...
yarn add cloudflare-bread
# or...
pnpm install cloudflare-bread
```Use the API and get type definitions:
```typescript
import { createClient } from 'cloudflare-bread'const client = createClient({ token: process.env.CLOUDFLARE_API_TOKEN })
const response = await client.zones.zoneIdentifier('example.com').dns_records.$get({
searchParams: {
type: 'CNAME',
},
})if (response.status === 200) {
const results = await response.json()
// ^? this will be typed
}
```## TODO
- [ ] Collapse different params on the same position into a single one.
- [x] Fix `searchParams` being required even tho none of the params are actually required
- [ ] Improve types of middleware## License
MIT, see [LICENSE](./LICENSE)