@opengovsg/refx-ts-sdk 0.0.30 → 0.0.32-prerelease-1743933274

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 (134) hide show
  1. package/Client.d.ts +2 -0
  2. package/README.md +11 -11
  3. package/api/errors/BadRequestError.js +17 -7
  4. package/api/errors/NotFoundError.js +17 -7
  5. package/api/errors/UnauthorizedError.js +17 -7
  6. package/api/resources/eligibility/client/Client.d.ts +2 -0
  7. package/api/resources/eligibility/client/Client.js +20 -10
  8. package/api/resources/health/client/Client.d.ts +2 -0
  9. package/api/resources/health/client/Client.js +20 -10
  10. package/api/resources/index.js +17 -7
  11. package/api/resources/notes/client/Client.d.ts +2 -0
  12. package/api/resources/notes/client/Client.js +20 -10
  13. package/api/resources/offerings/client/Client.d.ts +2 -0
  14. package/api/resources/offerings/client/Client.js +23 -13
  15. package/api/resources/public/client/Client.d.ts +2 -0
  16. package/api/resources/public/client/Client.js +22 -12
  17. package/api/resources/referrals/client/Client.d.ts +2 -0
  18. package/api/resources/referrals/client/Client.js +50 -40
  19. package/api/resources/webhooks/client/Client.d.ts +2 -0
  20. package/api/resources/webhooks/client/Client.js +23 -13
  21. package/api/types/CreatePatientReqGender.d.ts +1 -1
  22. package/api/types/CreateReferralFormReq.d.ts +9 -0
  23. package/api/types/CreateReferralFormReq.js +5 -0
  24. package/api/types/FormMetadata.d.ts +17 -0
  25. package/api/types/FormMetadata.js +5 -0
  26. package/api/types/FormResponseAnswer.d.ts +1 -1
  27. package/api/types/FullReferralDtoStatus.d.ts +1 -1
  28. package/api/types/GetReferralPatientDtoGender.d.ts +1 -1
  29. package/api/types/ReferralDtoStatus.d.ts +1 -1
  30. package/api/types/ReferralRole.d.ts +1 -1
  31. package/api/types/ReferralStatusFilter.d.ts +1 -1
  32. package/api/types/System.d.ts +1 -1
  33. package/api/types/TimelineEventDtoSystem.d.ts +1 -1
  34. package/api/types/TimelineEventType.d.ts +1 -1
  35. package/api/types/TimeslotPolicy.d.ts +1 -1
  36. package/api/types/index.d.ts +2 -0
  37. package/api/types/index.js +2 -0
  38. package/core/fetcher/APIResponse.d.ts +1 -1
  39. package/core/fetcher/Fetcher.d.ts +2 -2
  40. package/core/fetcher/Fetcher.js +6 -5
  41. package/core/fetcher/Supplier.d.ts +1 -1
  42. package/core/fetcher/createRequestUrl.d.ts +1 -1
  43. package/core/fetcher/createRequestUrl.js +1 -2
  44. package/core/fetcher/getFetchFn.js +18 -9
  45. package/core/fetcher/getHeader.js +1 -2
  46. package/core/fetcher/getRequestBody.js +5 -5
  47. package/core/fetcher/getResponseBody.js +1 -2
  48. package/core/fetcher/makeRequest.d.ts +1 -1
  49. package/core/fetcher/requestWithRetries.js +4 -5
  50. package/core/fetcher/signals.d.ts +0 -1
  51. package/core/fetcher/signals.js +2 -3
  52. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
  53. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
  54. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
  55. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
  56. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
  57. package/core/json.d.ts +15 -0
  58. package/core/json.js +24 -0
  59. package/core/runtime/runtime.d.ts +1 -1
  60. package/core/runtime/runtime.js +51 -41
  61. package/dist/Client.d.ts +2 -0
  62. package/dist/api/errors/BadRequestError.js +17 -7
  63. package/dist/api/errors/NotFoundError.js +17 -7
  64. package/dist/api/errors/UnauthorizedError.js +17 -7
  65. package/dist/api/resources/eligibility/client/Client.d.ts +2 -0
  66. package/dist/api/resources/eligibility/client/Client.js +20 -10
  67. package/dist/api/resources/health/client/Client.d.ts +2 -0
  68. package/dist/api/resources/health/client/Client.js +20 -10
  69. package/dist/api/resources/index.js +17 -7
  70. package/dist/api/resources/notes/client/Client.d.ts +2 -0
  71. package/dist/api/resources/notes/client/Client.js +20 -10
  72. package/dist/api/resources/offerings/client/Client.d.ts +2 -0
  73. package/dist/api/resources/offerings/client/Client.js +23 -13
  74. package/dist/api/resources/public/client/Client.d.ts +2 -0
  75. package/dist/api/resources/public/client/Client.js +22 -12
  76. package/dist/api/resources/referrals/client/Client.d.ts +2 -0
  77. package/dist/api/resources/referrals/client/Client.js +50 -40
  78. package/dist/api/resources/webhooks/client/Client.d.ts +2 -0
  79. package/dist/api/resources/webhooks/client/Client.js +23 -13
  80. package/dist/api/types/CreatePatientReqGender.d.ts +1 -1
  81. package/dist/api/types/CreateReferralFormReq.d.ts +9 -0
  82. package/dist/api/types/CreateReferralFormReq.js +5 -0
  83. package/dist/api/types/FormMetadata.d.ts +17 -0
  84. package/dist/api/types/FormMetadata.js +5 -0
  85. package/dist/api/types/FormResponseAnswer.d.ts +1 -1
  86. package/dist/api/types/FullReferralDtoStatus.d.ts +1 -1
  87. package/dist/api/types/GetReferralPatientDtoGender.d.ts +1 -1
  88. package/dist/api/types/ReferralDtoStatus.d.ts +1 -1
  89. package/dist/api/types/ReferralRole.d.ts +1 -1
  90. package/dist/api/types/ReferralStatusFilter.d.ts +1 -1
  91. package/dist/api/types/System.d.ts +1 -1
  92. package/dist/api/types/TimelineEventDtoSystem.d.ts +1 -1
  93. package/dist/api/types/TimelineEventType.d.ts +1 -1
  94. package/dist/api/types/TimeslotPolicy.d.ts +1 -1
  95. package/dist/api/types/index.d.ts +2 -0
  96. package/dist/api/types/index.js +2 -0
  97. package/dist/core/fetcher/APIResponse.d.ts +1 -1
  98. package/dist/core/fetcher/Fetcher.d.ts +2 -2
  99. package/dist/core/fetcher/Fetcher.js +6 -5
  100. package/dist/core/fetcher/Supplier.d.ts +1 -1
  101. package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
  102. package/dist/core/fetcher/createRequestUrl.js +1 -2
  103. package/dist/core/fetcher/getFetchFn.js +18 -9
  104. package/dist/core/fetcher/getHeader.js +1 -2
  105. package/dist/core/fetcher/getRequestBody.js +5 -5
  106. package/dist/core/fetcher/getResponseBody.js +1 -2
  107. package/dist/core/fetcher/makeRequest.d.ts +1 -1
  108. package/dist/core/fetcher/requestWithRetries.js +4 -5
  109. package/dist/core/fetcher/signals.d.ts +0 -1
  110. package/dist/core/fetcher/signals.js +2 -3
  111. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -1
  112. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +6 -4
  113. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +1 -1
  114. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +1 -1
  115. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +18 -9
  116. package/dist/core/json.d.ts +15 -0
  117. package/dist/core/json.js +24 -0
  118. package/dist/core/runtime/runtime.d.ts +1 -1
  119. package/dist/core/runtime/runtime.js +51 -41
  120. package/dist/environments.d.ts +2 -1
  121. package/dist/environments.js +1 -0
  122. package/dist/errors/ReferralExchangeError.js +2 -1
  123. package/dist/index.js +17 -7
  124. package/dist/version.d.ts +1 -1
  125. package/dist/version.js +1 -1
  126. package/environments.d.ts +2 -1
  127. package/environments.js +1 -0
  128. package/errors/ReferralExchangeError.js +2 -1
  129. package/index.js +17 -7
  130. package/{jest.config.js → jest.config.mjs} +4 -1
  131. package/package.json +15 -15
  132. package/scripts/rename-to-esm-files.js +115 -0
  133. package/version.d.ts +1 -1
  134. package/version.js +1 -1
package/Client.d.ts CHANGED
@@ -13,6 +13,8 @@ import { Health } from "./api/resources/health/client/Client";
13
13
  export declare namespace ReferralExchangeClient {
14
14
  interface Options {
15
15
  environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
16
+ /** Specify a custom URL to connect the client to. */
17
+ baseUrl?: core.Supplier<string>;
16
18
  apiKey?: core.Supplier<string | undefined>;
17
19
  fetcher?: core.FetchFunction;
18
20
  }
package/README.md CHANGED
@@ -100,14 +100,14 @@ const response = await client.referrals.upsert(..., {
100
100
  ### Retries
101
101
 
102
102
  The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
103
- as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
103
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
104
104
  retry limit (default: 2).
105
105
 
106
- A request is deemed retriable when any of the following HTTP status codes is returned:
106
+ A request is deemed retryable when any of the following HTTP status codes is returned:
107
107
 
108
- - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
109
- - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
110
- - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
108
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
109
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
110
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
111
111
 
112
112
  Use the `maxRetries` request option to configure this behavior.
113
113
 
@@ -144,12 +144,12 @@ controller.abort(); // aborts the request
144
144
  The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following
145
145
  runtimes:
146
146
 
147
- - Node.js 18+
148
- - Vercel
149
- - Cloudflare Workers
150
- - Deno v1.25+
151
- - Bun 1.0+
152
- - React Native
147
+ - Node.js 18+
148
+ - Vercel
149
+ - Cloudflare Workers
150
+ - Deno v1.25+
151
+ - Bun 1.0+
152
+ - React Native
153
153
 
154
154
  ### Customizing Fetch Client
155
155
 
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
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
+ })();
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
39
  exports.BadRequestError = void 0;
30
40
  const errors = __importStar(require("../../errors/index"));
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
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
+ })();
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
39
  exports.NotFoundError = void 0;
30
40
  const errors = __importStar(require("../../errors/index"));
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
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
+ })();
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
39
  exports.UnauthorizedError = void 0;
30
40
  const errors = __importStar(require("../../errors/index"));
@@ -7,6 +7,8 @@ import * as ReferralExchange from "../../../index";
7
7
  export declare namespace Eligibility {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  apiKey?: core.Supplier<string | undefined>;
11
13
  fetcher?: core.FetchFunction;
12
14
  }
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
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
+ })();
28
38
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
40
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -61,16 +71,16 @@ class Eligibility {
61
71
  * })
62
72
  */
63
73
  get(request, requestOptions) {
64
- var _a, _b;
65
74
  return __awaiter(this, void 0, void 0, function* () {
75
+ var _a, _b, _c;
66
76
  const { uin, offeringId } = request;
67
77
  const _queryParams = {};
68
78
  _queryParams["uin"] = uin;
69
79
  _queryParams["offeringId"] = offeringId;
70
80
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
71
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ReferralExchangeEnvironment.Production, "api/v1/eligibility"),
81
+ 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/eligibility"),
72
82
  method: "GET",
73
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.30", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.30", "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),
83
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.32-prerelease-1743933274", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.32-prerelease-1743933274", "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),
74
84
  contentType: "application/json",
75
85
  queryParameters: _queryParams,
76
86
  requestType: "json",
@@ -7,6 +7,8 @@ import * as ReferralExchange from "../../../index";
7
7
  export declare namespace Health {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  apiKey?: core.Supplier<string | undefined>;
11
13
  fetcher?: core.FetchFunction;
12
14
  }
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
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
+ })();
28
38
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
40
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -54,12 +64,12 @@ class Health {
54
64
  * await client.health.check()
55
65
  */
56
66
  check(requestOptions) {
57
- var _a, _b;
58
67
  return __awaiter(this, void 0, void 0, function* () {
68
+ var _a, _b, _c;
59
69
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
60
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ReferralExchangeEnvironment.Production, "api/v1/health"),
70
+ 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/health"),
61
71
  method: "GET",
62
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.30", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.30", "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),
72
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.32-prerelease-1743933274", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.32-prerelease-1743933274", "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),
63
73
  contentType: "application/json",
64
74
  requestType: "json",
65
75
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
37
  };
@@ -7,6 +7,8 @@ import * as ReferralExchange from "../../../index";
7
7
  export declare namespace Notes {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  apiKey?: core.Supplier<string | undefined>;
11
13
  fetcher?: core.FetchFunction;
12
14
  }
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
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
+ })();
28
38
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
40
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -61,12 +71,12 @@ class Notes {
61
71
  * })
62
72
  */
63
73
  create(referralId, request, requestOptions) {
64
- var _a, _b;
65
74
  return __awaiter(this, void 0, void 0, function* () {
75
+ var _a, _b, _c;
66
76
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
67
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ReferralExchangeEnvironment.Production, `api/v1/referrals/${encodeURIComponent(referralId)}/notes`),
77
+ 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)}/notes`),
68
78
  method: "POST",
69
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.30", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.30", "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),
79
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.32-prerelease-1743933274", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.32-prerelease-1743933274", "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),
70
80
  contentType: "application/json",
71
81
  requestType: "json",
72
82
  body: request,
@@ -7,6 +7,8 @@ import * as ReferralExchange from "../../../index";
7
7
  export declare namespace Offerings {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  apiKey?: core.Supplier<string | undefined>;
11
13
  fetcher?: core.FetchFunction;
12
14
  }
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
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
+ })();
28
38
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
40
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -57,12 +67,12 @@ class Offerings {
57
67
  * await client.offerings.list()
58
68
  */
59
69
  list(requestOptions) {
60
- var _a, _b;
61
70
  return __awaiter(this, void 0, void 0, function* () {
71
+ var _a, _b, _c;
62
72
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
63
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ReferralExchangeEnvironment.Production, "api/v1/offerings"),
73
+ 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/offerings"),
64
74
  method: "GET",
65
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.30", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.30", "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),
75
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.32-prerelease-1743933274", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.32-prerelease-1743933274", "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),
66
76
  contentType: "application/json",
67
77
  requestType: "json",
68
78
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -112,16 +122,16 @@ class Offerings {
112
122
  * })
113
123
  */
114
124
  listTimeslots(offeringId, request, requestOptions) {
115
- var _a, _b;
116
125
  return __awaiter(this, void 0, void 0, function* () {
126
+ var _a, _b, _c;
117
127
  const { from: from_, isSubsidised } = request;
118
128
  const _queryParams = {};
119
129
  _queryParams["from"] = from_.toString();
120
130
  _queryParams["isSubsidised"] = isSubsidised.toString();
121
131
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
122
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ReferralExchangeEnvironment.Production, `api/v1/offerings/${encodeURIComponent(offeringId)}/timeslots`),
132
+ 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/offerings/${encodeURIComponent(offeringId)}/timeslots`),
123
133
  method: "GET",
124
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.30", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.30", "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),
134
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.32-prerelease-1743933274", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.32-prerelease-1743933274", "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),
125
135
  contentType: "application/json",
126
136
  queryParameters: _queryParams,
127
137
  requestType: "json",
@@ -7,6 +7,8 @@ import * as ReferralExchange from "../../../index";
7
7
  export declare namespace Public {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  apiKey?: core.Supplier<string | undefined>;
11
13
  fetcher?: core.FetchFunction;
12
14
  }
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
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
+ })();
28
38
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
40
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -58,18 +68,18 @@ class Public {
58
68
  * @example
59
69
  * await client.public.getReferral("referralId")
60
70
  */
61
- getReferral(referralId, request = {}, requestOptions) {
62
- var _a, _b;
63
- return __awaiter(this, void 0, void 0, function* () {
71
+ getReferral(referralId_1) {
72
+ return __awaiter(this, arguments, void 0, function* (referralId, request = {}, requestOptions) {
73
+ var _a, _b, _c;
64
74
  const { includeAttachments } = request;
65
75
  const _queryParams = {};
66
76
  if (includeAttachments != null) {
67
77
  _queryParams["includeAttachments"] = includeAttachments.toString();
68
78
  }
69
79
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
70
- url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ReferralExchangeEnvironment.Production, `api/v1/public/referrals/${encodeURIComponent(referralId)}`),
80
+ 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/public/referrals/${encodeURIComponent(referralId)}`),
71
81
  method: "GET",
72
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.30", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.30", "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),
82
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.32-prerelease-1743933274", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.32-prerelease-1743933274", "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),
73
83
  contentType: "application/json",
74
84
  queryParameters: _queryParams,
75
85
  requestType: "json",
@@ -7,6 +7,8 @@ import * as ReferralExchange from "../../../index";
7
7
  export declare namespace Referrals {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  apiKey?: core.Supplier<string | undefined>;
11
13
  fetcher?: core.FetchFunction;
12
14
  }