{"_id":"@bulutklinik/sdk","_rev":"7-ba9f528c5807af23c20723170d89fbc4","name":"@bulutklinik/sdk","dist-tags":{"latest":"1.1.0"},"versions":{"0.1.0":{"name":"@bulutklinik/sdk","version":"0.1.0","keywords":["bulutklinik","sdk","api","telemedicine","health","appointments","hbys"],"author":{"name":"Bulutklinik"},"license":"MIT","_id":"@bulutklinik/sdk@0.1.0","maintainers":[{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"}],"homepage":"https://github.com/bulutklinik/js-sdk#readme","bugs":{"url":"https://github.com/bulutklinik/js-sdk/issues"},"dist":{"shasum":"744f3a03364751b365d10f283c06500b1759a617","tarball":"https://registry.npmjs.org/@bulutklinik/sdk/-/sdk-0.1.0.tgz","fileCount":10,"integrity":"sha512-H13kr2fjso4SSAF+fgw0WTotmRZcEBBStaEAFpZeZO4llAN4rmZkVftj0gyMIhhNG+hJ5q26SdoLe+9UjJ8stg==","signatures":[{"sig":"MEQCIAf2+8zzbAq+SqHj9cXc5JL+rXenyGKvJShCerZ1D6k3AiBom/zAIyk3DEL30jroA/+2/DAEvjxrGKuinNGqxY/Ktw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bulutklinik%2fsdk@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":206431},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"e7ed6ecf1dc6f80ac2d6ee4977270662f1887b53","scripts":{"lint":"eslint .","test":"vitest run","build":"tsup","check:pkg":"publint && attw --pack .","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"},"repository":{"url":"git+https://github.com/bulutklinik/js-sdk.git","type":"git"},"_npmVersion":"10.9.8","description":"Official Bulutklinik API SDK for JavaScript / TypeScript","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","eslint":"^9.13.0","vitest":"^2.1.0","publint":"^0.3.21","typescript":"^5.6.0","@types/node":"^22.7.0","typescript-eslint":"^8.10.0","@arethetypeswrong/cli":"^0.18.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1781792818811_0.84486129736308","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@bulutklinik/sdk","version":"0.2.0","keywords":["bulutklinik","sdk","api","telemedicine","health","appointments","hbys"],"author":{"name":"Bulutklinik"},"license":"MIT","_id":"@bulutklinik/sdk@0.2.0","maintainers":[{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"}],"homepage":"https://github.com/bulutklinik/js-sdk#readme","bugs":{"url":"https://github.com/bulutklinik/js-sdk/issues"},"dist":{"shasum":"250f91d7016e616bd06afd74b810e3a21a983b7a","tarball":"https://registry.npmjs.org/@bulutklinik/sdk/-/sdk-0.2.0.tgz","fileCount":10,"integrity":"sha512-JUayNiBg4iVcpGEd0R7DxsElypNs14ksp4PZHIxHGfWDJCE58n+fS+1bR9qLrglP+fNbyjtTWdQ0MrsNOyyAbA==","signatures":[{"sig":"MEYCIQC/C51mN4YgM+K62A+aetiw8VN1OI42qxSWyodPQ5/VAwIhAM6iJ3ghOR1PkmIcLNGRsCtbdr9owMrfgnxCaNc5Mlgl","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bulutklinik%2fsdk@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":214839},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"41c91a88fbf871e5f55a6b204761484f44f7ffa3","scripts":{"lint":"eslint .","test":"vitest run","build":"tsup","check:pkg":"publint && attw --pack .","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"},"repository":{"url":"git+https://github.com/bulutklinik/js-sdk.git","type":"git"},"_npmVersion":"10.9.8","description":"Official Bulutklinik API SDK for JavaScript / TypeScript","directories":{},"sideEffects":false,"_nodeVersion":"22.22.3","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","eslint":"^9.13.0","vitest":"^2.1.0","publint":"^0.3.21","typescript":"^5.6.0","@types/node":"^22.7.0","typescript-eslint":"^8.10.0","@arethetypeswrong/cli":"^0.18.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.0_1781859859593_0.284577006556644","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@bulutklinik/sdk","version":"0.3.0","keywords":["bulutklinik","sdk","api","telemedicine","health","appointments","hbys"],"author":{"name":"Bulutklinik"},"license":"MIT","_id":"@bulutklinik/sdk@0.3.0","maintainers":[{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"}],"homepage":"https://github.com/bulutklinik/js-sdk#readme","bugs":{"url":"https://github.com/bulutklinik/js-sdk/issues"},"dist":{"shasum":"3d7c50016aec822bfe1a787aae98865257b26672","tarball":"https://registry.npmjs.org/@bulutklinik/sdk/-/sdk-0.3.0.tgz","fileCount":10,"integrity":"sha512-/SducgIXiP4VPLVVMZwm98dox4MOGmrmcg7+Qup+OaK3sfCKT1EoURq4H+ZXh1/Rujz9P6vfrV0PLrMfS77izQ==","signatures":[{"sig":"MEYCIQDk736Z0CuFm7bLQz7VW3/cdtlzeBQ7rkFiUQm2luJJwwIhALDHgPs40XxhnuCeiHD76pSMaBL6UkCx6GwNivTKiDp0","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bulutklinik%2fsdk@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":234732},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"9ac8e41a4085df5b878d51c31d26b5dc011d3150","scripts":{"lint":"eslint .","test":"vitest run","build":"tsup","check:pkg":"publint && attw --pack .","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"},"repository":{"url":"git+https://github.com/bulutklinik/js-sdk.git","type":"git"},"_npmVersion":"10.9.8","description":"Official Bulutklinik API SDK for JavaScript / TypeScript","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","eslint":"^9.13.0","vitest":"^2.1.0","publint":"^0.3.21","typescript":"^5.6.0","@types/node":"^22.7.0","typescript-eslint":"^8.10.0","@arethetypeswrong/cli":"^0.18.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.3.0_1784036484521_0.002122107685863961","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@bulutklinik/sdk","version":"0.4.0","keywords":["bulutklinik","sdk","api","telemedicine","health","appointments","hbys"],"author":{"name":"Bulutklinik"},"license":"MIT","_id":"@bulutklinik/sdk@0.4.0","maintainers":[{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"}],"homepage":"https://github.com/bulutklinik/js-sdk#readme","bugs":{"url":"https://github.com/bulutklinik/js-sdk/issues"},"dist":{"shasum":"1cf0966945d986328302d74660c9d83beb4e70a4","tarball":"https://registry.npmjs.org/@bulutklinik/sdk/-/sdk-0.4.0.tgz","fileCount":10,"integrity":"sha512-2ZRs/kuQrYpcWEAA53EXoskAI/5mn66Mpt+ypSFic9uFqUsQ7QTfUWM8LA3o2seMQvB2m6XbHn4eASCQWocOeQ==","signatures":[{"sig":"MEQCID2pjvWAH3hDQTiMcGwV2IwFkc5f6IoxWJ9xIZ6VJcZ3AiAJ5uA9NZGYVVWYQ8undRa7WHDTHH3pjOIBAlno3vt1sw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bulutklinik%2fsdk@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":259792},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"0adf922cf78daeaba7f55f28fc610d93ee2e9bb6","scripts":{"lint":"eslint .","test":"vitest run","build":"tsup","check:pkg":"publint && attw --pack .","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"},"repository":{"url":"git+https://github.com/bulutklinik/js-sdk.git","type":"git"},"_npmVersion":"10.9.8","description":"Official Bulutklinik API SDK for JavaScript / TypeScript","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","eslint":"^9.13.0","vitest":"^2.1.0","publint":"^0.3.21","typescript":"^5.6.0","@types/node":"^22.7.0","typescript-eslint":"^8.10.0","@arethetypeswrong/cli":"^0.18.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.4.0_1784631391023_0.5749684314789951","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"name":"@bulutklinik/sdk","version":"0.6.0","keywords":["bulutklinik","sdk","api","telemedicine","health","appointments","hbys"],"author":{"name":"Bulutklinik"},"license":"MIT","_id":"@bulutklinik/sdk@0.6.0","maintainers":[{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"}],"homepage":"https://github.com/bulutklinik/js-sdk#readme","bugs":{"url":"https://github.com/bulutklinik/js-sdk/issues"},"dist":{"shasum":"941a6d16525088e0a0feb460870017421e8b0a95","tarball":"https://registry.npmjs.org/@bulutklinik/sdk/-/sdk-0.6.0.tgz","fileCount":10,"integrity":"sha512-uP7BWizbizBmz1/Jea8PoALHWljDmv6XQfTzToKgHmo2VdPXTZj2WQbVB6jyQ0f2rZiA6U5AEKahy7M0+3USqQ==","signatures":[{"sig":"MEYCIQDx/iRAb51/5ieqeEyhtZenKqzh8r6DKa092qZvm4jBbgIhAIbTzaeK3JhRHpuXBmqQSSQSgj1qg9k3XC+cxdp7Sz7l","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bulutklinik%2fsdk@0.6.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":332615},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"81545a902d59221b17c01fd18e78fed6321292c9","scripts":{"lint":"eslint .","test":"vitest run","build":"tsup","check:pkg":"publint && attw --pack .","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"},"repository":{"url":"git+https://github.com/bulutklinik/js-sdk.git","type":"git"},"_npmVersion":"10.9.8","description":"Official Bulutklinik API SDK for JavaScript / TypeScript","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","eslint":"^9.13.0","vitest":"^2.1.0","publint":"^0.3.21","typescript":"^5.6.0","@types/node":"^22.7.0","typescript-eslint":"^8.10.0","@arethetypeswrong/cli":"^0.18.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.6.0_1784643165677_0.8374624129930586","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bulutklinik/sdk","version":"1.0.1","keywords":["bulutklinik","sdk","api","telemedicine","health","appointments","hbys"],"author":{"name":"Bulutklinik"},"license":"MIT","_id":"@bulutklinik/sdk@1.0.1","maintainers":[{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"}],"homepage":"https://github.com/bulutklinik/js-sdk#readme","bugs":{"url":"https://github.com/bulutklinik/js-sdk/issues"},"dist":{"shasum":"f4a2e6a821b390b95486d2387753ec0260e46f92","tarball":"https://registry.npmjs.org/@bulutklinik/sdk/-/sdk-1.0.1.tgz","fileCount":10,"integrity":"sha512-uicm8SpajgV5ry8np6D6IuKNcyhE3Q9wOLqZgE7HIy/QReg7ZGfg5jMI0l6l8L8KyflpuqKCx5l4ZcGsOQsUlw==","signatures":[{"sig":"MEYCIQDOgu1orikVsJ3SKuQAOOniOqzc9Sr4FypGFg5vLI41iwIhAJh1rbP/QTTeQVfU7X+fixPS1IfjFOSTxxcZnIwGV1V2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bulutklinik%2fsdk@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":234411},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"11749fcc7628607e589b666830d1277a33ade81f","scripts":{"lint":"eslint .","test":"vitest run","build":"tsup","check:pkg":"publint && attw --pack .","typecheck":"tsc --noEmit","test:watch":"vitest","prepublishOnly":"npm run build"},"_npmUser":{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"},"repository":{"url":"git+https://github.com/bulutklinik/js-sdk.git","type":"git"},"_npmVersion":"10.9.8","description":"Official Bulutklinik partner API SDK for JavaScript / TypeScript","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","eslint":"^9.13.0","vitest":"^2.1.0","publint":"^0.3.21","typescript":"^5.6.0","@types/node":"^22.7.0","typescript-eslint":"^8.10.0","@arethetypeswrong/cli":"^0.18.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_1.0.1_1785412432773_0.451255050560208","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@bulutklinik/sdk","version":"1.1.0","description":"Official Bulutklinik partner API SDK for JavaScript / TypeScript","license":"MIT","author":{"name":"Bulutklinik"},"homepage":"https://github.com/bulutklinik/js-sdk#readme","repository":{"type":"git","url":"git+https://github.com/bulutklinik/js-sdk.git"},"bugs":{"url":"https://github.com/bulutklinik/js-sdk/issues"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"sideEffects":false,"scripts":{"build":"tsup","typecheck":"tsc --noEmit","lint":"eslint .","test":"vitest run","test:watch":"vitest","check:pkg":"publint && attw --pack .","prepublishOnly":"npm run build"},"keywords":["bulutklinik","sdk","api","telemedicine","health","appointments","hbys"],"devDependencies":{"@arethetypeswrong/cli":"^0.18.3","@types/node":"^22.7.0","eslint":"^9.13.0","publint":"^0.3.21","tsup":"^8.3.0","typescript":"^5.6.0","typescript-eslint":"^8.10.0","vitest":"^2.1.0"},"_id":"@bulutklinik/sdk@1.1.0","gitHead":"e39fbc431d704740cf1bc98c107e0213ab2a0b5f","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-gkQz9FKXatG+Xph4iaxVBSt63S23edb4ZDf1r66qPLnW5VHnnPTu05mAk7qgT6l6Uol5z7UVYb6FE5E05bv/3Q==","shasum":"96aec12988344e1b4eb32bd5f9c5eae359b15c1a","tarball":"https://registry.npmjs.org/@bulutklinik/sdk/-/sdk-1.1.0.tgz","fileCount":10,"unpackedSize":286440,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@bulutklinik%2fsdk@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEnWxY1phJhroU8bk1O7fmxdKaTRdzxIsyjtWJaYSlzWAiAi7jSmwCX+Nrg1I1i9V4t0DbvQ/m2XLbvdJvmOz2Cy6Q=="}]},"_npmUser":{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"},"directories":{},"maintainers":[{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.1.0_1785422458795_0.35854503166243434"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-18T14:26:58.545Z","modified":"2026-07-30T14:40:59.473Z","0.1.0":"2026-06-18T14:26:58.963Z","0.2.0":"2026-06-19T09:04:19.717Z","0.3.0":"2026-07-14T13:41:24.646Z","0.4.0":"2026-07-21T10:56:31.153Z","0.6.0":"2026-07-21T14:12:45.815Z","1.0.1":"2026-07-30T11:53:52.913Z","1.1.0":"2026-07-30T14:40:58.942Z"},"bugs":{"url":"https://github.com/bulutklinik/js-sdk/issues"},"author":{"name":"Bulutklinik"},"license":"MIT","homepage":"https://github.com/bulutklinik/js-sdk#readme","keywords":["bulutklinik","sdk","api","telemedicine","health","appointments","hbys"],"repository":{"type":"git","url":"git+https://github.com/bulutklinik/js-sdk.git"},"description":"Official Bulutklinik partner API SDK for JavaScript / TypeScript","maintainers":[{"name":"muhammetsafak","email":"info@muhammetsafak.com.tr"}],"readme":"# @bulutklinik/sdk\n\nOfficial Bulutklinik **partner** API SDK for JavaScript / TypeScript. Zero\nruntime dependencies (uses the platform `fetch`), fully typed, ESM + CJS.\n\nThis is a single-persona SDK: every call runs on the company-scoped `/outher`\nsurface with the partner token issued for your integration. You act on the\npatients of **your own company**, and the patient is named inline on each\nrequest — there is no patient session. See [`DESIGN.md`](./DESIGN.md) for\nthe full wire contract.\n\n> **1.1.0 restores `client.auth`.** 1.0.x wrongly assumed the partner token could\n> only be issued out of band; it is in fact minted by `connectApi` from your\n> portal credentials, and it is refreshable. Existing 1.0.x code that passes\n> `partnerToken` keeps working. See [CHANGELOG.md](./CHANGELOG.md).\n\n## Install\n\n```bash\nnpm install @bulutklinik/sdk\n```\n\nRequires Node.js >= 18 (or any runtime with a global `fetch`).\n\n## Quick start\n\n```ts\nimport { BulutklinikClient } from \"@bulutklinik/sdk\";\n\nconst client = new BulutklinikClient({\n  environment: \"production\",  // \"production\" | \"test\" | \"local\"\n  apiVersion: \"v3\",           // \"v3\" (default) | \"v4\"\n  clientId: process.env.BK_CLIENT_ID,\n  clientSecret: process.env.BK_CLIENT_SECRET,\n});\n\n// 0) Log in. Tokens are stored and refreshed for you.\nawait client.auth.connect({\n  apiUserName: process.env.BK_SERVICE_IDENTITY,  // from your portal application\n  apiUserPassword: process.env.BK_PASSWORD,      // your portal password\n});\n\n// 1) Find a doctor you can book\nconst { foundDoctors } = await client.doctors.search({\n  searchParams: { withFreeText: \"kardiyoloji\" },\n  orderParams: [\"slot\"],\n  currentPage: 1,\n});\nconst doctorId = foundDoctors[0].doctor_id;\n\n// 2) Free slots\nconst schedule = await client.slots.schedule({ doctorId, scheduleDate: \"2026-08-01\" });\nconst slot = Object.values(schedule)[0]?.[0];\n\n// 3) Hold it for a patient — named inline, no session\nconst held = await client.appointments.reserveWithoutAgreement({\n  slotId: slot.slotId,\n  doctorId,\n  user: { name: \"Ada\", surname: \"Lovelace\", phoneNumber: \"+905551112233\" },\n});\n\n// 4) Confirm before `held.reservationExpired` passes\nawait client.appointments.create({ hash: held.hash, outherProcessId: held.outherProcessId });\n```\n\n## Services\n\n31 endpoints across seven groups.\n\n| Group                 | Methods |\n|-----------------------|---------|\n| `client.auth`         | `connect`, `refresh`, `disconnect` |\n| `client.doctors`      | `search`, `branches`, `detail`, `locations` |\n| `client.slots`        | `schedule` |\n| `client.appointments` | `reserve`, `reserveWithoutAgreement`, `instantReserve`, `create`, `createWithoutSlot`, `cancelWithoutSlot`, `list`, `info`, `checkDoctor` |\n| `client.measures`     | `last`, `list`, `graph`, `addList`, `add`, `update`, `delete`, `healthInformation` |\n| `client.laboratory`   | `catalog`, `catalogDetail`, `results`, `resultDetail` |\n| `client.diets`        | `list`, `detail` |\n\n## Naming a patient\n\nThere is no session, so every patient-scoped call carries the patient in its\nbody — never in the URL, since a TCKN in a path segment would land in access\nlogs, proxy logs and error breadcrumbs.\n\n**Reads** take a light reference. The server looks only inside your own company\nand never creates anything:\n\n```ts\nawait client.measures.last({ identityNumber: \"12345678901\" });\nawait client.diets.list({ phoneNumber: \"+905551112233\" });\n```\n\n`identityNumber` is primary; `phoneNumber` is a fallback accepted only when it\nmatches exactly one patient (the column is not unique — family members share\nnumbers). A patient you have never treated resolves to \"not found\", with the same\nmessage as \"not yours\" so the endpoint cannot be used to probe for TCKNs.\n\n**Writes** take the descriptive shape, because the patient is created inside your\ncompany if absent:\n\n```ts\nawait client.measures.addList(\n  { name: \"Ada\", surname: \"Lovelace\", phoneNumber: \"+905551112233\" },\n  [{ type: \"pulse\", date_time: \"2026-06-17 09:31\", pulse: 72 }],\n);\n```\n\n## Booking\n\nTwo flows, depending on who collects the agreements and the payment:\n\n```ts\n// (A) Hand off to the patient — returns a browser `url` for agreements + payment.\nconst { url } = await client.appointments.reserve({ slotId, doctorId, user });\n\n// (B) You already collected them — returns a `hash` to confirm yourself.\nconst held = await client.appointments.reserveWithoutAgreement({ slotId, doctorId, user });\nawait client.appointments.create({ hash: held.hash, outherProcessId });\n```\n\n**Payment is never taken through the API.** No partner endpoint produces a\nfinancial record; the browser hand-off in (A) is where payment happens. The SDK\nreturns `url` verbatim and never opens or follows it.\n\n`createWithoutSlot` books a free-form range outside the slot grid, for\nintegrations running their own calendar; `cancelWithoutSlot` reverses it — and\nonly it.\n\n## Authentication\n\nYour portal application issues three values: a **client ID**, a **client secret**\nand a project-specific **service identity**. The password is the one you set when\nregistering on the portal. `auth.connect` exchanges them for an access token and\na refresh token:\n\n```ts\nconst client = new BulutklinikClient({ clientId, clientSecret });\n\nawait client.auth.connect({\n  apiUserName: \"svc@your-app.bulutklinik\",\n  apiUserPassword: \"…\",\n  loginMode: \"email\", // default\n});\n```\n\nThe granted scope comes from the credentials, not from the request — a partner\napplication is provisioned with `apiouther`, which is what makes the `/outher`\nsurface reachable.\n\nAlready holding a token? Pass it instead and skip the login:\n\n```ts\nconst client = new BulutklinikClient({ partnerToken: \"…\" });\n```\n\nPass `partnerToken` **or** `tokenStore`, not both — the constructor rejects it\nrather than guessing which you meant.\n\n### Refresh\n\nAccess tokens last ~30 days, refresh tokens ~130. You do not normally call\n`refresh` yourself: on a `401` / `resultType 4` the SDK refreshes once, retries\nthe original request, and concurrent calls share a single in-flight refresh.\n\n```ts\nawait client.auth.refresh();     // only useful to refresh ahead of time\nawait client.auth.disconnect();  // revokes both tokens and clears the store\n```\n\nIf the refresh fails — or there is no refresh token because you supplied a bare\n`partnerToken` — the call raises `AuthenticationError` and you should\n`auth.connect` again.\n\n### Token storage\n\nTokens are read from a token store on **every** request, so a long-running\nprocess can rotate them without being rebuilt:\n\n```ts\nimport type { RefreshTokenStore } from \"@bulutklinik/sdk\";\n\nconst tokenStore: RefreshTokenStore = {\n  getToken: () => readFromVault(\"access\"),\n  setToken: (t) => writeToVault(\"access\", t),\n  getRefreshToken: () => readFromVault(\"refresh\"),\n  setRefreshToken: (t) => writeToVault(\"refresh\", t),\n  clear: () => wipeVault(),\n};\n\nconst client = new BulutklinikClient({ tokenStore, clientId, clientSecret });\n```\n\nThe refresh methods are **optional**. A plain `TokenStore` — the 1.0.x shape,\naccess token only — still works; the SDK then keeps the refresh token in memory,\nso a process restart needs `auth.connect` rather than a refresh.\n\nA `403` means the credential itself is wrong: either the granted scope does not\ninclude `apiouther`, or the account has no company attached. The company boundary\ncomes from the token, never from request input, so retrying with different body\nparameters will not help.\n\n## Health measures\n\n```ts\n// Write several measurements at once (max 200 per call, one transaction)\nawait client.measures.addList(patient, [\n  { type: \"tension\", date_time: \"2026-06-17 09:30\", hypertension: 120, hypotension: 80 },\n  { type: \"glucose\", date_time: \"2026-06-17 09:35\", glucose: 95, glucose_type: 0 },\n]);\n\n// Latest of each type / paginated history / graph\nawait client.measures.last(ref);\nawait client.measures.list(ref, \"glucose\", 1, 0); // glucoseType 0=fasting, 1=postprandial\nawait client.measures.graph(ref, \"tension\", 2);   // period 2 = weekly\n```\n\n> Measurements are written to **your own company**. A value you write does not\n> appear in the patient's Bulutklinik mobile app, and values they entered there\n> are not visible to you. That is tenant isolation working as intended.\n\n`measures.healthInformation` is the legacy `teusan` bulk endpoint, kept for\nexisting integrations: it needs the `teusan` scope instead of `apiouther`, takes\na flat `identity` + `phoneNumber` instead of `patient`, and writes into the\nshared consumer tenant. Its patient matching is an **OR**, and it is loose: the lookup is\n`identity OR phoneNumber` against the *global* user table and takes the first\nrow, so a phone number alone can resolve someone whose TCKN differs from the one\nyou sent. Send both, but do not assume they are checked as a pair — the\n`apiouther` reads above do the opposite, scoping to your company and failing\nclosed on ambiguity. Prefer `addList` for anything new.\n\n## Escape hatch\n\nNot every endpoint has a typed method. `client.request` reuses the same\ntransport, so headers, envelope unwrapping and typed errors all still apply:\n\n```ts\nconst data = await client.request({ method: \"GET\", path: \"/outher/somethingNew\" });\n\n// `public` reaches unauthenticated endpoints outside the partner surface,\n// e.g. the city/district catalogue that feeds address forms.\nconst config = await client.request({\n  method: \"GET\",\n  path: \"/general/getConfig\",\n  auth: \"public\",\n});\n```\n\n## Errors\n\nAll errors extend `BulutklinikError`:\n\n`TransportError` (network/timeout) · `ApiError` → `ValidationError` (422),\n`AuthenticationError` (401 / revoked / expired), `AuthorizationError` (403),\n`NotFoundError` (404), `RateLimitError` (429, `retryAfter`).\n\n```ts\nimport { ValidationError, RateLimitError } from \"@bulutklinik/sdk\";\n\ntry {\n  await client.measures.last(ref);\n} catch (err) {\n  if (err instanceof RateLimitError) console.log(\"retry after\", err.retryAfter);\n  else if (err instanceof ValidationError) console.log(\"invalid:\", err.data);\n  else throw err;\n}\n```\n\nNote that `/outher` reports most business-rule failures as HTTP **`501`** with\n`resultType 1` — \"patient not found in your company\", \"slot no longer free\",\n\"doctor not bookable through your integration\". It is not a server crash; read\n`errorMessage`.\n\n## Development\n\n```bash\nnpm install\nnpm run lint\nnpm run typecheck\nnpm test\nnpm run build\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}