{"id":20873809,"url":"https://github.com/dbtek/fresource","last_synced_at":"2025-05-12T13:34:28.353Z","repository":{"id":57241778,"uuid":"156552670","full_name":"dbtek/fresource","owner":"dbtek","description":"A full featured Rest API client around window.fetch to provide idiomatic interaction (under 1kB)","archived":false,"fork":false,"pushed_at":"2024-01-05T15:41:43.000Z","size":262,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-08T21:53:02.924Z","etag":null,"topics":["ajax","api","client","fetch","resource","rest","tiny"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbtek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-07T13:45:16.000Z","updated_at":"2024-06-28T11:22:54.000Z","dependencies_parsed_at":"2022-09-08T00:40:54.886Z","dependency_job_id":null,"html_url":"https://github.com/dbtek/fresource","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbtek%2Ffresource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbtek%2Ffresource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbtek%2Ffresource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbtek%2Ffresource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbtek","download_url":"https://codeload.github.com/dbtek/fresource/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225138300,"owners_count":17426760,"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":["ajax","api","client","fetch","resource","rest","tiny"],"created_at":"2024-11-18T06:27:33.354Z","updated_at":"2024-11-18T06:27:33.972Z","avatar_url":"https://github.com/dbtek.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003ef·resource\u003c/h1\u003e\n  \u003c!-- Test Coverage --\u003e\n  \u003ca href=\"https://codecov.io/github/dbtek/fresource\"\u003e\n    \u003cimg src=\"https://img.shields.io/codecov/c/github/dbtek/fresource/main.svg?style=for-the-badge\"\n      alt=\"Test Coverage\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Standard --\u003e\n  \u003ca href=\"https://standardjs.com\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=for-the-badge\u0026logo=javascript\"\n      alt=\"Standard\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\u003cbr/\u003e\n\u003cdiv align=\"center\"\u003e\n  All in one client for your REST API under 1kB. \n\u003c/div\u003e\n\n## Install\nWith npm:\n```bash\n$ npm i fresource --save\n```\n\nVia CDN:\n```html\n\u003cscript src=\"https://unpkg.com/fresource/dist/fresource.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n```js\nvar fresource = require('fresource')\n\nvar Users = fresource('/api/users/:id?sort=:sort')\n\nUsers.get({ sort: 'name' }) // will fetch /api/users?sort=name\n  .then(result =\u003e {\n    var users = result\n  })\n\nUsers.get({ id: 1 }) // will fetch /api/users/1\n  .then(result =\u003e {\n    var user = result\n  })\n```\n\n## API\n\n**Collection = fresource(path)**  \nInitialize a resource with a path / url. Path should include all path / query parameter variables like `:key`.\n\n**Collection.get(params)**  \nFetches a `GET` request with given parameters.  \nReturns promise.\n\n**Collection.save(params)**  \nSends a `POST` request with given parameters. Residual parameters that are not used in url will be posted in body.  \nReturns promise.\n\n**Collection.update(params)**  \nSends a `PUT` request with given parameters. Residual parameters that are not used in url will be posted in body.  \nReturns promise.\n\n**Collection.patch(params)**  \nSends a `PATCH` request with given parameters. Residual parameters that are not used in url will be posted in body.  \nReturns promise.\n\n**Collection.delete(params)**  \nSends a `DELETE` request with given parameters.  \nReturns promise.\n\n## Author\nIsmail Demirbilek [@dbtek](https://twitter.com/dbtek)\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbtek%2Ffresource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbtek%2Ffresource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbtek%2Ffresource/lists"}