Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nephelaiio/cloudflare-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@nephelaiio/cloudflare-api
An opinionated wrapper for Cloudflare's v4 API.
Description
This package provides an basic interface to interact with Cloudflare's API, with built-in functionality like error handling, retries, and pagination handling.
Installation
To add this package to your project, simply run:
npm install @nephelaiio/cloudflare-apiUsage
import { api } from '@nephelaiio/cloudflare-api';
const options = {
token: 'YOUR_CLOUDFLARE_TOKEN',
path: '/zones'
};
async function fetchZones() {
const data = await api(options);
console.log(data);
}
fetchZones();API Options
token: Your Cloudflare API token.path: The API endpoint path.method: HTTP method (GET,POST,PUT,PATCH,DELETE,HEAD).body: Request body, if any.ignore_errors: An array of HTTP status codes that should not be treated as errors.
Dependencies
This package has a dependency on @nephelaiio/logger for logging purposes.
Reporting Bugs
For bug reports, please open an issue on GitHub.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.
Ensure your code adheres to our linting and test guidelines:
make lint
make testTODO
- Use OpenAPI Typescript fetch generator along with Cloudflare's OpenAPI schemas to auto-generate complete type aware interface to v4 API
License
This project is licensed under the MIT License - see the LICENSE file for details.