Socket
Book a DemoInstallSign in
Socket

cloudflare-bread

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudflare-bread

JavaScript fetch API client for Cloudflare's API with TypeScript definitions generated from the new Cloudflare's OpenAPI schema.

latest
Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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:

npm install cloudflare-bread

# or...

yarn add cloudflare-bread

# or...

pnpm install cloudflare-bread

Use the API and get type definitions:

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.
  • Fix searchParams being required even tho none of the params are actually required
  • Improve types of middleware

License

MIT, see LICENSE

Keywords

cloudflare

FAQs

Package last updated on 23 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts