no-as-a-service-api-client
v1.0.0
Published
A tiny JavaScript client for the “No As A Service” API that delivers random rejection reasons with a consistent, typed response format.
Maintainers
Readme
No As A Service API Client
A tiny JavaScript client for the “No As A Service” API (https://naas.isalman.dev/no) that delivers random rejection reasons with a consistent, typed response format.
📦 Installation
npm install no-as-a-service-api-client📜 Features
- Zero configurations
- Native
fetch(no dependencies) - Fully typed responses
- Consistent API success/error wrapper
- Works in modern browsers and Node.js (ES6 Imports)
🔤 Example Usage
import { getANo } from "no-as-a-service-api-client";
async function run() {
const response = await getANo();
if (response.code === "api-ok") {
console.log(response.payload?.reason);
} else {
console.error(response.message);
}
}
run();
// Sample Success Response
/*
{
"code": "api-ok",
"message": "No errors encountered, check payload",
"payload": {
"reason": "I didn’t receive the memo that I was supposed to care."
}
}
*/
// Sample Error Response
/*
{
"code": "api-fail",
"message": "Something went wrong",
"payload": null
}
*/📘 Contributing
Contributions, suggestions, and improvements are welcome. Feel free to open issues or pull requests.
❤️ Support
Like this project? Support it with a github star, it would mean a lot to me! Cheers and Happy Coding.
