{"id":22092246,"url":"https://github.com/pirxpilot/fetchagent","last_synced_at":"2025-03-23T23:45:42.328Z","repository":{"id":57234745,"uuid":"77503742","full_name":"pirxpilot/fetchagent","owner":"pirxpilot","description":"Flex API for global fetch","archived":false,"fork":false,"pushed_at":"2024-01-23T08:58:50.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-23T17:33:25.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/pirxpilot.png","metadata":{"files":{"readme":"Readme.md","changelog":"History.md","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":"2016-12-28T04:49:25.000Z","updated_at":"2022-01-29T15:39:22.000Z","dependencies_parsed_at":"2024-12-01T03:08:55.195Z","dependency_job_id":"7faefe53-28f9-4654-ba01-1e63ba53bfe6","html_url":"https://github.com/pirxpilot/fetchagent","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Ffetchagent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Ffetchagent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Ffetchagent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pirxpilot%2Ffetchagent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pirxpilot","download_url":"https://codeload.github.com/pirxpilot/fetchagent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245186928,"owners_count":20574554,"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":[],"created_at":"2024-12-01T03:08:51.850Z","updated_at":"2025-03-23T23:45:42.304Z","avatar_url":"https://github.com/pirxpilot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM version][npm-image]][npm-url]\n[![Build Status][build-image]][build-url]\n[![Dependency Status][deps-image]][deps-url]\n\n# fetchagent\n\nFlex API for global fetch\n\n## Install\n\n```sh\n$ npm install --save fetchagent\n```\n\n## Usage\n\n```js\nvar fa = require('fetchagent');\n\n\n// using callbacks\nfa\n  .get('http://httpbin.org/xml')\n  .end(function(err, response) {\n    if (err) {\n      console.log(err, status);\n    }\n    console.log(\"Received:\", response);\n  });\n\n// using promises\nfa\n  .post('http://httpbin.org/post')\n  .send({ echo: 42 })\n  .json()\n  .then(function(response) {\n    console.log(\"Received:\", response.echo);\n  });\n\n```\n\n# API\n\nTo configure request use one or more:\n\n- `get(url)`, `put(url)`, `post(url)`, `delete(url)` - HTTP method to `url`\n- `query()` - sets search params (a.k.a querystring)\n- `set(name, vale)` - sets header `name` to `value`\n- `set(obj)` - sets headers for all properties of the `object`\n- `redirect(flag)` - pass truthy value if fetchagent is supposed to automatically handle redirects\n\nTo send request use on of:\n\n- `end(callback)` - pass `callback(err, body)`\n- `end()` - returns a Promise that resolves to a response\n- `json()` - returns a Promise resolving to a parsed object\n- `text()` - returns a Promise resolving to a body text\n\n## License\n\nMIT © [Damian Krzeminski](https://pirxpilot.me)\n\n[npm-image]: https://img.shields.io/npm/v/fetchagent\n[npm-url]: https://npmjs.org/package/fetchagent\n\n[build-url]: https://github.com/pirxpilot/fetchagent/actions/workflows/check.yaml\n[build-image]: https://img.shields.io/github/actions/workflow/status/pirxpilot/fetchagent/check.yaml?branch=main\n\n[deps-image]: https://img.shields.io/librariesio/release/npm/fetchagent\n[deps-url]: https://libraries.io/npm/fetchagent\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirxpilot%2Ffetchagent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpirxpilot%2Ffetchagent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpirxpilot%2Ffetchagent/lists"}