{"id":19542576,"url":"https://github.com/fable-compiler/fable-fetch","last_synced_at":"2025-04-26T17:31:18.112Z","repository":{"id":40271457,"uuid":"161153694","full_name":"fable-compiler/fable-fetch","owner":"fable-compiler","description":"Fable bindings for Browsers' Fetch API","archived":false,"fork":false,"pushed_at":"2025-02-18T13:21:54.000Z","size":333,"stargazers_count":17,"open_issues_count":6,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-04T16:42:02.663Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"F#","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/fable-compiler.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-10T09:57:25.000Z","updated_at":"2024-06-17T12:33:23.000Z","dependencies_parsed_at":"2024-06-17T14:09:40.467Z","dependency_job_id":null,"html_url":"https://github.com/fable-compiler/fable-fetch","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/fable-compiler%2Ffable-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fable-compiler%2Ffable-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fable-compiler%2Ffable-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fable-compiler%2Ffable-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fable-compiler","download_url":"https://codeload.github.com/fable-compiler/fable-fetch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251025751,"owners_count":21524856,"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-11-11T03:15:08.978Z","updated_at":"2025-04-26T17:31:17.770Z","avatar_url":"https://github.com/fable-compiler.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fable.Fetch\n\nFable bindings for Browsers' [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n\nIf you need helpers for automatic JSON serialization, check [Thoth.Fetch](https://github.com/thoth-org/Thoth.Fetch#thothfetch-).\n\n- Run tests: `npm test`\n- Publish: `npm run publish` (first bump version in RELEASE_NOTES.md and put your Nuget key in NUGET_KEY env var)\n\n## Usage\n\n```fsharp\ntype IUser =\n  abstract name: string\n\nlet fetchGitHubUser accessToken =\n  async {\n    let! response =\n     fetch \"https://api.github.com/user\" [\n          requestHeaders [\n              HttpRequestHeaders.Authorization $\"token {accessToken}\"\n          ] ] |\u003e Async.AwaitPromise\n    let! item = response.json\u003cIUser\u003e() |\u003e Async.AwaitPromise\n  }\n```\n\nResponse Usage\n\nNormally you don't need to use Response manually but, if you are in a service worker and intercepting fetch requests, you can programatically create responses that satisfy your logic, there are a few javascript runtimes that also offer http frameworks that work with responses directly so here is a few ways to create responses\n\n```fsharp\nResponse.create(\"Hello World!\", [Status 200; ])\nResponse.create(\"Teapot!\", [Status 418; Headers [| \"x-tea\", \"green\" |] ])\nResponse.create(\"Bad Request!\", [Status 400; Headers [| \"x-custom\", \"fable\" |] ])\nResponse.create(\"\"\"{ \"message\": \"Bad Request!\" }\"\"\", [Status 400; Headers [| \"content-type\", \"application/json\" |] ])\nResponse.create(\n  Blob.Create([| csvfile |], unbox {| ``type`` = \"text/csv\" |}),\n  [ Status 200; Headers [\"content-type\", \"text/csv\"] ]\n)\n\n```\n\nCheck the [tests](https://github.com/fable-compiler/fable-fetch/blob/master/tests/FetchTests.fs) for other examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffable-compiler%2Ffable-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffable-compiler%2Ffable-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffable-compiler%2Ffable-fetch/lists"}