@opengovsg/refx-ts-sdk 0.0.54 → 0.0.59

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 (75) hide show
  1. package/README.md +44 -1
  2. package/api/resources/eligibility/client/Client.js +1 -1
  3. package/api/resources/health/client/Client.js +1 -1
  4. package/api/resources/links/client/Client.js +1 -1
  5. package/api/resources/links/client/requests/CreateLinkReqUpsert.d.ts +2 -0
  6. package/api/resources/notes/client/Client.js +1 -1
  7. package/api/resources/offerings/client/Client.js +3 -3
  8. package/api/resources/public/client/Client.d.ts +3 -1
  9. package/api/resources/public/client/Client.js +8 -3
  10. package/api/resources/public/client/requests/PublicGetReferralRequest.d.ts +7 -1
  11. package/api/resources/referrals/client/Client.d.ts +15 -1
  12. package/api/resources/referrals/client/Client.js +105 -18
  13. package/api/resources/referrals/client/requests/ReferralsGetRequest.d.ts +7 -1
  14. package/api/resources/referrals/client/requests/ReferralsListByInstitutionRequest.d.ts +35 -0
  15. package/api/resources/referrals/client/requests/ReferralsListByInstitutionRequest.js +5 -0
  16. package/api/resources/referrals/client/requests/ReferralsListRequest.d.ts +8 -8
  17. package/api/resources/referrals/client/requests/index.d.ts +1 -0
  18. package/api/resources/webhooks/client/Client.js +2 -2
  19. package/api/types/GetReferralPatientDto.d.ts +1 -1
  20. package/api/types/InstitutionIdType.d.ts +4 -0
  21. package/api/types/InstitutionIdType.js +5 -0
  22. package/api/types/OfferingWithAllowedDto.d.ts +2 -0
  23. package/api/types/System.d.ts +15 -1
  24. package/api/types/System.js +14 -0
  25. package/api/types/TimelineEventDtoSystem.d.ts +15 -1
  26. package/api/types/TimelineEventDtoSystem.js +14 -0
  27. package/api/types/TriggerEmailReminderBody.d.ts +4 -0
  28. package/api/types/index.d.ts +1 -0
  29. package/api/types/index.js +1 -0
  30. package/browser/jsonwebtoken-stub.d.ts +5 -0
  31. package/browser/jsonwebtoken-stub.js +10 -0
  32. package/dist/api/resources/eligibility/client/Client.js +1 -1
  33. package/dist/api/resources/health/client/Client.js +1 -1
  34. package/dist/api/resources/links/client/Client.js +1 -1
  35. package/dist/api/resources/links/client/requests/CreateLinkReqUpsert.d.ts +2 -0
  36. package/dist/api/resources/notes/client/Client.js +1 -1
  37. package/dist/api/resources/offerings/client/Client.js +3 -3
  38. package/dist/api/resources/public/client/Client.d.ts +3 -1
  39. package/dist/api/resources/public/client/Client.js +8 -3
  40. package/dist/api/resources/public/client/requests/PublicGetReferralRequest.d.ts +7 -1
  41. package/dist/api/resources/referrals/client/Client.d.ts +15 -1
  42. package/dist/api/resources/referrals/client/Client.js +105 -18
  43. package/dist/api/resources/referrals/client/requests/ReferralsGetRequest.d.ts +7 -1
  44. package/dist/api/resources/referrals/client/requests/ReferralsListByInstitutionRequest.d.ts +35 -0
  45. package/dist/api/resources/referrals/client/requests/ReferralsListByInstitutionRequest.js +5 -0
  46. package/dist/api/resources/referrals/client/requests/ReferralsListRequest.d.ts +8 -8
  47. package/dist/api/resources/referrals/client/requests/index.d.ts +1 -0
  48. package/dist/api/resources/webhooks/client/Client.js +2 -2
  49. package/dist/api/types/GetReferralPatientDto.d.ts +1 -1
  50. package/dist/api/types/InstitutionIdType.d.ts +4 -0
  51. package/dist/api/types/InstitutionIdType.js +5 -0
  52. package/dist/api/types/OfferingWithAllowedDto.d.ts +2 -0
  53. package/dist/api/types/System.d.ts +15 -1
  54. package/dist/api/types/System.js +14 -0
  55. package/dist/api/types/TimelineEventDtoSystem.d.ts +15 -1
  56. package/dist/api/types/TimelineEventDtoSystem.js +14 -0
  57. package/dist/api/types/TriggerEmailReminderBody.d.ts +4 -0
  58. package/dist/api/types/index.d.ts +1 -0
  59. package/dist/api/types/index.js +1 -0
  60. package/dist/browser/jsonwebtoken-stub.d.ts +5 -0
  61. package/dist/browser/jsonwebtoken-stub.js +10 -0
  62. package/dist/index.d.ts +2 -1
  63. package/dist/index.js +7 -4
  64. package/dist/version.d.ts +1 -1
  65. package/dist/version.js +1 -1
  66. package/dist/wrapper/ReferralExchangeJwtClient.d.ts +15 -0
  67. package/dist/wrapper/ReferralExchangeJwtClient.js +103 -0
  68. package/index.d.ts +2 -1
  69. package/index.js +7 -4
  70. package/package.json +9 -5
  71. package/reference.md +70 -2
  72. package/version.d.ts +1 -1
  73. package/version.js +1 -1
  74. package/wrapper/ReferralExchangeJwtClient.d.ts +15 -0
  75. package/wrapper/ReferralExchangeJwtClient.js +103 -0
package/README.md CHANGED
@@ -5,6 +5,21 @@
5
5
 
6
6
  The Opengovsg TypeScript library provides convenient access to the Opengovsg APIs from TypeScript.
7
7
 
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Reference](#reference)
12
+ - [Usage](#usage)
13
+ - [Request and Response Types](#request-and-response-types)
14
+ - [Exception Handling](#exception-handling)
15
+ - [Advanced](#advanced)
16
+ - [Additional Headers](#additional-headers)
17
+ - [Retries](#retries)
18
+ - [Timeouts](#timeouts)
19
+ - [Aborting Requests](#aborting-requests)
20
+ - [Runtime Compatibility](#runtime-compatibility)
21
+ - [Contributing](#contributing)
22
+
8
23
  ## Installation
9
24
 
10
25
  ```sh
@@ -51,7 +66,7 @@ await client.referrals.upsert({
51
66
  });
52
67
  ```
53
68
 
54
- ## Request And Response Types
69
+ ## Request and Response Types
55
70
 
56
71
  The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
57
72
  following namespace:
@@ -165,6 +180,34 @@ const client = new ReferralExchangeClient({
165
180
  });
166
181
  ```
167
182
 
183
+ ### JWT Authenticated Client
184
+
185
+ If you need to authenticate requests by signing short-lived JWTs locally, use the `ReferralExchangeJwtClient`. It
186
+ accepts a PEM-encoded ES256 private key and the API key name to embed as the issuer claim. By default each request
187
+ receives a freshly signed token (15 second TTL) in the `Authorization` header, but you can opt into caching with a
188
+ refresh buffer to reuse tokens safely. When opting in, you must supply the refresh buffer explicitly so the SDK knows
189
+ how early to rotate tokens.
190
+
191
+ ```typescript
192
+ import { ReferralExchangeJwtClient } from "@opengovsg/refx-ts-sdk";
193
+
194
+ const client = new ReferralExchangeJwtClient({
195
+ privateKey: process.env.REFX_PRIVATE_KEY!,
196
+ apiKeyName: process.env.REFX_API_KEY_NAME!,
197
+ environment: "Production", // or pass baseUrl
198
+ tokenCache: {
199
+ // The refresh buffer (required when enabling caching) is how much time must remain
200
+ // before we stop reusing a JWT so requests don't arrive after the token's exp timestamp.
201
+ refreshBufferSeconds: 5,
202
+ },
203
+ });
204
+
205
+ const offerings = await client.offerings.list();
206
+ ```
207
+
208
+ Omit the `tokenCache` block (the default) to sign a new token for every request. When you opt in, you must specify
209
+ `refreshBufferSeconds` to control how early the SDK rotates tokens.
210
+
168
211
  ## Contributing
169
212
 
170
213
  While we value open-source contributions to this SDK, this library is generated programmatically.
@@ -89,7 +89,7 @@ class Eligibility {
89
89
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
90
90
  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"),
91
91
  method: "GET",
92
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
92
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
93
93
  contentType: "application/json",
94
94
  queryParameters: _queryParams,
95
95
  requestType: "json",
@@ -69,7 +69,7 @@ class Health {
69
69
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
70
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"),
71
71
  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.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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
73
  contentType: "application/json",
74
74
  requestType: "json",
75
75
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -79,7 +79,7 @@ class Links {
79
79
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
80
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/links/upsert"),
81
81
  method: "POST",
82
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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
83
  contentType: "application/json",
84
84
  requestType: "json",
85
85
  body: request,
@@ -19,6 +19,8 @@ export interface CreateLinkReqUpsert {
19
19
  referrerInstitutionName: string;
20
20
  /** Id of the doctor authoring this referral. */
21
21
  referrerId: string;
22
+ /** Identifier for the individual requesting the link. The individual may or may not be the referrer. Preferred to be an email. */
23
+ requesterIdentifier?: string;
22
24
  referrerIdType: ReferralExchange.ReferrerIdType;
23
25
  /** Name of the doctor authoring this referral. */
24
26
  referrerName: string;
@@ -76,7 +76,7 @@ class Notes {
76
76
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
77
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`),
78
78
  method: "POST",
79
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
80
80
  contentType: "application/json",
81
81
  requestType: "json",
82
82
  body: request,
@@ -85,7 +85,7 @@ class Offerings {
85
85
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
86
86
  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"),
87
87
  method: "GET",
88
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
88
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
89
89
  contentType: "application/json",
90
90
  queryParameters: _queryParams,
91
91
  requestType: "json",
@@ -144,7 +144,7 @@ class Offerings {
144
144
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
145
145
  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/recommended"),
146
146
  method: "GET",
147
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
147
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
148
148
  contentType: "application/json",
149
149
  queryParameters: _queryParams,
150
150
  requestType: "json",
@@ -207,7 +207,7 @@ class Offerings {
207
207
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
208
208
  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`),
209
209
  method: "GET",
210
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
210
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
211
211
  contentType: "application/json",
212
212
  queryParameters: _queryParams,
213
213
  requestType: "json",
@@ -34,7 +34,9 @@ export declare class Public {
34
34
  * @throws {@link ReferralExchange.NotFoundError}
35
35
  *
36
36
  * @example
37
- * await client.public.getReferral("referralId")
37
+ * await client.public.getReferral("referralId", {
38
+ * requesterIdentifier: "requester@example.com"
39
+ * })
38
40
  */
39
41
  getReferral(referralId: string, request?: ReferralExchange.PublicGetReferralRequest, requestOptions?: Public.RequestOptions): Promise<ReferralExchange.PublicReferralDto>;
40
42
  protected _getCustomAuthorizationHeaders(): Promise<{
@@ -66,12 +66,14 @@ class Public {
66
66
  * @throws {@link ReferralExchange.NotFoundError}
67
67
  *
68
68
  * @example
69
- * await client.public.getReferral("referralId")
69
+ * await client.public.getReferral("referralId", {
70
+ * requesterIdentifier: "requester@example.com"
71
+ * })
70
72
  */
71
73
  getReferral(referralId_1) {
72
74
  return __awaiter(this, arguments, void 0, function* (referralId, request = {}, requestOptions) {
73
75
  var _a, _b, _c;
74
- const { additionalField } = request;
76
+ const { additionalField, requesterIdentifier } = request;
75
77
  const _queryParams = {};
76
78
  if (additionalField != null) {
77
79
  if (Array.isArray(additionalField)) {
@@ -81,10 +83,13 @@ class Public {
81
83
  _queryParams["additionalField"] = additionalField;
82
84
  }
83
85
  }
86
+ if (requesterIdentifier != null) {
87
+ _queryParams["requesterIdentifier"] = requesterIdentifier;
88
+ }
84
89
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
85
90
  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)}`),
86
91
  method: "GET",
87
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
92
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
88
93
  contentType: "application/json",
89
94
  queryParameters: _queryParams,
90
95
  requestType: "json",
@@ -4,8 +4,14 @@
4
4
  import * as ReferralExchange from "../../../../index";
5
5
  /**
6
6
  * @example
7
- * {}
7
+ * {
8
+ * requesterIdentifier: "requester@example.com"
9
+ * }
8
10
  */
9
11
  export interface PublicGetReferralRequest {
10
12
  additionalField?: ReferralExchange.AdditionalReferralField | ReferralExchange.AdditionalReferralField[];
13
+ /**
14
+ * Identifier for the individual requesting attachments/link/url. Required when requesting attachments/link/url. Preferred to be an email.
15
+ */
16
+ requesterIdentifier?: string;
11
17
  }
@@ -70,6 +70,18 @@ export declare class Referrals {
70
70
  * })
71
71
  */
72
72
  upsert(request: ReferralExchange.CreateReferralReq, requestOptions?: Referrals.RequestOptions): Promise<ReferralExchange.ReferralDto>;
73
+ /**
74
+ * @param {ReferralExchange.InstitutionIdType} institutionIdType - The type of institution ID
75
+ * @param {string} institutionId - The institution ID
76
+ * @param {ReferralExchange.ReferralsListByInstitutionRequest} request
77
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
78
+ *
79
+ * @throws {@link ReferralExchange.UnauthorizedError}
80
+ *
81
+ * @example
82
+ * await client.referrals.listByInstitution("hci", "institutionId")
83
+ */
84
+ listByInstitution(institutionIdType: ReferralExchange.InstitutionIdType, institutionId: string, request?: ReferralExchange.ReferralsListByInstitutionRequest, requestOptions?: Referrals.RequestOptions): Promise<ReferralExchange.PaginatedReferralsDto>;
73
85
  /**
74
86
  * @param {string} referralId - Referral ID
75
87
  * @param {ReferralExchange.ReferralsGetRequest} request
@@ -79,7 +91,9 @@ export declare class Referrals {
79
91
  * @throws {@link ReferralExchange.NotFoundError}
80
92
  *
81
93
  * @example
82
- * await client.referrals.get("referralId")
94
+ * await client.referrals.get("referralId", {
95
+ * requesterIdentifier: "requester@example.com"
96
+ * })
83
97
  */
84
98
  get(referralId: string, request?: ReferralExchange.ReferralsGetRequest, requestOptions?: Referrals.RequestOptions): Promise<ReferralExchange.FullReferralDto>;
85
99
  /**
@@ -70,7 +70,7 @@ class Referrals {
70
70
  list() {
71
71
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
72
72
  var _a, _b, _c;
73
- const { offset, pageSize, hciCode, status, role, referrerId, referrerIdType, institutionId, patientUin } = request;
73
+ const { offset, pageSize, status, role, referrerId, referrerIdType, patientUin, hciCode, institutionId } = request;
74
74
  const _queryParams = {};
75
75
  if (offset != null) {
76
76
  _queryParams["offset"] = offset.toString();
@@ -78,9 +78,6 @@ class Referrals {
78
78
  if (pageSize != null) {
79
79
  _queryParams["pageSize"] = pageSize.toString();
80
80
  }
81
- if (hciCode != null) {
82
- _queryParams["hciCode"] = hciCode;
83
- }
84
81
  if (status != null) {
85
82
  if (Array.isArray(status)) {
86
83
  _queryParams["status"] = status.map((item) => item);
@@ -98,16 +95,19 @@ class Referrals {
98
95
  if (referrerIdType != null) {
99
96
  _queryParams["referrerIdType"] = referrerIdType;
100
97
  }
101
- if (institutionId != null) {
102
- _queryParams["institutionId"] = institutionId;
103
- }
104
98
  if (patientUin != null) {
105
99
  _queryParams["patientUin"] = patientUin;
106
100
  }
101
+ if (hciCode != null) {
102
+ _queryParams["hciCode"] = hciCode;
103
+ }
104
+ if (institutionId != null) {
105
+ _queryParams["institutionId"] = institutionId;
106
+ }
107
107
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
108
108
  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"),
109
109
  method: "GET",
110
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
110
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
111
111
  contentType: "application/json",
112
112
  queryParameters: _queryParams,
113
113
  requestType: "json",
@@ -183,7 +183,7 @@ class Referrals {
183
183
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
184
184
  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"),
185
185
  method: "POST",
186
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
186
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
187
187
  contentType: "application/json",
188
188
  requestType: "json",
189
189
  body: request,
@@ -222,6 +222,88 @@ class Referrals {
222
222
  }
223
223
  });
224
224
  }
225
+ /**
226
+ * @param {ReferralExchange.InstitutionIdType} institutionIdType - The type of institution ID
227
+ * @param {string} institutionId - The institution ID
228
+ * @param {ReferralExchange.ReferralsListByInstitutionRequest} request
229
+ * @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
230
+ *
231
+ * @throws {@link ReferralExchange.UnauthorizedError}
232
+ *
233
+ * @example
234
+ * await client.referrals.listByInstitution("hci", "institutionId")
235
+ */
236
+ listByInstitution(institutionIdType_1, institutionId_1) {
237
+ return __awaiter(this, arguments, void 0, function* (institutionIdType, institutionId, request = {}, requestOptions) {
238
+ var _a, _b, _c;
239
+ const { offset, pageSize, status, role, referrerId, referrerIdType, patientUin } = request;
240
+ const _queryParams = {};
241
+ if (offset != null) {
242
+ _queryParams["offset"] = offset.toString();
243
+ }
244
+ if (pageSize != null) {
245
+ _queryParams["pageSize"] = pageSize.toString();
246
+ }
247
+ if (status != null) {
248
+ if (Array.isArray(status)) {
249
+ _queryParams["status"] = status.map((item) => item);
250
+ }
251
+ else {
252
+ _queryParams["status"] = status;
253
+ }
254
+ }
255
+ if (role != null) {
256
+ _queryParams["role"] = role;
257
+ }
258
+ if (referrerId != null) {
259
+ _queryParams["referrerId"] = referrerId;
260
+ }
261
+ if (referrerIdType != null) {
262
+ _queryParams["referrerIdType"] = referrerIdType;
263
+ }
264
+ if (patientUin != null) {
265
+ _queryParams["patientUin"] = patientUin;
266
+ }
267
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
268
+ 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/institutions/${encodeURIComponent(institutionIdType)}/${encodeURIComponent(institutionId)}/referrals`),
269
+ method: "GET",
270
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
271
+ contentType: "application/json",
272
+ queryParameters: _queryParams,
273
+ requestType: "json",
274
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
275
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
276
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
277
+ });
278
+ if (_response.ok) {
279
+ return _response.body;
280
+ }
281
+ if (_response.error.reason === "status-code") {
282
+ switch (_response.error.statusCode) {
283
+ case 401:
284
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
285
+ default:
286
+ throw new errors.ReferralExchangeError({
287
+ statusCode: _response.error.statusCode,
288
+ body: _response.error.body,
289
+ });
290
+ }
291
+ }
292
+ switch (_response.error.reason) {
293
+ case "non-json":
294
+ throw new errors.ReferralExchangeError({
295
+ statusCode: _response.error.statusCode,
296
+ body: _response.error.rawBody,
297
+ });
298
+ case "timeout":
299
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling GET /api/v1/institutions/{institutionIdType}/{institutionId}/referrals.");
300
+ case "unknown":
301
+ throw new errors.ReferralExchangeError({
302
+ message: _response.error.errorMessage,
303
+ });
304
+ }
305
+ });
306
+ }
225
307
  /**
226
308
  * @param {string} referralId - Referral ID
227
309
  * @param {ReferralExchange.ReferralsGetRequest} request
@@ -231,12 +313,14 @@ class Referrals {
231
313
  * @throws {@link ReferralExchange.NotFoundError}
232
314
  *
233
315
  * @example
234
- * await client.referrals.get("referralId")
316
+ * await client.referrals.get("referralId", {
317
+ * requesterIdentifier: "requester@example.com"
318
+ * })
235
319
  */
236
320
  get(referralId_1) {
237
321
  return __awaiter(this, arguments, void 0, function* (referralId, request = {}, requestOptions) {
238
322
  var _a, _b, _c;
239
- const { additionalField } = request;
323
+ const { additionalField, requesterIdentifier } = request;
240
324
  const _queryParams = {};
241
325
  if (additionalField != null) {
242
326
  if (Array.isArray(additionalField)) {
@@ -246,10 +330,13 @@ class Referrals {
246
330
  _queryParams["additionalField"] = additionalField;
247
331
  }
248
332
  }
333
+ if (requesterIdentifier != null) {
334
+ _queryParams["requesterIdentifier"] = requesterIdentifier;
335
+ }
249
336
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
250
337
  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)}`),
251
338
  method: "GET",
252
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
339
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
253
340
  contentType: "application/json",
254
341
  queryParameters: _queryParams,
255
342
  requestType: "json",
@@ -303,7 +390,7 @@ class Referrals {
303
390
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
304
391
  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)}`),
305
392
  method: "DELETE",
306
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
393
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
307
394
  contentType: "application/json",
308
395
  requestType: "json",
309
396
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -355,7 +442,7 @@ class Referrals {
355
442
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
356
443
  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`),
357
444
  method: "POST",
358
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
445
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
359
446
  contentType: "application/json",
360
447
  requestType: "json",
361
448
  body: request,
@@ -410,7 +497,7 @@ class Referrals {
410
497
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
411
498
  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`),
412
499
  method: "POST",
413
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
500
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
414
501
  contentType: "application/json",
415
502
  requestType: "json",
416
503
  body: request,
@@ -463,7 +550,7 @@ class Referrals {
463
550
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
464
551
  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`),
465
552
  method: "POST",
466
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
553
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
467
554
  contentType: "application/json",
468
555
  requestType: "json",
469
556
  body: request,
@@ -518,7 +605,7 @@ class Referrals {
518
605
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
519
606
  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`),
520
607
  method: "POST",
521
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
608
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
522
609
  contentType: "application/json",
523
610
  requestType: "json",
524
611
  body: request,
@@ -570,7 +657,7 @@ class Referrals {
570
657
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
571
658
  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`),
572
659
  method: "POST",
573
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
660
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
574
661
  contentType: "application/json",
575
662
  requestType: "json",
576
663
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -4,8 +4,14 @@
4
4
  import * as ReferralExchange from "../../../../index";
5
5
  /**
6
6
  * @example
7
- * {}
7
+ * {
8
+ * requesterIdentifier: "requester@example.com"
9
+ * }
8
10
  */
9
11
  export interface ReferralsGetRequest {
10
12
  additionalField?: ReferralExchange.AdditionalReferralField | ReferralExchange.AdditionalReferralField[];
13
+ /**
14
+ * Identifier for the individual requesting attachments/link/url. Required when requesting attachments/link/url. Preferred to be an email.
15
+ */
16
+ requesterIdentifier?: string;
11
17
  }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as ReferralExchange from "../../../../index";
5
+ /**
6
+ * @example
7
+ * {}
8
+ */
9
+ export interface ReferralsListByInstitutionRequest {
10
+ /**
11
+ * Offset for pagination
12
+ */
13
+ offset?: number;
14
+ /**
15
+ * Number of items per page
16
+ */
17
+ pageSize?: number;
18
+ status?: ReferralExchange.ReferralStatusFilter | ReferralExchange.ReferralStatusFilter[];
19
+ /**
20
+ * To filter by the institution's role in the referral. e.g. For outbound referrals, use "sender'
21
+ */
22
+ role?: ReferralExchange.ReferralRole;
23
+ /**
24
+ * To filter by the referrer ID
25
+ */
26
+ referrerId?: string;
27
+ /**
28
+ * Type of ID specified in referrerId. Use together with `referrerId` to filter based on referrer.
29
+ */
30
+ referrerIdType?: ReferralExchange.ReferrerIdType;
31
+ /**
32
+ * To filter by the patient UIN
33
+ */
34
+ patientUin?: string;
35
+ }
@@ -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 });
@@ -15,10 +15,6 @@ export interface ReferralsListRequest {
15
15
  * Number of items per page
16
16
  */
17
17
  pageSize?: number;
18
- /**
19
- * To identify the requesting institution
20
- */
21
- hciCode?: string;
22
18
  status?: ReferralExchange.ReferralStatusFilter | ReferralExchange.ReferralStatusFilter[];
23
19
  /**
24
20
  * To filter by the institution's role in the referral. e.g. For outbound referrals, use "sender'
@@ -32,12 +28,16 @@ export interface ReferralsListRequest {
32
28
  * Type of ID specified in referrerId. Use together with `referrerId` to filter based on referrer.
33
29
  */
34
30
  referrerIdType?: ReferralExchange.ReferrerIdType;
35
- /**
36
- * To filter by the requesting institution
37
- */
38
- institutionId?: string;
39
31
  /**
40
32
  * To filter by the patient UIN
41
33
  */
42
34
  patientUin?: string;
35
+ /**
36
+ * To identify the requesting institution
37
+ */
38
+ hciCode?: string;
39
+ /**
40
+ * To filter by the requesting institution
41
+ */
42
+ institutionId?: string;
43
43
  }
@@ -1,5 +1,6 @@
1
1
  export { type ReferralsListRequest } from "./ReferralsListRequest";
2
2
  export { type CreateReferralReq } from "./CreateReferralReq";
3
+ export { type ReferralsListByInstitutionRequest } from "./ReferralsListByInstitutionRequest";
3
4
  export { type ReferralsGetRequest } from "./ReferralsGetRequest";
4
5
  export { type CancelReferralReq } from "./CancelReferralReq";
5
6
  export { type AmendReferralReq } from "./AmendReferralReq";
@@ -69,7 +69,7 @@ class Webhooks {
69
69
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
70
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/webhooks/formsg/singhealth-profile"),
71
71
  method: "POST",
72
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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
73
  contentType: "application/json",
74
74
  requestType: "json",
75
75
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -113,7 +113,7 @@ class Webhooks {
113
113
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
114
114
  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/webhooks/formsg/form-submission/${encodeURIComponent(formId)}`),
115
115
  method: "POST",
116
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.54", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.54", "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),
116
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.59", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.59", "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),
117
117
  contentType: "application/json",
118
118
  requestType: "json",
119
119
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -19,5 +19,5 @@ export interface GetReferralPatientDto {
19
19
  /** Patient Healthier SG (HSG) enrolment status */
20
20
  isHsgEnrolled?: boolean;
21
21
  /** Current CHAS status */
22
- chasStatus: string;
22
+ chasStatus?: string;
23
23
  }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export type InstitutionIdType = "hci";