{"id":25228882,"url":"https://github.com/imankii01/dynamic-api-wrapper","last_synced_at":"2026-04-29T00:35:09.174Z","repository":{"id":276508405,"uuid":"929490830","full_name":"imankii01/Dynamic-API-Wrapper","owner":"imankii01","description":"Dynamic API Wrapper is a lightweight and flexible API wrapper for Node.js, designed to make API integrations easier and more efficient. It supports GET, POST, PUT, DELETE, and PATCH requests while handling authentication, retries, and error management automatically.","archived":false,"fork":false,"pushed_at":"2025-02-08T17:17:50.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T14:12:10.010Z","etag":null,"topics":["api","backend","nodejs","nodejs-api","opne-source","rate-limiting","wrapper"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/dynamic-api-wrapper","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imankii01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-08T17:09:57.000Z","updated_at":"2025-02-08T17:38:15.000Z","dependencies_parsed_at":"2025-02-08T18:23:12.279Z","dependency_job_id":"ff8a4de9-b97f-4029-8049-e43089fe8be7","html_url":"https://github.com/imankii01/Dynamic-API-Wrapper","commit_stats":null,"previous_names":["imankii01/dynamic-api-wrapper"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imankii01%2FDynamic-API-Wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imankii01%2FDynamic-API-Wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imankii01%2FDynamic-API-Wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imankii01%2FDynamic-API-Wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imankii01","download_url":"https://codeload.github.com/imankii01/Dynamic-API-Wrapper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345846,"owners_count":20924102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","backend","nodejs","nodejs-api","opne-source","rate-limiting","wrapper"],"created_at":"2025-02-11T10:46:11.244Z","updated_at":"2026-04-29T00:35:08.712Z","avatar_url":"https://github.com/imankii01.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/imankii01"],"categories":[],"sub_categories":[],"readme":"\n# 🚀 Dynamic API Wrapper\n\n[![npm version](https://badge.fury.io/js/dynamic-api-wrapper.svg)](https://www.npmjs.com/package/dynamic-api-wrapper)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA powerful, flexible, and easy-to-use API wrapper for **any REST API**.  \nSimplify API integrations in **Node.js** with built-in authentication, error handling, and rate limiting.  \n\n---\n\n## **🌟 Features**\n✅ Supports **GET, POST, PUT, DELETE, PATCH** requests  \n✅ Works with **any REST API**  \n✅ Supports **API Key \u0026 OAuth authentication**  \n✅ **Automatic retries** on failures \u0026 rate limits  \n✅ **Environment variable support** (for API keys)  \n✅ **Modular \u0026 Extensible**  \n✅ **TypeScript support** for better DX  \n\n---\n\n## **📌 When to Use**\n- Connecting to **external REST APIs** in a Node.js project  \n- Building **microservices** that require multiple API calls  \n- Simplifying **API integration** for internal and external services  \n- Handling **authentication, retries, and error handling** automatically  \n\n---\n\n## **🛠️ How This API Wrapper Makes Your Work Easier**\nBefore using this wrapper, you might be making **raw API calls manually** using `axios` or `fetch`, leading to:  \n❌ **Repeated code** for handling API requests  \n❌ **Hardcoded authentication headers** everywhere  \n❌ **No error handling** for rate limits or failed requests  \n❌ **Difficult debugging \u0026 maintenance**  \n\n### **✅ How This Wrapper Helps**\n🔹 **One-time setup** → Initialize the client once and reuse it  \n🔹 **Automatic authentication** → No need to manually add headers  \n🔹 **Built-in error handling** → Automatically retries rate-limited requests  \n🔹 **Less code, more efficiency** → Clean, readable API calls  \n🔹 **Consistent API design** → Same method for any REST API  \n\n### **📌 Example Before vs. After Using This Wrapper**\n\n#### ❌ **Without This Wrapper (Traditional Approach)**\n```js\nconst axios = require(\"axios\");\n\nasync function getUser(userId) {\n  try {\n    const response = await axios.get(`https://api.example.com/users/${userId}`, {\n      headers: { Authorization: `Bearer ${process.env.API_KEY}` }\n    });\n    return response.data;\n  } catch (error) {\n    console.error(\"API Error:\", error.message);\n  }\n}\n\ngetUser(\"12345\");\n```\n\n#### ✅ **With This Wrapper**\n```js\nconst DynamicAPIWrapper = require(\"dynamic-api-wrapper\");\n\nconst api = new DynamicAPIWrapper({\n  baseURL: \"https://api.example.com\",\n  apiKey: process.env.API_KEY,\n});\n\nasync function getUser() {\n  try {\n    const user = await api.get(\"/users/12345\");\n    console.log(user);\n  } catch (error) {\n    console.error(\"Error:\", error.message);\n  }\n}\n\ngetUser();\n```\n### **🎯 What's Different?**\n✅ **No need to manually handle headers**  \n✅ **No need to handle errors manually**  \n✅ **Reusable client for multiple API calls**  \n✅ **Cleaner, more readable code**  \n\n---\n\n## **📦 Installation**\nInstall via NPM:\n```sh\nnpm install dynamic-api-wrapper\n```\n\nOr using Yarn:\n```sh\nyarn add dynamic-api-wrapper\n```\n\n---\n\n## **🚀 Quick Start**\n### **1️⃣ Import \u0026 Initialize**\n```js\nconst DynamicAPIWrapper = require(\"dynamic-api-wrapper\");\n\nconst api = new DynamicAPIWrapper({\n  baseURL: \"https://api.example.com\",\n  apiKey: process.env.API_KEY, // API Key from .env\n});\n```\n\n### **2️⃣ Make API Requests**\n#### ✅ **GET Request**\n```js\nasync function fetchUser() {\n  try {\n    const user = await api.get(\"/users/12345\");\n    console.log(user);\n  } catch (error) {\n    console.error(\"Error:\", error.message);\n  }\n}\nfetchUser();\n```\n\n#### ✅ **POST Request**\n```js\napi.post(\"/users\", { name: \"John Doe\" })\n  .then(response =\u003e console.log(response))\n  .catch(error =\u003e console.error(error));\n```\n\n#### ✅ **OAuth Support**\n```js\nconst api = new DynamicAPIWrapper({\n  baseURL: \"https://api.example.com\",\n  token: process.env.OAUTH_TOKEN,\n  authType: \"oauth\",\n});\n```\n\n---\n\n## **⚙️ How It Works**\n1. **Create an API client instance** with `baseURL` and authentication method.  \n2. **Make API calls** using `get()`, `post()`, `put()`, or `delete()`.  \n3. **Handles rate limits**, errors, and retries automatically.  \n\n✅ Uses **Axios** for requests  \n✅ Supports **OAuth and API Key-based authentication**  \n✅ Retries **429 (Rate Limit Exceeded) errors** automatically  \n\n---\n\n## **🛠️ Configuration**\n### **Using `.env` for API Keys**\nCreate a `.env` file and store your API credentials securely:\n```\nAPI_KEY=your_api_key_here\nAPI_BASE_URL=https://api.example.com\n```\n\nThen, use it in your code:\n```js\nrequire(\"dotenv\").config();\n```\n\n---\n\n## **💡 Advanced Usage**\n### **Custom Headers**\n```js\napi.get(\"/data\", {}, { \"Custom-Header\": \"value\" });\n```\n\n### **Sending Query Parameters**\n```js\napi.get(\"/search\", { query: \"test\", limit: 10 });\n```\n\n### **Handling Errors**\n```js\ntry {\n  const response = await api.get(\"/users/12345\");\n} catch (error) {\n  console.error(\"API Error:\", error.message);\n}\n```\n\n---\n\n## **📝 License**\nThis project is licensed under the **MIT License**.  \n[Read More](https://opensource.org/licenses/MIT)\n\n---\n\n## **👨‍💻 Author**\n**Ankit** – Full Stack Developer  \n🔗 [LinkedIn](https://www.linkedin.com/in/imankii01)  \n🔗 [GitHub](https://github.com/imankii01)  \n🔗 [NPM Profile](https://www.npmjs.com/~private.ankit047)  \n\n☕ **Support My Work:**  \n[![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-Donate-orange)](https://www.buymeacoffee.com/imankii01)\n\n---\n\n## **💬 Contributing**\nContributions are welcome!  \nFeel free to submit **issues and pull requests** on GitHub.  \n\nHappy coding! 🚀  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimankii01%2Fdynamic-api-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimankii01%2Fdynamic-api-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimankii01%2Fdynamic-api-wrapper/lists"}