{"id":23222959,"url":"https://github.com/dckt/rescript-ky-promise","last_synced_at":"2026-02-27T00:03:46.626Z","repository":{"id":223254843,"uuid":"759717151","full_name":"DCKT/rescript-ky-promise","owner":"DCKT","description":"ReScript bindings for ky HTTP client with rescript-promise","archived":false,"fork":false,"pushed_at":"2024-02-19T08:15:29.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T16:35:05.793Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"ReScript","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/DCKT.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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":"2024-02-19T07:48:57.000Z","updated_at":"2024-02-19T07:49:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"1aa11567-ac6d-4c2e-8ee8-477ec7126284","html_url":"https://github.com/DCKT/rescript-ky-promise","commit_stats":null,"previous_names":["dckt/rescript-ky-promise"],"tags_count":1,"template":false,"template_full_name":"DCKT/rescript-bindings-template","purl":"pkg:github/DCKT/rescript-ky-promise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCKT%2Frescript-ky-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCKT%2Frescript-ky-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCKT%2Frescript-ky-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCKT%2Frescript-ky-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DCKT","download_url":"https://codeload.github.com/DCKT/rescript-ky-promise/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCKT%2Frescript-ky-promise/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29878275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"ssl_error","status_checked_at":"2026-02-26T23:50:46.793Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-18T23:15:32.373Z","updated_at":"2026-02-27T00:03:46.620Z","avatar_url":"https://github.com/DCKT.png","language":"ReScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rescript-ky-promise\n\nReScript bindings for [ky HTTP client](https://github.com/sindresorhus/ky) (targeted version : `~1.2.0`) with [rescript-promise](https://github.com/DCKT/rescript-promise) module.\n\n## Setup\n\n1. Install the module\n\n```bash\nbun install @dck/rescript-ky-promise\n# or\nyarn install @dck/rescript-ky-promise\n# or\nnpm install @dck/rescript-ky-promise\n```\n\n2. Add it to your `rescript.json` config\n\n```json\n{\n  \"bsc-dependencies\": [\"@dck/rescript-ky-promise\"]\n}\n```\n\n## Usage\n\nThe functions can be accessed through `Ky` module.\n\n```rescript\ntype data = {anything: string}\n\nlet fetchSomething = async () =\u003e {\n  try {\n    let response: data = await Ky.fetch(\"test\", {prefixUrl: \"https://fake.com\", method: GET}).json()\n    // handle response data\n  } catch {\n    | JsError(err) =\u003e {\n      // handle err\n      Js.log(err)\n    }\n  }\n}\n```\n\nUse shortcut method :\n\n```rescript\ntype data = {anything: string}\n\nlet fetchSomething = async () =\u003e {\n  try {\n    let response: data = await Ky.get(\"test\", {prefixUrl: \"https://fake.com\"}).json()\n    // handle response data\n  } catch {\n    | JsError(err) =\u003e {\n      // handle err\n      Js.log(err)\n    }\n  }\n}\n```\n\n### Instance\n\n```rescript\nlet instance = Ky.Instance.create({prefixUrl: \"https://fake.com\"})\n\ntype data = {anything: string}\n\nlet fetchSomething = async () =\u003e {\n  try {\n    let response: data = await (instance-\u003eKy.Instance.get(\"test\")).json()\n    // handle response data\n  } catch {\n    | JsError(err) =\u003e {\n      // handle err\n      Js.log(err)\n    }\n  }\n}\n```\n\n### Extend\n\n```rescript\nlet instance = Ky.Instance.create({prefixUrl: \"https://fake.com\"})\nlet extendedInstance = instance-\u003eKy.Instance.extend({\n  prefixUrl: `${mockBasePath}/extend`,\n  headers: Ky.Headers.fromObj({\n    \"custom-header\": \"test\",\n  }),\n})\n\ntype data = {anything: string}\n\nlet fetchSomething = async () =\u003e {\n  try {\n    let response: data = await (extendedInstance-\u003eKy.Instance.get(\"test\")).json()\n    // handle response data\n  } catch {\n    | JsError(err) =\u003e {\n      // handle err\n      Js.log(err)\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdckt%2Frescript-ky-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdckt%2Frescript-ky-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdckt%2Frescript-ky-promise/lists"}