@opengovsg/refx-ts-sdk 0.0.0-develop-1746623964

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (461) hide show
  1. package/Client.d.ts +49 -0
  2. package/Client.js +47 -0
  3. package/README.md +176 -0
  4. package/api/errors/BadRequestError.d.ts +8 -0
  5. package/api/errors/BadRequestError.js +51 -0
  6. package/api/errors/NotFoundError.d.ts +7 -0
  7. package/api/errors/NotFoundError.js +51 -0
  8. package/api/errors/UnauthorizedError.d.ts +7 -0
  9. package/api/errors/UnauthorizedError.js +51 -0
  10. package/api/errors/index.d.ts +3 -0
  11. package/api/errors/index.js +19 -0
  12. package/api/index.d.ts +3 -0
  13. package/api/index.js +19 -0
  14. package/api/resources/eligibility/client/Client.d.ts +45 -0
  15. package/api/resources/eligibility/client/Client.js +136 -0
  16. package/api/resources/eligibility/client/index.d.ts +1 -0
  17. package/api/resources/eligibility/client/index.js +17 -0
  18. package/api/resources/eligibility/client/requests/EligibilityGetRequest.d.ts +30 -0
  19. package/api/resources/eligibility/client/requests/EligibilityGetRequest.js +5 -0
  20. package/api/resources/eligibility/client/requests/index.d.ts +1 -0
  21. package/api/resources/eligibility/client/requests/index.js +2 -0
  22. package/api/resources/eligibility/index.d.ts +1 -0
  23. package/api/resources/eligibility/index.js +17 -0
  24. package/api/resources/health/client/Client.d.ts +39 -0
  25. package/api/resources/health/client/Client.js +110 -0
  26. package/api/resources/health/client/index.d.ts +1 -0
  27. package/api/resources/health/client/index.js +2 -0
  28. package/api/resources/health/index.d.ts +1 -0
  29. package/api/resources/health/index.js +17 -0
  30. package/api/resources/index.d.ts +12 -0
  31. package/api/resources/index.js +51 -0
  32. package/api/resources/notes/client/Client.d.ts +45 -0
  33. package/api/resources/notes/client/Client.js +123 -0
  34. package/api/resources/notes/client/index.d.ts +1 -0
  35. package/api/resources/notes/client/index.js +17 -0
  36. package/api/resources/notes/client/requests/CreateNoteReq.d.ts +15 -0
  37. package/api/resources/notes/client/requests/CreateNoteReq.js +5 -0
  38. package/api/resources/notes/client/requests/index.d.ts +1 -0
  39. package/api/resources/notes/client/requests/index.js +2 -0
  40. package/api/resources/notes/index.d.ts +1 -0
  41. package/api/resources/notes/index.js +17 -0
  42. package/api/resources/offerings/client/Client.d.ts +56 -0
  43. package/api/resources/offerings/client/Client.js +191 -0
  44. package/api/resources/offerings/client/index.d.ts +1 -0
  45. package/api/resources/offerings/client/index.js +17 -0
  46. package/api/resources/offerings/client/requests/OfferingsListRequest.d.ts +19 -0
  47. package/api/resources/offerings/client/requests/OfferingsListRequest.js +5 -0
  48. package/api/resources/offerings/client/requests/OfferingsListTimeslotsRequest.d.ts +14 -0
  49. package/api/resources/offerings/client/requests/OfferingsListTimeslotsRequest.js +5 -0
  50. package/api/resources/offerings/client/requests/index.d.ts +2 -0
  51. package/api/resources/offerings/client/requests/index.js +2 -0
  52. package/api/resources/offerings/index.d.ts +1 -0
  53. package/api/resources/offerings/index.js +17 -0
  54. package/api/resources/public/client/Client.d.ts +43 -0
  55. package/api/resources/public/client/Client.js +131 -0
  56. package/api/resources/public/client/index.d.ts +1 -0
  57. package/api/resources/public/client/index.js +17 -0
  58. package/api/resources/public/client/requests/PublicGetReferralRequest.d.ts +11 -0
  59. package/api/resources/public/client/requests/PublicGetReferralRequest.js +5 -0
  60. package/api/resources/public/client/requests/index.d.ts +1 -0
  61. package/api/resources/public/client/requests/index.js +2 -0
  62. package/api/resources/public/index.d.ts +1 -0
  63. package/api/resources/public/index.js +17 -0
  64. package/api/resources/referrals/client/Client.d.ts +158 -0
  65. package/api/resources/referrals/client/Client.js +604 -0
  66. package/api/resources/referrals/client/index.d.ts +1 -0
  67. package/api/resources/referrals/client/index.js +17 -0
  68. package/api/resources/referrals/client/requests/AcceptReferralBody.d.ts +13 -0
  69. package/api/resources/referrals/client/requests/AcceptReferralBody.js +5 -0
  70. package/api/resources/referrals/client/requests/AmendReferralReq.d.ts +13 -0
  71. package/api/resources/referrals/client/requests/AmendReferralReq.js +5 -0
  72. package/api/resources/referrals/client/requests/CancelReferralReq.d.ts +13 -0
  73. package/api/resources/referrals/client/requests/CancelReferralReq.js +5 -0
  74. package/api/resources/referrals/client/requests/CreateReferralReq.d.ts +57 -0
  75. package/api/resources/referrals/client/requests/CreateReferralReq.js +5 -0
  76. package/api/resources/referrals/client/requests/ReferralsGetRequest.d.ts +11 -0
  77. package/api/resources/referrals/client/requests/ReferralsGetRequest.js +5 -0
  78. package/api/resources/referrals/client/requests/ReferralsListRequest.d.ts +29 -0
  79. package/api/resources/referrals/client/requests/ReferralsListRequest.js +5 -0
  80. package/api/resources/referrals/client/requests/RejectReferralBody.d.ts +13 -0
  81. package/api/resources/referrals/client/requests/RejectReferralBody.js +5 -0
  82. package/api/resources/referrals/client/requests/index.d.ts +7 -0
  83. package/api/resources/referrals/client/requests/index.js +2 -0
  84. package/api/resources/referrals/index.d.ts +1 -0
  85. package/api/resources/referrals/index.js +17 -0
  86. package/api/resources/webhooks/client/Client.d.ts +46 -0
  87. package/api/resources/webhooks/client/Client.js +154 -0
  88. package/api/resources/webhooks/client/index.d.ts +1 -0
  89. package/api/resources/webhooks/client/index.js +2 -0
  90. package/api/resources/webhooks/index.d.ts +1 -0
  91. package/api/resources/webhooks/index.js +17 -0
  92. package/api/types/AdditionalReferralField.d.ts +8 -0
  93. package/api/types/AdditionalReferralField.js +10 -0
  94. package/api/types/AttachmentDto.d.ts +8 -0
  95. package/api/types/AttachmentDto.js +5 -0
  96. package/api/types/BadRequestErrorBody.d.ts +8 -0
  97. package/api/types/BadRequestErrorBody.js +5 -0
  98. package/api/types/CreatePatientReq.d.ts +16 -0
  99. package/api/types/CreatePatientReq.js +5 -0
  100. package/api/types/CreatePatientReqGender.d.ts +11 -0
  101. package/api/types/CreatePatientReqGender.js +10 -0
  102. package/api/types/CreateReferralFormReq.d.ts +9 -0
  103. package/api/types/CreateReferralFormReq.js +5 -0
  104. package/api/types/EligibilityRes.d.ts +9 -0
  105. package/api/types/EligibilityRes.js +5 -0
  106. package/api/types/Form.d.ts +11 -0
  107. package/api/types/Form.js +5 -0
  108. package/api/types/FormMetadata.d.ts +17 -0
  109. package/api/types/FormMetadata.js +5 -0
  110. package/api/types/FormResponse.d.ts +9 -0
  111. package/api/types/FormResponse.js +5 -0
  112. package/api/types/FormResponseAnswer.d.ts +4 -0
  113. package/api/types/FormResponseAnswer.js +5 -0
  114. package/api/types/FullReferralDto.d.ts +26 -0
  115. package/api/types/FullReferralDto.js +5 -0
  116. package/api/types/FullReferralDtoStatus.d.ts +25 -0
  117. package/api/types/FullReferralDtoStatus.js +27 -0
  118. package/api/types/GetReferralPatientDto.d.ts +18 -0
  119. package/api/types/GetReferralPatientDto.js +5 -0
  120. package/api/types/GetReferralPatientDtoGender.d.ts +11 -0
  121. package/api/types/GetReferralPatientDtoGender.js +10 -0
  122. package/api/types/InstitutionCoreDto.d.ts +13 -0
  123. package/api/types/InstitutionCoreDto.js +5 -0
  124. package/api/types/NotFoundErrorBody.d.ts +8 -0
  125. package/api/types/NotFoundErrorBody.js +5 -0
  126. package/api/types/NoteDto.d.ts +11 -0
  127. package/api/types/NoteDto.js +5 -0
  128. package/api/types/OfferingDto.d.ts +19 -0
  129. package/api/types/OfferingDto.js +5 -0
  130. package/api/types/OfferingWithAllowedDto.d.ts +21 -0
  131. package/api/types/OfferingWithAllowedDto.js +5 -0
  132. package/api/types/OkResponse.d.ts +6 -0
  133. package/api/types/OkResponse.js +5 -0
  134. package/api/types/PaginatedQuery.d.ts +9 -0
  135. package/api/types/PaginatedQuery.js +5 -0
  136. package/api/types/PaginatedReferralsDto.d.ts +8 -0
  137. package/api/types/PaginatedReferralsDto.js +5 -0
  138. package/api/types/PaginationMetadata.d.ts +9 -0
  139. package/api/types/PaginationMetadata.js +5 -0
  140. package/api/types/PublicReferralDto.d.ts +21 -0
  141. package/api/types/PublicReferralDto.js +5 -0
  142. package/api/types/ReferralDto.d.ts +25 -0
  143. package/api/types/ReferralDto.js +5 -0
  144. package/api/types/ReferralDtoStatus.d.ts +25 -0
  145. package/api/types/ReferralDtoStatus.js +27 -0
  146. package/api/types/ReferralEligibility.d.ts +8 -0
  147. package/api/types/ReferralEligibility.js +5 -0
  148. package/api/types/ReferralRole.d.ts +8 -0
  149. package/api/types/ReferralRole.js +10 -0
  150. package/api/types/ReferralStatusFilter.d.ts +11 -0
  151. package/api/types/ReferralStatusFilter.js +13 -0
  152. package/api/types/ReferrerIdType.d.ts +7 -0
  153. package/api/types/ReferrerIdType.js +5 -0
  154. package/api/types/ReferringDoctorDto.d.ts +9 -0
  155. package/api/types/ReferringDoctorDto.js +5 -0
  156. package/api/types/SubsidyEligibility.d.ts +10 -0
  157. package/api/types/SubsidyEligibility.js +5 -0
  158. package/api/types/SubsidyEligibilityScheme.d.ts +9 -0
  159. package/api/types/SubsidyEligibilityScheme.js +11 -0
  160. package/api/types/System.d.ts +12 -0
  161. package/api/types/System.js +14 -0
  162. package/api/types/TimelineEventDto.d.ts +12 -0
  163. package/api/types/TimelineEventDto.js +5 -0
  164. package/api/types/TimelineEventDtoSystem.d.ts +15 -0
  165. package/api/types/TimelineEventDtoSystem.js +14 -0
  166. package/api/types/TimelineEventType.d.ts +30 -0
  167. package/api/types/TimelineEventType.js +32 -0
  168. package/api/types/Timeslot.d.ts +9 -0
  169. package/api/types/Timeslot.js +5 -0
  170. package/api/types/TimeslotPolicy.d.ts +15 -0
  171. package/api/types/TimeslotPolicy.js +11 -0
  172. package/api/types/TriggerEmailReminderBody.d.ts +7 -0
  173. package/api/types/TriggerEmailReminderBody.js +5 -0
  174. package/api/types/UnauthorizedErrorBody.d.ts +8 -0
  175. package/api/types/UnauthorizedErrorBody.js +5 -0
  176. package/api/types/index.d.ts +42 -0
  177. package/api/types/index.js +58 -0
  178. package/core/fetcher/APIResponse.d.ts +10 -0
  179. package/core/fetcher/APIResponse.js +2 -0
  180. package/core/fetcher/Fetcher.d.ts +39 -0
  181. package/core/fetcher/Fetcher.js +100 -0
  182. package/core/fetcher/Supplier.d.ts +4 -0
  183. package/core/fetcher/Supplier.js +22 -0
  184. package/core/fetcher/createRequestUrl.d.ts +1 -0
  185. package/core/fetcher/createRequestUrl.js +12 -0
  186. package/core/fetcher/getFetchFn.d.ts +4 -0
  187. package/core/fetcher/getFetchFn.js +68 -0
  188. package/core/fetcher/getHeader.d.ts +1 -0
  189. package/core/fetcher/getHeader.js +11 -0
  190. package/core/fetcher/getRequestBody.d.ts +7 -0
  191. package/core/fetcher/getRequestBody.js +23 -0
  192. package/core/fetcher/getResponseBody.d.ts +1 -0
  193. package/core/fetcher/getResponseBody.js +54 -0
  194. package/core/fetcher/index.d.ts +5 -0
  195. package/core/fetcher/index.js +9 -0
  196. package/core/fetcher/makeRequest.d.ts +1 -0
  197. package/core/fetcher/makeRequest.js +42 -0
  198. package/core/fetcher/requestWithRetries.d.ts +1 -0
  199. package/core/fetcher/requestWithRetries.js +40 -0
  200. package/core/fetcher/signals.d.ts +11 -0
  201. package/core/fetcher/signals.js +36 -0
  202. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  203. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  204. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  205. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  206. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  207. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  208. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  209. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  210. package/core/index.d.ts +2 -0
  211. package/core/index.js +18 -0
  212. package/core/json.d.ts +15 -0
  213. package/core/json.js +24 -0
  214. package/core/runtime/index.d.ts +1 -0
  215. package/core/runtime/index.js +5 -0
  216. package/core/runtime/runtime.d.ts +9 -0
  217. package/core/runtime/runtime.js +103 -0
  218. package/dist/Client.d.ts +49 -0
  219. package/dist/Client.js +47 -0
  220. package/dist/api/errors/BadRequestError.d.ts +8 -0
  221. package/dist/api/errors/BadRequestError.js +51 -0
  222. package/dist/api/errors/NotFoundError.d.ts +7 -0
  223. package/dist/api/errors/NotFoundError.js +51 -0
  224. package/dist/api/errors/UnauthorizedError.d.ts +7 -0
  225. package/dist/api/errors/UnauthorizedError.js +51 -0
  226. package/dist/api/errors/index.d.ts +3 -0
  227. package/dist/api/errors/index.js +19 -0
  228. package/dist/api/index.d.ts +3 -0
  229. package/dist/api/index.js +19 -0
  230. package/dist/api/resources/eligibility/client/Client.d.ts +45 -0
  231. package/dist/api/resources/eligibility/client/Client.js +136 -0
  232. package/dist/api/resources/eligibility/client/index.d.ts +1 -0
  233. package/dist/api/resources/eligibility/client/index.js +17 -0
  234. package/dist/api/resources/eligibility/client/requests/EligibilityGetRequest.d.ts +30 -0
  235. package/dist/api/resources/eligibility/client/requests/EligibilityGetRequest.js +5 -0
  236. package/dist/api/resources/eligibility/client/requests/index.d.ts +1 -0
  237. package/dist/api/resources/eligibility/client/requests/index.js +2 -0
  238. package/dist/api/resources/eligibility/index.d.ts +1 -0
  239. package/dist/api/resources/eligibility/index.js +17 -0
  240. package/dist/api/resources/health/client/Client.d.ts +39 -0
  241. package/dist/api/resources/health/client/Client.js +110 -0
  242. package/dist/api/resources/health/client/index.d.ts +1 -0
  243. package/dist/api/resources/health/client/index.js +2 -0
  244. package/dist/api/resources/health/index.d.ts +1 -0
  245. package/dist/api/resources/health/index.js +17 -0
  246. package/dist/api/resources/index.d.ts +12 -0
  247. package/dist/api/resources/index.js +51 -0
  248. package/dist/api/resources/notes/client/Client.d.ts +45 -0
  249. package/dist/api/resources/notes/client/Client.js +123 -0
  250. package/dist/api/resources/notes/client/index.d.ts +1 -0
  251. package/dist/api/resources/notes/client/index.js +17 -0
  252. package/dist/api/resources/notes/client/requests/CreateNoteReq.d.ts +15 -0
  253. package/dist/api/resources/notes/client/requests/CreateNoteReq.js +5 -0
  254. package/dist/api/resources/notes/client/requests/index.d.ts +1 -0
  255. package/dist/api/resources/notes/client/requests/index.js +2 -0
  256. package/dist/api/resources/notes/index.d.ts +1 -0
  257. package/dist/api/resources/notes/index.js +17 -0
  258. package/dist/api/resources/offerings/client/Client.d.ts +56 -0
  259. package/dist/api/resources/offerings/client/Client.js +191 -0
  260. package/dist/api/resources/offerings/client/index.d.ts +1 -0
  261. package/dist/api/resources/offerings/client/index.js +17 -0
  262. package/dist/api/resources/offerings/client/requests/OfferingsListRequest.d.ts +19 -0
  263. package/dist/api/resources/offerings/client/requests/OfferingsListRequest.js +5 -0
  264. package/dist/api/resources/offerings/client/requests/OfferingsListTimeslotsRequest.d.ts +14 -0
  265. package/dist/api/resources/offerings/client/requests/OfferingsListTimeslotsRequest.js +5 -0
  266. package/dist/api/resources/offerings/client/requests/index.d.ts +2 -0
  267. package/dist/api/resources/offerings/client/requests/index.js +2 -0
  268. package/dist/api/resources/offerings/index.d.ts +1 -0
  269. package/dist/api/resources/offerings/index.js +17 -0
  270. package/dist/api/resources/public/client/Client.d.ts +43 -0
  271. package/dist/api/resources/public/client/Client.js +131 -0
  272. package/dist/api/resources/public/client/index.d.ts +1 -0
  273. package/dist/api/resources/public/client/index.js +17 -0
  274. package/dist/api/resources/public/client/requests/PublicGetReferralRequest.d.ts +11 -0
  275. package/dist/api/resources/public/client/requests/PublicGetReferralRequest.js +5 -0
  276. package/dist/api/resources/public/client/requests/index.d.ts +1 -0
  277. package/dist/api/resources/public/client/requests/index.js +2 -0
  278. package/dist/api/resources/public/index.d.ts +1 -0
  279. package/dist/api/resources/public/index.js +17 -0
  280. package/dist/api/resources/referrals/client/Client.d.ts +158 -0
  281. package/dist/api/resources/referrals/client/Client.js +604 -0
  282. package/dist/api/resources/referrals/client/index.d.ts +1 -0
  283. package/dist/api/resources/referrals/client/index.js +17 -0
  284. package/dist/api/resources/referrals/client/requests/AcceptReferralBody.d.ts +13 -0
  285. package/dist/api/resources/referrals/client/requests/AcceptReferralBody.js +5 -0
  286. package/dist/api/resources/referrals/client/requests/AmendReferralReq.d.ts +13 -0
  287. package/dist/api/resources/referrals/client/requests/AmendReferralReq.js +5 -0
  288. package/dist/api/resources/referrals/client/requests/CancelReferralReq.d.ts +13 -0
  289. package/dist/api/resources/referrals/client/requests/CancelReferralReq.js +5 -0
  290. package/dist/api/resources/referrals/client/requests/CreateReferralReq.d.ts +57 -0
  291. package/dist/api/resources/referrals/client/requests/CreateReferralReq.js +5 -0
  292. package/dist/api/resources/referrals/client/requests/ReferralsGetRequest.d.ts +11 -0
  293. package/dist/api/resources/referrals/client/requests/ReferralsGetRequest.js +5 -0
  294. package/dist/api/resources/referrals/client/requests/ReferralsListRequest.d.ts +29 -0
  295. package/dist/api/resources/referrals/client/requests/ReferralsListRequest.js +5 -0
  296. package/dist/api/resources/referrals/client/requests/RejectReferralBody.d.ts +13 -0
  297. package/dist/api/resources/referrals/client/requests/RejectReferralBody.js +5 -0
  298. package/dist/api/resources/referrals/client/requests/index.d.ts +7 -0
  299. package/dist/api/resources/referrals/client/requests/index.js +2 -0
  300. package/dist/api/resources/referrals/index.d.ts +1 -0
  301. package/dist/api/resources/referrals/index.js +17 -0
  302. package/dist/api/resources/webhooks/client/Client.d.ts +46 -0
  303. package/dist/api/resources/webhooks/client/Client.js +154 -0
  304. package/dist/api/resources/webhooks/client/index.d.ts +1 -0
  305. package/dist/api/resources/webhooks/client/index.js +2 -0
  306. package/dist/api/resources/webhooks/index.d.ts +1 -0
  307. package/dist/api/resources/webhooks/index.js +17 -0
  308. package/dist/api/types/AdditionalReferralField.d.ts +8 -0
  309. package/dist/api/types/AdditionalReferralField.js +10 -0
  310. package/dist/api/types/AttachmentDto.d.ts +8 -0
  311. package/dist/api/types/AttachmentDto.js +5 -0
  312. package/dist/api/types/BadRequestErrorBody.d.ts +8 -0
  313. package/dist/api/types/BadRequestErrorBody.js +5 -0
  314. package/dist/api/types/CreatePatientReq.d.ts +16 -0
  315. package/dist/api/types/CreatePatientReq.js +5 -0
  316. package/dist/api/types/CreatePatientReqGender.d.ts +11 -0
  317. package/dist/api/types/CreatePatientReqGender.js +10 -0
  318. package/dist/api/types/CreateReferralFormReq.d.ts +9 -0
  319. package/dist/api/types/CreateReferralFormReq.js +5 -0
  320. package/dist/api/types/EligibilityRes.d.ts +9 -0
  321. package/dist/api/types/EligibilityRes.js +5 -0
  322. package/dist/api/types/Form.d.ts +11 -0
  323. package/dist/api/types/Form.js +5 -0
  324. package/dist/api/types/FormMetadata.d.ts +17 -0
  325. package/dist/api/types/FormMetadata.js +5 -0
  326. package/dist/api/types/FormResponse.d.ts +9 -0
  327. package/dist/api/types/FormResponse.js +5 -0
  328. package/dist/api/types/FormResponseAnswer.d.ts +4 -0
  329. package/dist/api/types/FormResponseAnswer.js +5 -0
  330. package/dist/api/types/FullReferralDto.d.ts +26 -0
  331. package/dist/api/types/FullReferralDto.js +5 -0
  332. package/dist/api/types/FullReferralDtoStatus.d.ts +25 -0
  333. package/dist/api/types/FullReferralDtoStatus.js +27 -0
  334. package/dist/api/types/GetReferralPatientDto.d.ts +18 -0
  335. package/dist/api/types/GetReferralPatientDto.js +5 -0
  336. package/dist/api/types/GetReferralPatientDtoGender.d.ts +11 -0
  337. package/dist/api/types/GetReferralPatientDtoGender.js +10 -0
  338. package/dist/api/types/InstitutionCoreDto.d.ts +13 -0
  339. package/dist/api/types/InstitutionCoreDto.js +5 -0
  340. package/dist/api/types/NotFoundErrorBody.d.ts +8 -0
  341. package/dist/api/types/NotFoundErrorBody.js +5 -0
  342. package/dist/api/types/NoteDto.d.ts +11 -0
  343. package/dist/api/types/NoteDto.js +5 -0
  344. package/dist/api/types/OfferingDto.d.ts +19 -0
  345. package/dist/api/types/OfferingDto.js +5 -0
  346. package/dist/api/types/OfferingWithAllowedDto.d.ts +21 -0
  347. package/dist/api/types/OfferingWithAllowedDto.js +5 -0
  348. package/dist/api/types/OkResponse.d.ts +6 -0
  349. package/dist/api/types/OkResponse.js +5 -0
  350. package/dist/api/types/PaginatedQuery.d.ts +9 -0
  351. package/dist/api/types/PaginatedQuery.js +5 -0
  352. package/dist/api/types/PaginatedReferralsDto.d.ts +8 -0
  353. package/dist/api/types/PaginatedReferralsDto.js +5 -0
  354. package/dist/api/types/PaginationMetadata.d.ts +9 -0
  355. package/dist/api/types/PaginationMetadata.js +5 -0
  356. package/dist/api/types/PublicReferralDto.d.ts +21 -0
  357. package/dist/api/types/PublicReferralDto.js +5 -0
  358. package/dist/api/types/ReferralDto.d.ts +25 -0
  359. package/dist/api/types/ReferralDto.js +5 -0
  360. package/dist/api/types/ReferralDtoStatus.d.ts +25 -0
  361. package/dist/api/types/ReferralDtoStatus.js +27 -0
  362. package/dist/api/types/ReferralEligibility.d.ts +8 -0
  363. package/dist/api/types/ReferralEligibility.js +5 -0
  364. package/dist/api/types/ReferralRole.d.ts +8 -0
  365. package/dist/api/types/ReferralRole.js +10 -0
  366. package/dist/api/types/ReferralStatusFilter.d.ts +11 -0
  367. package/dist/api/types/ReferralStatusFilter.js +13 -0
  368. package/dist/api/types/ReferrerIdType.d.ts +7 -0
  369. package/dist/api/types/ReferrerIdType.js +5 -0
  370. package/dist/api/types/ReferringDoctorDto.d.ts +9 -0
  371. package/dist/api/types/ReferringDoctorDto.js +5 -0
  372. package/dist/api/types/SubsidyEligibility.d.ts +10 -0
  373. package/dist/api/types/SubsidyEligibility.js +5 -0
  374. package/dist/api/types/SubsidyEligibilityScheme.d.ts +9 -0
  375. package/dist/api/types/SubsidyEligibilityScheme.js +11 -0
  376. package/dist/api/types/System.d.ts +12 -0
  377. package/dist/api/types/System.js +14 -0
  378. package/dist/api/types/TimelineEventDto.d.ts +12 -0
  379. package/dist/api/types/TimelineEventDto.js +5 -0
  380. package/dist/api/types/TimelineEventDtoSystem.d.ts +15 -0
  381. package/dist/api/types/TimelineEventDtoSystem.js +14 -0
  382. package/dist/api/types/TimelineEventType.d.ts +30 -0
  383. package/dist/api/types/TimelineEventType.js +32 -0
  384. package/dist/api/types/Timeslot.d.ts +9 -0
  385. package/dist/api/types/Timeslot.js +5 -0
  386. package/dist/api/types/TimeslotPolicy.d.ts +15 -0
  387. package/dist/api/types/TimeslotPolicy.js +11 -0
  388. package/dist/api/types/TriggerEmailReminderBody.d.ts +7 -0
  389. package/dist/api/types/TriggerEmailReminderBody.js +5 -0
  390. package/dist/api/types/UnauthorizedErrorBody.d.ts +8 -0
  391. package/dist/api/types/UnauthorizedErrorBody.js +5 -0
  392. package/dist/api/types/index.d.ts +42 -0
  393. package/dist/api/types/index.js +58 -0
  394. package/dist/core/fetcher/APIResponse.d.ts +10 -0
  395. package/dist/core/fetcher/APIResponse.js +2 -0
  396. package/dist/core/fetcher/Fetcher.d.ts +39 -0
  397. package/dist/core/fetcher/Fetcher.js +100 -0
  398. package/dist/core/fetcher/Supplier.d.ts +4 -0
  399. package/dist/core/fetcher/Supplier.js +22 -0
  400. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  401. package/dist/core/fetcher/createRequestUrl.js +12 -0
  402. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  403. package/dist/core/fetcher/getFetchFn.js +68 -0
  404. package/dist/core/fetcher/getHeader.d.ts +1 -0
  405. package/dist/core/fetcher/getHeader.js +11 -0
  406. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  407. package/dist/core/fetcher/getRequestBody.js +23 -0
  408. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  409. package/dist/core/fetcher/getResponseBody.js +54 -0
  410. package/dist/core/fetcher/index.d.ts +5 -0
  411. package/dist/core/fetcher/index.js +9 -0
  412. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  413. package/dist/core/fetcher/makeRequest.js +42 -0
  414. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  415. package/dist/core/fetcher/requestWithRetries.js +40 -0
  416. package/dist/core/fetcher/signals.d.ts +11 -0
  417. package/dist/core/fetcher/signals.js +36 -0
  418. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  419. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  420. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  421. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  422. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  423. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  424. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  425. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  426. package/dist/core/index.d.ts +2 -0
  427. package/dist/core/index.js +18 -0
  428. package/dist/core/json.d.ts +15 -0
  429. package/dist/core/json.js +24 -0
  430. package/dist/core/runtime/index.d.ts +1 -0
  431. package/dist/core/runtime/index.js +5 -0
  432. package/dist/core/runtime/runtime.d.ts +9 -0
  433. package/dist/core/runtime/runtime.js +103 -0
  434. package/dist/environments.d.ts +9 -0
  435. package/dist/environments.js +11 -0
  436. package/dist/errors/ReferralExchangeError.d.ts +12 -0
  437. package/dist/errors/ReferralExchangeError.js +33 -0
  438. package/dist/errors/ReferralExchangeTimeoutError.d.ts +6 -0
  439. package/dist/errors/ReferralExchangeTimeoutError.js +13 -0
  440. package/dist/errors/index.d.ts +2 -0
  441. package/dist/errors/index.js +7 -0
  442. package/dist/index.d.ts +4 -0
  443. package/dist/index.js +44 -0
  444. package/dist/version.d.ts +1 -0
  445. package/dist/version.js +4 -0
  446. package/environments.d.ts +9 -0
  447. package/environments.js +11 -0
  448. package/errors/ReferralExchangeError.d.ts +12 -0
  449. package/errors/ReferralExchangeError.js +33 -0
  450. package/errors/ReferralExchangeTimeoutError.d.ts +6 -0
  451. package/errors/ReferralExchangeTimeoutError.js +13 -0
  452. package/errors/index.d.ts +2 -0
  453. package/errors/index.js +7 -0
  454. package/index.d.ts +4 -0
  455. package/index.js +44 -0
  456. package/jest.config.mjs +8 -0
  457. package/package.json +42 -0
  458. package/reference.md +918 -0
  459. package/scripts/rename-to-esm-files.js +115 -0
  460. package/version.d.ts +1 -0
  461. package/version.js +4 -0
@@ -0,0 +1,604 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ var __importDefault = (this && this.__importDefault) || function (mod) {
48
+ return (mod && mod.__esModule) ? mod : { "default": mod };
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.Referrals = void 0;
52
+ const environments = __importStar(require("../../../../environments"));
53
+ const core = __importStar(require("../../../../core"));
54
+ const ReferralExchange = __importStar(require("../../../index"));
55
+ const url_join_1 = __importDefault(require("url-join"));
56
+ const errors = __importStar(require("../../../../errors/index"));
57
+ class Referrals {
58
+ constructor(_options = {}) {
59
+ this._options = _options;
60
+ }
61
+ /**
62
+ * @param {ReferralExchange.ReferralsListRequest} request
63
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
64
+ *
65
+ * @throws {@link ReferralExchange.UnauthorizedError}
66
+ *
67
+ * @example
68
+ * await client.referrals.list({
69
+ * hciCode: "hciCode"
70
+ * })
71
+ */
72
+ list(request, requestOptions) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ var _a, _b, _c;
75
+ const { offset, pageSize, hciCode, status, role } = request;
76
+ const _queryParams = {};
77
+ if (offset != null) {
78
+ _queryParams["offset"] = offset.toString();
79
+ }
80
+ if (pageSize != null) {
81
+ _queryParams["pageSize"] = pageSize.toString();
82
+ }
83
+ _queryParams["hciCode"] = hciCode;
84
+ if (status != null) {
85
+ if (Array.isArray(status)) {
86
+ _queryParams["status"] = status.map((item) => item);
87
+ }
88
+ else {
89
+ _queryParams["status"] = status;
90
+ }
91
+ }
92
+ if (role != null) {
93
+ _queryParams["role"] = role;
94
+ }
95
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
96
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, "api/v1/referrals"),
97
+ method: "GET",
98
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.0-develop-1746623964", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.0-develop-1746623964", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
99
+ contentType: "application/json",
100
+ queryParameters: _queryParams,
101
+ requestType: "json",
102
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
103
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
104
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
105
+ });
106
+ if (_response.ok) {
107
+ return _response.body;
108
+ }
109
+ if (_response.error.reason === "status-code") {
110
+ switch (_response.error.statusCode) {
111
+ case 401:
112
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
113
+ default:
114
+ throw new errors.ReferralExchangeError({
115
+ statusCode: _response.error.statusCode,
116
+ body: _response.error.body,
117
+ });
118
+ }
119
+ }
120
+ switch (_response.error.reason) {
121
+ case "non-json":
122
+ throw new errors.ReferralExchangeError({
123
+ statusCode: _response.error.statusCode,
124
+ body: _response.error.rawBody,
125
+ });
126
+ case "timeout":
127
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling GET /api/v1/referrals.");
128
+ case "unknown":
129
+ throw new errors.ReferralExchangeError({
130
+ message: _response.error.errorMessage,
131
+ });
132
+ }
133
+ });
134
+ }
135
+ /**
136
+ * @param {ReferralExchange.CreateReferralReq} request
137
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
138
+ *
139
+ * @throws {@link ReferralExchange.BadRequestError}
140
+ * @throws {@link ReferralExchange.UnauthorizedError}
141
+ *
142
+ * @example
143
+ * await client.referrals.upsert({
144
+ * patient: {
145
+ * uin: "uin",
146
+ * name: "name",
147
+ * phoneNumber: "91234567",
148
+ * dob: "1990-01-01",
149
+ * gender: "Male"
150
+ * },
151
+ * offeringId: "offeringId",
152
+ * senderHciCode: "senderHciCode",
153
+ * senderInstitutionName: "senderInstitutionName",
154
+ * doctorMcr: "doctorMcr",
155
+ * doctorName: "doctorName",
156
+ * doctorEmail: "doctorEmail",
157
+ * doctorContactNumber: "doctorContactNumber",
158
+ * isSubsidised: true,
159
+ * isUrgent: true,
160
+ * isDraft: true,
161
+ * formResponses: [{
162
+ * question: "question",
163
+ * id: "id",
164
+ * answer: "answer"
165
+ * }]
166
+ * })
167
+ */
168
+ upsert(request, requestOptions) {
169
+ return __awaiter(this, void 0, void 0, function* () {
170
+ var _a, _b, _c;
171
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
172
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, "api/v1/referrals"),
173
+ method: "POST",
174
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.0-develop-1746623964", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.0-develop-1746623964", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
175
+ contentType: "application/json",
176
+ requestType: "json",
177
+ body: request,
178
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
179
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
180
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
181
+ });
182
+ if (_response.ok) {
183
+ return _response.body;
184
+ }
185
+ if (_response.error.reason === "status-code") {
186
+ switch (_response.error.statusCode) {
187
+ case 400:
188
+ throw new ReferralExchange.BadRequestError(_response.error.body);
189
+ case 401:
190
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
191
+ default:
192
+ throw new errors.ReferralExchangeError({
193
+ statusCode: _response.error.statusCode,
194
+ body: _response.error.body,
195
+ });
196
+ }
197
+ }
198
+ switch (_response.error.reason) {
199
+ case "non-json":
200
+ throw new errors.ReferralExchangeError({
201
+ statusCode: _response.error.statusCode,
202
+ body: _response.error.rawBody,
203
+ });
204
+ case "timeout":
205
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/referrals.");
206
+ case "unknown":
207
+ throw new errors.ReferralExchangeError({
208
+ message: _response.error.errorMessage,
209
+ });
210
+ }
211
+ });
212
+ }
213
+ /**
214
+ * @param {string} referralId - Referral ID
215
+ * @param {ReferralExchange.ReferralsGetRequest} request
216
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
217
+ *
218
+ * @throws {@link ReferralExchange.UnauthorizedError}
219
+ * @throws {@link ReferralExchange.NotFoundError}
220
+ *
221
+ * @example
222
+ * await client.referrals.get("referralId")
223
+ */
224
+ get(referralId_1) {
225
+ return __awaiter(this, arguments, void 0, function* (referralId, request = {}, requestOptions) {
226
+ var _a, _b, _c;
227
+ const { additionalField } = request;
228
+ const _queryParams = {};
229
+ if (additionalField != null) {
230
+ if (Array.isArray(additionalField)) {
231
+ _queryParams["additionalField"] = additionalField.map((item) => item);
232
+ }
233
+ else {
234
+ _queryParams["additionalField"] = additionalField;
235
+ }
236
+ }
237
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
238
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, `api/v1/referrals/${encodeURIComponent(referralId)}`),
239
+ method: "GET",
240
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.0-develop-1746623964", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.0-develop-1746623964", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
241
+ contentType: "application/json",
242
+ queryParameters: _queryParams,
243
+ requestType: "json",
244
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
245
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
246
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
247
+ });
248
+ if (_response.ok) {
249
+ return _response.body;
250
+ }
251
+ if (_response.error.reason === "status-code") {
252
+ switch (_response.error.statusCode) {
253
+ case 401:
254
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
255
+ case 404:
256
+ throw new ReferralExchange.NotFoundError(_response.error.body);
257
+ default:
258
+ throw new errors.ReferralExchangeError({
259
+ statusCode: _response.error.statusCode,
260
+ body: _response.error.body,
261
+ });
262
+ }
263
+ }
264
+ switch (_response.error.reason) {
265
+ case "non-json":
266
+ throw new errors.ReferralExchangeError({
267
+ statusCode: _response.error.statusCode,
268
+ body: _response.error.rawBody,
269
+ });
270
+ case "timeout":
271
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling GET /api/v1/referrals/{referralId}.");
272
+ case "unknown":
273
+ throw new errors.ReferralExchangeError({
274
+ message: _response.error.errorMessage,
275
+ });
276
+ }
277
+ });
278
+ }
279
+ /**
280
+ * @param {string} referralId - Referral ID
281
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
282
+ *
283
+ * @throws {@link ReferralExchange.UnauthorizedError}
284
+ *
285
+ * @example
286
+ * await client.referrals.delete("referralId")
287
+ */
288
+ delete(referralId, requestOptions) {
289
+ return __awaiter(this, void 0, void 0, function* () {
290
+ var _a, _b, _c;
291
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
292
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, `api/v1/referrals/${encodeURIComponent(referralId)}`),
293
+ method: "DELETE",
294
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.0-develop-1746623964", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.0-develop-1746623964", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
295
+ contentType: "application/json",
296
+ requestType: "json",
297
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
298
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
299
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
300
+ });
301
+ if (_response.ok) {
302
+ return _response.body;
303
+ }
304
+ if (_response.error.reason === "status-code") {
305
+ switch (_response.error.statusCode) {
306
+ case 401:
307
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
308
+ default:
309
+ throw new errors.ReferralExchangeError({
310
+ statusCode: _response.error.statusCode,
311
+ body: _response.error.body,
312
+ });
313
+ }
314
+ }
315
+ switch (_response.error.reason) {
316
+ case "non-json":
317
+ throw new errors.ReferralExchangeError({
318
+ statusCode: _response.error.statusCode,
319
+ body: _response.error.rawBody,
320
+ });
321
+ case "timeout":
322
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling DELETE /api/v1/referrals/{referralId}.");
323
+ case "unknown":
324
+ throw new errors.ReferralExchangeError({
325
+ message: _response.error.errorMessage,
326
+ });
327
+ }
328
+ });
329
+ }
330
+ /**
331
+ * @param {string} referralId - Referral ID
332
+ * @param {ReferralExchange.CancelReferralReq} request
333
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
334
+ *
335
+ * @throws {@link ReferralExchange.UnauthorizedError}
336
+ *
337
+ * @example
338
+ * await client.referrals.cancel("referralId")
339
+ */
340
+ cancel(referralId_1) {
341
+ return __awaiter(this, arguments, void 0, function* (referralId, request = {}, requestOptions) {
342
+ var _a, _b, _c;
343
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
344
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, `api/v1/referrals/${encodeURIComponent(referralId)}/cancel`),
345
+ method: "POST",
346
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.0-develop-1746623964", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.0-develop-1746623964", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
347
+ contentType: "application/json",
348
+ requestType: "json",
349
+ body: request,
350
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
351
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
352
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
353
+ });
354
+ if (_response.ok) {
355
+ return _response.body;
356
+ }
357
+ if (_response.error.reason === "status-code") {
358
+ switch (_response.error.statusCode) {
359
+ case 401:
360
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
361
+ default:
362
+ throw new errors.ReferralExchangeError({
363
+ statusCode: _response.error.statusCode,
364
+ body: _response.error.body,
365
+ });
366
+ }
367
+ }
368
+ switch (_response.error.reason) {
369
+ case "non-json":
370
+ throw new errors.ReferralExchangeError({
371
+ statusCode: _response.error.statusCode,
372
+ body: _response.error.rawBody,
373
+ });
374
+ case "timeout":
375
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/referrals/{referralId}/cancel.");
376
+ case "unknown":
377
+ throw new errors.ReferralExchangeError({
378
+ message: _response.error.errorMessage,
379
+ });
380
+ }
381
+ });
382
+ }
383
+ /**
384
+ * @param {string} referralId - Referral ID
385
+ * @param {ReferralExchange.AmendReferralReq} request
386
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
387
+ *
388
+ * @throws {@link ReferralExchange.UnauthorizedError}
389
+ *
390
+ * @example
391
+ * await client.referrals.amend("referralId", {
392
+ * timeslotStartAt: 1714857600000
393
+ * })
394
+ */
395
+ amend(referralId, request, requestOptions) {
396
+ return __awaiter(this, void 0, void 0, function* () {
397
+ var _a, _b, _c;
398
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
399
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, `api/v1/referrals/${encodeURIComponent(referralId)}/amend`),
400
+ method: "POST",
401
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.0-develop-1746623964", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.0-develop-1746623964", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
402
+ contentType: "application/json",
403
+ requestType: "json",
404
+ body: request,
405
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
406
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
407
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
408
+ });
409
+ if (_response.ok) {
410
+ return _response.body;
411
+ }
412
+ if (_response.error.reason === "status-code") {
413
+ switch (_response.error.statusCode) {
414
+ case 401:
415
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
416
+ default:
417
+ throw new errors.ReferralExchangeError({
418
+ statusCode: _response.error.statusCode,
419
+ body: _response.error.body,
420
+ });
421
+ }
422
+ }
423
+ switch (_response.error.reason) {
424
+ case "non-json":
425
+ throw new errors.ReferralExchangeError({
426
+ statusCode: _response.error.statusCode,
427
+ body: _response.error.rawBody,
428
+ });
429
+ case "timeout":
430
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/referrals/{referralId}/amend.");
431
+ case "unknown":
432
+ throw new errors.ReferralExchangeError({
433
+ message: _response.error.errorMessage,
434
+ });
435
+ }
436
+ });
437
+ }
438
+ /**
439
+ * @param {string} referralId - Referral ID
440
+ * @param {ReferralExchange.AcceptReferralBody} request
441
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
442
+ *
443
+ * @throws {@link ReferralExchange.UnauthorizedError}
444
+ *
445
+ * @example
446
+ * await client.referrals.accept("referralId")
447
+ */
448
+ accept(referralId_1) {
449
+ return __awaiter(this, arguments, void 0, function* (referralId, request = {}, requestOptions) {
450
+ var _a, _b, _c;
451
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
452
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, `api/v1/referrals/${encodeURIComponent(referralId)}/accept`),
453
+ method: "POST",
454
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.0-develop-1746623964", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.0-develop-1746623964", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
455
+ contentType: "application/json",
456
+ requestType: "json",
457
+ body: request,
458
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
459
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
460
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
461
+ });
462
+ if (_response.ok) {
463
+ return;
464
+ }
465
+ if (_response.error.reason === "status-code") {
466
+ switch (_response.error.statusCode) {
467
+ case 401:
468
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
469
+ default:
470
+ throw new errors.ReferralExchangeError({
471
+ statusCode: _response.error.statusCode,
472
+ body: _response.error.body,
473
+ });
474
+ }
475
+ }
476
+ switch (_response.error.reason) {
477
+ case "non-json":
478
+ throw new errors.ReferralExchangeError({
479
+ statusCode: _response.error.statusCode,
480
+ body: _response.error.rawBody,
481
+ });
482
+ case "timeout":
483
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/referrals/{referralId}/accept.");
484
+ case "unknown":
485
+ throw new errors.ReferralExchangeError({
486
+ message: _response.error.errorMessage,
487
+ });
488
+ }
489
+ });
490
+ }
491
+ /**
492
+ * @param {string} referralId - Referral ID
493
+ * @param {ReferralExchange.RejectReferralBody} request
494
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
495
+ *
496
+ * @throws {@link ReferralExchange.UnauthorizedError}
497
+ *
498
+ * @example
499
+ * await client.referrals.reject("referralId", {
500
+ * rejectionMessage: "rejectionMessage"
501
+ * })
502
+ */
503
+ reject(referralId, request, requestOptions) {
504
+ return __awaiter(this, void 0, void 0, function* () {
505
+ var _a, _b, _c;
506
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
507
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, `api/v1/referrals/${encodeURIComponent(referralId)}/reject`),
508
+ method: "POST",
509
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.0-develop-1746623964", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.0-develop-1746623964", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
510
+ contentType: "application/json",
511
+ requestType: "json",
512
+ body: request,
513
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
514
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
515
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
516
+ });
517
+ if (_response.ok) {
518
+ return;
519
+ }
520
+ if (_response.error.reason === "status-code") {
521
+ switch (_response.error.statusCode) {
522
+ case 401:
523
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
524
+ default:
525
+ throw new errors.ReferralExchangeError({
526
+ statusCode: _response.error.statusCode,
527
+ body: _response.error.body,
528
+ });
529
+ }
530
+ }
531
+ switch (_response.error.reason) {
532
+ case "non-json":
533
+ throw new errors.ReferralExchangeError({
534
+ statusCode: _response.error.statusCode,
535
+ body: _response.error.rawBody,
536
+ });
537
+ case "timeout":
538
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/referrals/{referralId}/reject.");
539
+ case "unknown":
540
+ throw new errors.ReferralExchangeError({
541
+ message: _response.error.errorMessage,
542
+ });
543
+ }
544
+ });
545
+ }
546
+ /**
547
+ * @param {string} referralId - Referral ID
548
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
549
+ *
550
+ * @throws {@link ReferralExchange.UnauthorizedError}
551
+ *
552
+ * @example
553
+ * await client.referrals.backToDraft("referralId")
554
+ */
555
+ backToDraft(referralId, requestOptions) {
556
+ return __awaiter(this, void 0, void 0, function* () {
557
+ var _a, _b, _c;
558
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
559
+ url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, `api/v1/referrals/${encodeURIComponent(referralId)}/back-to-draft`),
560
+ method: "POST",
561
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.0-develop-1746623964", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.0-develop-1746623964", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
562
+ contentType: "application/json",
563
+ requestType: "json",
564
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
565
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
566
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
567
+ });
568
+ if (_response.ok) {
569
+ return _response.body;
570
+ }
571
+ if (_response.error.reason === "status-code") {
572
+ switch (_response.error.statusCode) {
573
+ case 401:
574
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
575
+ default:
576
+ throw new errors.ReferralExchangeError({
577
+ statusCode: _response.error.statusCode,
578
+ body: _response.error.body,
579
+ });
580
+ }
581
+ }
582
+ switch (_response.error.reason) {
583
+ case "non-json":
584
+ throw new errors.ReferralExchangeError({
585
+ statusCode: _response.error.statusCode,
586
+ body: _response.error.rawBody,
587
+ });
588
+ case "timeout":
589
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/referrals/{referralId}/back-to-draft.");
590
+ case "unknown":
591
+ throw new errors.ReferralExchangeError({
592
+ message: _response.error.errorMessage,
593
+ });
594
+ }
595
+ });
596
+ }
597
+ _getCustomAuthorizationHeaders() {
598
+ return __awaiter(this, void 0, void 0, function* () {
599
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
600
+ return { Authorization: apiKeyValue };
601
+ });
602
+ }
603
+ }
604
+ exports.Referrals = Referrals;
@@ -0,0 +1 @@
1
+ export * from "./requests";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests"), exports);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {}
7
+ */
8
+ export interface AcceptReferralBody {
9
+ /** Appointment time, in milliseconds since epoch. */
10
+ appointmentTime?: number;
11
+ /** Note content */
12
+ noteContent?: string;
13
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * timeslotStartAt: 1714857600000
8
+ * }
9
+ */
10
+ export interface AmendReferralReq {
11
+ /** New timeslot start time, in milliseconds since epoch. */
12
+ timeslotStartAt: number;
13
+ }