{"_id":"@bonny-kato/httpclient","_rev":"4-034282b59a65a106732a2bf54459a3ab","name":"@bonny-kato/httpclient","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"@bonny-kato/httpclient","version":"0.0.1","description":"LocalStorage class is a convenient tool for interacting with the local storage and performing operations such as storing/retrieving key-value pairs.","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/index.d.ts","scripts":{"build":"rollup -c"},"keywords":["http client","request"],"author":{"name":"Bonny Kato"},"devDependencies":{"@rollup/plugin-alias":"^5.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/node":"^20.11.17","@types/react":"^18.2.56","husky":"^9.0.11","prettier":"^3.2.5","rollup":"^4.10.0","rollup-plugin-dts":"^6.1.0","rollup-plugin-node-polyfills":"^0.2.1","tslib":"^2.6.2","typescript":"^5.3.3"},"repository":{"type":"git","url":"git://github.com/Bonny-kato/local-storage.git"},"license":"ISC","_id":"@bonny-kato/httpclient@0.0.1","gitHead":"61b9fd311b884fb4c23ebe439f51dd7ba75f21da","bugs":{"url":"https://github.com/Bonny-kato/local-storage/issues"},"homepage":"https://github.com/Bonny-kato/local-storage#readme","_nodeVersion":"18.17.1","_npmVersion":"10.3.0","dist":{"integrity":"sha512-sX5ptNXbinNKN1HYgDWdPrbzVndif9t31F8Fsce2H6nu6w/3nB7UOir3aG5CoTyeT/oDEHqxxRWcrq0+P6qlQw==","shasum":"d04f520df0ffa775303facfa9e5483056baf5d71","tarball":"https://registry.npmjs.org/@bonny-kato/httpclient/-/httpclient-0.0.1.tgz","fileCount":9,"unpackedSize":15189,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC3cbs+Wdxq+rg3yXH7ugF4NoXjU1riSS9zV1oQQ2+6OAIhAI33JbSWT0gf6kw+MMyMfBBxpkVadYDJSGgvMcADoqmr"}]},"_npmUser":{"name":"bonny-kato","email":"6onnykato@gmail.com"},"directories":{},"maintainers":[{"name":"bonny-kato","email":"6onnykato@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/httpclient_0.0.1_1711449412697_0.6802368537891688"},"_hasShrinkwrap":false},"0.0.2":{"name":"@bonny-kato/httpclient","version":"0.0.2","description":"## Overview","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/index.d.ts","scripts":{"build":"rollup -c"},"keywords":["http client","request"],"author":{"name":"Bonny Kato"},"devDependencies":{"@rollup/plugin-alias":"^5.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/node":"^20.11.17","@types/react":"^18.2.56","husky":"^9.0.11","prettier":"^3.2.5","rollup":"^4.10.0","rollup-plugin-dts":"^6.1.0","rollup-plugin-node-polyfills":"^0.2.1","tslib":"^2.6.2","typescript":"^5.3.3"},"repository":{"type":"git","url":"git://github.com/Bonny-kato/local-storage.git"},"license":"ISC","_id":"@bonny-kato/httpclient@0.0.2","gitHead":"debcdffeb235eddc3362afe2bb744f07ff72bc91","bugs":{"url":"https://github.com/Bonny-kato/local-storage/issues"},"homepage":"https://github.com/Bonny-kato/local-storage#readme","_nodeVersion":"18.17.1","_npmVersion":"10.3.0","dist":{"integrity":"sha512-X660VZu9TP5bSa5vIM2913QceD4y1rARt706qdXSEDFDqnYrdFs+nE8L5oGi96brYWo1xfUKfcLygoPzFPDo7g==","shasum":"afa8e3c411d6617fe667abc6b4c9f8d5d69d1a50","tarball":"https://registry.npmjs.org/@bonny-kato/httpclient/-/httpclient-0.0.2.tgz","fileCount":9,"unpackedSize":17976,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKPUT/ViRey4rnjVAFPgVpX3To95N0GqPS1xBwicyI/wIhALfRoJgOsBJXawbZVzqRLik+ydTkCp/ZQAU/St9gIHiS"}]},"_npmUser":{"name":"bonny-kato","email":"6onnykato@gmail.com"},"directories":{},"maintainers":[{"name":"bonny-kato","email":"6onnykato@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/httpclient_0.0.2_1711452025538_0.3339170567507621"},"_hasShrinkwrap":false},"0.0.3":{"name":"@bonny-kato/httpclient","version":"0.0.3","description":"## Overview","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/index.d.ts","scripts":{"build":"rollup -c"},"keywords":["http client","request"],"author":{"name":"Bonny Kato"},"devDependencies":{"@rollup/plugin-alias":"^5.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/node":"^20.11.17","@types/react":"^18.2.56","husky":"^9.0.11","prettier":"^3.2.5","rollup":"^4.10.0","rollup-plugin-dts":"^6.1.0","rollup-plugin-node-polyfills":"^0.2.1","tslib":"^2.6.2","typescript":"^5.3.3"},"repository":{"type":"git","url":"git://github.com/Bonny-kato/http-client.git"},"license":"ISC","_id":"@bonny-kato/httpclient@0.0.3","gitHead":"debcdffeb235eddc3362afe2bb744f07ff72bc91","bugs":{"url":"https://github.com/Bonny-kato/http-client/issues"},"homepage":"https://github.com/Bonny-kato/http-client#readme","_nodeVersion":"18.17.1","_npmVersion":"10.3.0","dist":{"integrity":"sha512-/mqE+irKwDaBC4FMysSngeTskJV5QgruZgrPhIExRaWe7mnRfA8umbK9q9S1DbNnFqYZnMKxVhUg5eugKYmSVQ==","shasum":"d2fa32fa335f43031359de587938419f8fdd9bb9","tarball":"https://registry.npmjs.org/@bonny-kato/httpclient/-/httpclient-0.0.3.tgz","fileCount":9,"unpackedSize":17974,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDgmopKwuC1GIanNHHzCJP96p+KfD3vxfS6+qOcV2df1AiATybRITpQW/oSHYs/GYvzR8tBprWbO2GxLL7GURvg67Q=="}]},"_npmUser":{"name":"bonny-kato","email":"6onnykato@gmail.com"},"directories":{},"maintainers":[{"name":"bonny-kato","email":"6onnykato@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/httpclient_0.0.3_1711454551324_0.12353568603521592"},"_hasShrinkwrap":false},"0.0.4":{"name":"@bonny-kato/httpclient","version":"0.0.4","description":"HttpClient is a simple HTTP client for making asynchronous HTTP requests in JavaScript using built-in fetch api. It supports various HTTP methods such as `GET`, `POST`, `PUT`, and `DELETE`.","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/index.d.ts","scripts":{"build":"rollup -c"},"keywords":["http client","request","fetch"],"author":{"name":"Bonny Kato","email":"6onnykato@gmail.com","url":"https://bonny-kato.github.io"},"devDependencies":{"@rollup/plugin-alias":"^5.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/node":"^20.11.17","@types/react":"^18.2.56","husky":"^9.0.11","prettier":"^3.2.5","rollup":"^4.10.0","rollup-plugin-dts":"^6.1.0","rollup-plugin-node-polyfills":"^0.2.1","tslib":"^2.6.2","typescript":"^5.3.3"},"repository":{"type":"git","url":"git://github.com/Bonny-kato/http-client.git"},"license":"ISC","_id":"@bonny-kato/httpclient@0.0.4","gitHead":"8c770fe84f60abc41abce73d6e9740f6c6b6516f","bugs":{"url":"https://github.com/Bonny-kato/http-client/issues"},"homepage":"https://github.com/Bonny-kato/http-client#readme","_nodeVersion":"18.17.1","_npmVersion":"10.3.0","dist":{"integrity":"sha512-hOmFHBnIEU8x1/fudzKySBcY4eMBcdgLmDGXkqeBKsUq/mUUGr45MCoyG82XDZu1nMFSQc83dLXNpthkGtODHA==","shasum":"ca680b961225f8c280b5fd66aca4aad4965fe8ec","tarball":"https://registry.npmjs.org/@bonny-kato/httpclient/-/httpclient-0.0.4.tgz","fileCount":9,"unpackedSize":23473,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDXkP46ZdUj1G9Al9yVmAtrNPPusWXa0cM09Ol2sw52aAIgau/iPFYmcXJvb7rmcxBVy6KJOGL+L/oQr/3r8m9PvJc="}]},"_npmUser":{"name":"bonny-kato","email":"6onnykato@gmail.com"},"directories":{},"maintainers":[{"name":"bonny-kato","email":"6onnykato@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/httpclient_0.0.4_1711486359290_0.26564897587081693"},"_hasShrinkwrap":false},"0.0.5":{"name":"@bonny-kato/httpclient","version":"0.0.5","description":"HttpClient is a simple HTTP client for making asynchronous HTTP requests in JavaScript using built-in fetch api. It supports various HTTP methods such as `GET`, `POST`, `PUT`, and `DELETE`.","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/index.d.ts","scripts":{"build":"rollup -c"},"keywords":["http client","request","fetch"],"author":{"name":"Bonny Kato","email":"6onnykato@gmail.com","url":"https://bonny-kato.github.io"},"devDependencies":{"@rollup/plugin-alias":"^5.1.0","@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/node":"^20.11.17","@types/react":"^18.2.56","husky":"^9.0.11","prettier":"^3.2.5","rollup":"^4.10.0","rollup-plugin-dts":"^6.1.0","rollup-plugin-node-polyfills":"^0.2.1","tslib":"^2.6.2","typescript":"^5.3.3"},"repository":{"type":"git","url":"git://github.com/Bonny-kato/http-client.git"},"license":"ISC","_id":"@bonny-kato/httpclient@0.0.5","gitHead":"296cd04c5ebabfa6ab47ec41cd496fd7391d5e6d","bugs":{"url":"https://github.com/Bonny-kato/http-client/issues"},"homepage":"https://github.com/Bonny-kato/http-client#readme","_nodeVersion":"18.17.1","_npmVersion":"10.3.0","dist":{"integrity":"sha512-nWFtH7Mw5l8VTpe/eeYjizj7izm9Db1uTencw48Yhuz76rXA7gcAjkxNtA31wp3fZzXwb3bUCkXNcMCGVEOWvQ==","shasum":"914fa176d7bfdf500e1fbb4c6d5670fb14d585c0","tarball":"https://registry.npmjs.org/@bonny-kato/httpclient/-/httpclient-0.0.5.tgz","fileCount":9,"unpackedSize":23581,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDU3lheJs4T8wiUaJlOgSfc4Gnx4l/8HFnp6kYDUJBaSwIgMB1NVPk2RM4YGVRr9uAAMRPs5rTMQCvk5G9ALt/NSuo="}]},"_npmUser":{"name":"bonny-kato","email":"6onnykato@gmail.com"},"directories":{},"maintainers":[{"name":"bonny-kato","email":"6onnykato@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/httpclient_0.0.5_1711516568336_0.42861784747347276"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-26T10:36:52.588Z","0.0.1":"2024-03-26T10:36:52.880Z","modified":"2024-03-27T05:16:09.139Z","0.0.2":"2024-03-26T11:20:25.693Z","0.0.3":"2024-03-26T12:02:31.514Z","0.0.4":"2024-03-26T20:52:39.498Z","0.0.5":"2024-03-27T05:16:08.475Z"},"maintainers":[{"name":"bonny-kato","email":"6onnykato@gmail.com"}],"description":"HttpClient is a simple HTTP client for making asynchronous HTTP requests in JavaScript using built-in fetch api. It supports various HTTP methods such as `GET`, `POST`, `PUT`, and `DELETE`.","homepage":"https://github.com/Bonny-kato/http-client#readme","keywords":["http client","request","fetch"],"repository":{"type":"git","url":"git://github.com/Bonny-kato/http-client.git"},"author":{"name":"Bonny Kato","email":"6onnykato@gmail.com","url":"https://bonny-kato.github.io"},"bugs":{"url":"https://github.com/Bonny-kato/http-client/issues"},"license":"ISC","readme":"# HttpClient\n\n## Overview\n\nHttpClient is a simple HTTP client for making asynchronous HTTP requests in JavaScript using built-in fetch api. It supports various HTTP methods such as `GET`, `POST`, `PUT`, and `DELETE`.\n\n## Inspiration\nThis utility function, used to initiate HTTP requests, was copied/pasted/modified from a version originally created by [Walter Kimaro](https://github.com/jestrux).\n\n## Installation\n- using npm\n    ```bash\n    npm i @bonny-kato/httpclient\n    ```\n- using yarn\n    ```bash\n    yarn add @bonny-kato/httpclient\n    ```\n\n\n## Usage\n### Constructor\n```ts\nimport HttpClient from \"@bonny-kato/httpclient\";\n\nconst httpClient = new HttpClient({\n    baseUrl: 'https://api.example.com',\n    headers: {\n        'Authorization': 'Bearer YOUR_ACCESS_TOKEN'\n    }\n});\n```\n\n\n### Methods\n\n### get\nMakes an asynchronous GET request to the specified endpoint.\n\n```ts\nhttpClient.get(endpoint);\n```\n\n### post\nMake a POST request to the specified endpoint with the provided data\n```ts\nhttpClient.post(endpoint, data);\n```\n\n### put\nSends a PUT request to the specified endpoint with the provided data.\n```ts\nhttpClient.put(endpoint, data);\n```\n\n### remove\nRemoves a resource from the server.\n```ts\nhttpClient.remove(endpoint);\n```\n\n\n### Examples\n```ts\n// Get users\nconst getUsers = () => {\n    return httpClient.get(\"/users\");\n}\n\n// Add user\nconst addUser = (data: User) => {\n    return httpClient.post(\"/users\", data);\n}\n\n// Update user\nconst updateUser = (userId: string, data: User) => {\n    return httpClient.put(`/users/${userId}`, data);\n}\n\n// Remove user\nconst removeUser = (userId: string) => {\n    return httpClient.remove(`/users/${userId}`);\n}\n```\n### Interfaces\n\n#### `IHeaders`\n\n```typescript\nexport interface IHeaders {\n    \"Content-Type\"?: \"multipart/form-data\" | \"application/json\" | undefined;\n    Authorization?: string;\n}\n```\n\n#### `IHeaders`\n```ts\nexport interface IConfig {\n    baseUrl: string;\n    headers?: IHeaders;\n}\n```\n\n#### `HttpMethod`\n```ts\nexport type HttpMethod = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\";\n```\n\n\n### API Reference\n\n#### Constructor\n\n#### `new HttpClient(config: IConfig)`\n\nCreate a new instance of HttpClient.\n\n- `config`: An object containing configuration options.\n    - `baseUrl` (string): The base URL for API requests.\n    - `headers` (IHeaders): Optional. Custom headers to be included in each request.\n\n#### Methods\n\n#### `request(method: HttpMethod, endpoint: string, data?: any): Promise<any>`\n\nMakes a generic HTTP request.\n\n- `method` (HttpMethod): The HTTP method for the request.\n- `endpoint` (string): The endpoint URL.\n- `data` (any): Optional. Data to be sent in the request body.\n\n#### `get(endpoint: string): Promise<any>`\n\nMakes an asynchronous GET request.\n\n- `endpoint` (string): The endpoint URL.\n\n#### `post(endpoint: string, data: object): Promise<any>`\n\nMakes a POST request.\n\n- `endpoint` (string): The endpoint URL.\n- `data` (object): Data to be sent in the request body.\n\n#### `put(endpoint: string, data: object): Promise<any>`\n\nSends a PUT request.\n\n- `endpoint` (string): The endpoint URL.\n- `data` (object): Data to be sent in the request body.\n\n#### `remove(endpoint: string): Promise<void>`\n\nRemoves a resource.\n\n- `endpoint` (string): The endpoint URL.\n\n\n### License\n\nThis project is licensed under the MIT License\n","readmeFilename":"README.md"}