{"id":16092827,"url":"https://github.com/dleitee/fetches","last_synced_at":"2025-03-17T17:31:08.171Z","repository":{"id":57234799,"uuid":"133810794","full_name":"dleitee/fetches","owner":"dleitee","description":"🦑Fetches is a workaround to make requests, in an easy and scalable way.","archived":false,"fork":false,"pushed_at":"2020-06-02T18:14:31.000Z","size":3041,"stargazers_count":16,"open_issues_count":16,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-08T14:36:12.777Z","etag":null,"topics":["async","fetch","frontend","javascript"],"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/dleitee.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":"2018-05-17T12:33:40.000Z","updated_at":"2023-03-11T12:20:55.000Z","dependencies_parsed_at":"2022-09-07T12:02:44.328Z","dependency_job_id":null,"html_url":"https://github.com/dleitee/fetches","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dleitee%2Ffetches","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dleitee%2Ffetches/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dleitee%2Ffetches/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dleitee%2Ffetches/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dleitee","download_url":"https://codeload.github.com/dleitee/fetches/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243872346,"owners_count":20361459,"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":["async","fetch","frontend","javascript"],"created_at":"2024-10-09T16:44:12.832Z","updated_at":"2025-03-17T17:31:07.864Z","avatar_url":"https://github.com/dleitee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fetches\n[![codecov](https://codecov.io/gh/dleitee/fetches/branch/master/graph/badge.svg?token=U3H6jLNbac)](https://codecov.io/gh/dleitee/fetches) [![CircleCI](https://circleci.com/gh/dleitee/fetches.svg?style=svg\u0026circle-token=f42a433fef54fd17c818742c05907d4232ccb224)](https://circleci.com/gh/dleitee/fetches) [![Greenkeeper badge](https://badges.greenkeeper.io/dleitee/fetches.svg?token=1574e399ea4865ffbdc06a581673c7ae27e783771d794f9a97a6931118cbdab6\u0026ts=1528215914233)](https://greenkeeper.io/)\n\nFetches is a workaround to make requests, in an easy and scalable way.\n\nWith Fetches you can define your main settings (URL, Auth Header, Request Type, etc), in a single place and then make requests using this info.\n\n## Table of Contents\n\n - [Install](#install)\n - [Example](#example)\n - [API Reference](#api-reference)\n   - [Client](#client-instance)\n   - [createClient](#function-createclient)\n   - [getHTTPMethods](#function-gethttpmethods)\n - [Browser Support](#browser-support)\n - [How to Contribute](#how-to-contribute)\n - [License](#license)\n\n\n## Install\n\n```sh\nnpm install --save fetches\n```\n\n## Example\n\nHere we will show a simple request to **pokeapi**, getting the first pokemon.\n\n```es6\nimport { createClient, getHTTPMethods } from 'fetches'\n\nconst client = createClient('http://pokeapi.co/api/v2/')\n\nconst http = getHTTPMethods(client)\n\nconst bulbasaur = await http.get('pokemon/1') \n```\n\n## API Reference\n\n### Client instance\n\n#### Methods\n\n - **getURI** - returns the URI of client.\n\n### Function createClient\n\n#### Syntax\n\n```es6\n(uri, [options]) =\u003e Client\n```\n\n#### Import\n\n```es6\nimport { createClient } from 'fetches'\n```\n\n#### Parameters\n\n - **uri** - The URI of your API.\n - **options** - *optional* - An object containing the settings for all requests made by this created client.\n   - **request** - *default: {}* - The same custom settings accepted by [fetch](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Syntax)\n   - **uri** - *default: { removeTrailingSlash: false }* - The same setting accepted by [sindresorhus/normalize-url](https://github.com/sindresorhus/normalize-url)\n\n\n### Function getHTTPMethods\n\n#### Syntax\n\n```es6\n(client) =\u003e Object\n```\n\n#### Import\n\n```es6\nimport { getHTTPMethods } from 'fetches'\n```\n\n#### HTTP Methods\n\n - **get(uri, [params, [options]])**\n   - **uri** - String, Array\\\u003cString\\\u003e - the complement of your main URI. \n   - **params** - Object - *optional* - URL query params.\n   - **options** - Object - *optional* - The same custom settings accepted by [fetch](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Syntax)\n   \n   \n - **post(uri, [params, [options]])**\n   - **uri** - String, Array\\\u003cString\\\u003e - the complement of your main URI. \n   - **data** - Object - *optional* - The body of request.\n   - **options** - Object - *optional* - The same custom settings accepted by [fetch](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Syntax)\n   \n - **put(uri, [params, [options]])**\n   - **uri** - String, Array\\\u003cString\\\u003e - the complement of your main URI. \n   - **data** - Object - *optional* - The body of request.\n   - **options** - Object - *optional* - The same custom settings accepted by [fetch](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Syntax)\n\n - **patch(uri, [params, [options]])**\n   - **uri** - String, Array\\\u003cString\\\u003e - the complement of your main URI. \n   - **data** - Object - *optional* - The body of request.\n   - **options** - Object - *optional* - The same custom settings accepted by [fetch](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Syntax)\n\n - **delete(uri, [params, [options]])**\n   - **uri** - String, Array\\\u003cString\\\u003e - the complement of your main URI. \n   - **data** - Object - *optional* - The body of request.\n   - **options** - Object - *optional* - The same custom settings accepted by [fetch](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Syntax)\n\n## Browser Support\n\nFetches is based on [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API), which the most of modern browsers already are compatible, but if you need to be compatible with an older browser, you may use this [polyfill](https://github.com/github/fetch)\n\n## How to Contribute\n\n1. Fork it!\n1. Create your feature branch: `git checkout -b my-new-feature`\n1. Commit your changes: `git commit -m 'Add some feature'`\n1. Push to the branch: `git push origin my-new-feature`\n1. Submit a pull request :)\n\n## License\n\nMIT License\n\nCopyright (c) 2018 Daniel Leite de Oliveira\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdleitee%2Ffetches","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdleitee%2Ffetches","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdleitee%2Ffetches/lists"}