{"id":13493029,"url":"https://github.com/FrancescoSaverioZuppichini/API-Class","last_synced_at":"2025-03-28T11:31:28.771Z","repository":{"id":24056321,"uuid":"100496706","full_name":"FrancescoSaverioZuppichini/API-Class","owner":"FrancescoSaverioZuppichini","description":"A utility class for calling apis CRUD methods","archived":false,"fork":false,"pushed_at":"2022-12-02T14:01:09.000Z","size":852,"stargazers_count":89,"open_issues_count":8,"forks_count":31,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-24T04:54:19.470Z","etag":null,"topics":["javascript","webdevelopment"],"latest_commit_sha":null,"homepage":"","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/FrancescoSaverioZuppichini.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}},"created_at":"2017-08-16T14:11:59.000Z","updated_at":"2024-02-06T05:55:31.000Z","dependencies_parsed_at":"2023-01-14T00:19:53.905Z","dependency_job_id":null,"html_url":"https://github.com/FrancescoSaverioZuppichini/API-Class","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrancescoSaverioZuppichini%2FAPI-Class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrancescoSaverioZuppichini%2FAPI-Class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrancescoSaverioZuppichini%2FAPI-Class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrancescoSaverioZuppichini%2FAPI-Class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FrancescoSaverioZuppichini","download_url":"https://codeload.github.com/FrancescoSaverioZuppichini/API-Class/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222376246,"owners_count":16974312,"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":["javascript","webdevelopment"],"created_at":"2024-07-31T19:01:11.559Z","updated_at":"2024-10-31T07:31:05.941Z","avatar_url":"https://github.com/FrancescoSaverioZuppichini.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# API Class\n### faster way to generate API calls with axios\n\n## Installation\nYou can install the package using `npm`\n\n```\nnpm install api-class\n```\n\nhttps://www.npmjs.com/package/api-class\n## Usage\nCreate an `API` instance by import the `API` class from `api-class`. As parameter pass the basic url of your api.\n\n```javascript\nconst myAPI = new API({ url: '/api' })\n```\n### Endpoints\nTo add an endpoint, use the `.createEntity` method.\n\n```javascript\nconst myAPI = new API({ url: '/api' })\nmyAPI.createEntity({ name : 'posts' })\nmyApi.endpoints.posts.getAll()\n\n```\n\n### Methods\nAll `API`'s endpoints have basic CRUD operations\n\n```javascript\ngetAll(params, config)\ngetOne({ id }, config)\ncreate(toCreate, config)\nupdate(toUpdate, config)\ndelete({ id }, config)\n```\n### Q\u0026A\n\nHow to pass headers to axios?\n\n```javascript\nconst myAPI = new API({ url: '/api' })\nmyAPI.createEntity({ name : 'posts' })\nmyAPI.endpoints.posts({ id: 0 },  { headers: {....} } )\n```\nYou can check it out my medium article for further informations\n\nhttps://medium.com/@FrancescoZ/how-to-call-api-in-a-smart-way-2ca572c6fe86\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrancescoSaverioZuppichini%2FAPI-Class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFrancescoSaverioZuppichini%2FAPI-Class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFrancescoSaverioZuppichini%2FAPI-Class/lists"}