@opengovsg/refx-ts-sdk 0.0.37 → 0.0.39

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 (86) hide show
  1. package/Client.d.ts +3 -0
  2. package/Client.js +11 -6
  3. package/api/index.d.ts +1 -1
  4. package/api/index.js +1 -1
  5. package/api/resources/eligibility/client/Client.js +11 -2
  6. package/api/resources/eligibility/client/requests/EligibilityGetRequest.d.ts +10 -0
  7. package/api/resources/health/client/Client.js +1 -1
  8. package/api/resources/index.d.ts +3 -0
  9. package/api/resources/index.js +4 -1
  10. package/api/resources/links/client/Client.d.ts +55 -0
  11. package/api/resources/links/client/Client.js +133 -0
  12. package/api/resources/links/client/index.d.ts +1 -0
  13. package/api/resources/links/client/index.js +17 -0
  14. package/api/resources/links/client/requests/CreateLinkReqUpsert.d.ts +47 -0
  15. package/api/resources/links/client/requests/CreateLinkReqUpsert.js +5 -0
  16. package/api/resources/links/client/requests/index.d.ts +1 -0
  17. package/api/resources/links/client/requests/index.js +2 -0
  18. package/api/resources/links/index.d.ts +2 -0
  19. package/api/resources/links/index.js +18 -0
  20. package/api/resources/links/types/CreateLinkReqUpsertPatientGender.d.ts +11 -0
  21. package/api/resources/links/types/CreateLinkReqUpsertPatientGender.js +10 -0
  22. package/api/resources/links/types/index.d.ts +1 -0
  23. package/api/resources/links/types/index.js +17 -0
  24. package/api/resources/notes/client/Client.js +1 -1
  25. package/api/resources/offerings/client/Client.d.ts +1 -2
  26. package/api/resources/offerings/client/Client.js +6 -5
  27. package/api/resources/offerings/client/requests/OfferingsListRequest.d.ts +2 -2
  28. package/api/resources/offerings/client/requests/OfferingsListTimeslotsRequest.d.ts +2 -3
  29. package/api/resources/public/client/Client.js +1 -1
  30. package/api/resources/referrals/client/Client.js +9 -9
  31. package/api/resources/webhooks/client/Client.js +2 -2
  32. package/api/types/EligibilityRes.d.ts +2 -1
  33. package/api/types/ReferralEligibility.d.ts +2 -1
  34. package/api/types/ReferrerIdType.d.ts +7 -2
  35. package/api/types/ReferrerIdType.js +6 -0
  36. package/api/types/SubsidyEligibility.d.ts +4 -2
  37. package/api/types/SubsidyEligibilityScheme.d.ts +9 -0
  38. package/api/types/SubsidyEligibilityScheme.js +11 -0
  39. package/api/types/index.d.ts +2 -1
  40. package/api/types/index.js +2 -1
  41. package/dist/Client.d.ts +3 -0
  42. package/dist/Client.js +11 -6
  43. package/dist/api/index.d.ts +1 -1
  44. package/dist/api/index.js +1 -1
  45. package/dist/api/resources/eligibility/client/Client.js +11 -2
  46. package/dist/api/resources/eligibility/client/requests/EligibilityGetRequest.d.ts +10 -0
  47. package/dist/api/resources/health/client/Client.js +1 -1
  48. package/dist/api/resources/index.d.ts +3 -0
  49. package/dist/api/resources/index.js +4 -1
  50. package/dist/api/resources/links/client/Client.d.ts +55 -0
  51. package/dist/api/resources/links/client/Client.js +133 -0
  52. package/dist/api/resources/links/client/index.d.ts +1 -0
  53. package/dist/api/resources/links/client/index.js +17 -0
  54. package/dist/api/resources/links/client/requests/CreateLinkReqUpsert.d.ts +47 -0
  55. package/dist/api/resources/links/client/requests/CreateLinkReqUpsert.js +5 -0
  56. package/dist/api/resources/links/client/requests/index.d.ts +1 -0
  57. package/dist/api/resources/links/client/requests/index.js +2 -0
  58. package/dist/api/resources/links/index.d.ts +2 -0
  59. package/dist/api/resources/links/index.js +18 -0
  60. package/dist/api/resources/links/types/CreateLinkReqUpsertPatientGender.d.ts +11 -0
  61. package/dist/api/resources/links/types/CreateLinkReqUpsertPatientGender.js +10 -0
  62. package/dist/api/resources/links/types/index.d.ts +1 -0
  63. package/dist/api/resources/links/types/index.js +17 -0
  64. package/dist/api/resources/notes/client/Client.js +1 -1
  65. package/dist/api/resources/offerings/client/Client.d.ts +1 -2
  66. package/dist/api/resources/offerings/client/Client.js +6 -5
  67. package/dist/api/resources/offerings/client/requests/OfferingsListRequest.d.ts +2 -2
  68. package/dist/api/resources/offerings/client/requests/OfferingsListTimeslotsRequest.d.ts +2 -3
  69. package/dist/api/resources/public/client/Client.js +1 -1
  70. package/dist/api/resources/referrals/client/Client.js +9 -9
  71. package/dist/api/resources/webhooks/client/Client.js +2 -2
  72. package/dist/api/types/EligibilityRes.d.ts +2 -1
  73. package/dist/api/types/ReferralEligibility.d.ts +2 -1
  74. package/dist/api/types/ReferrerIdType.d.ts +7 -2
  75. package/dist/api/types/ReferrerIdType.js +6 -0
  76. package/dist/api/types/SubsidyEligibility.d.ts +4 -2
  77. package/dist/api/types/SubsidyEligibilityScheme.d.ts +9 -0
  78. package/dist/api/types/SubsidyEligibilityScheme.js +11 -0
  79. package/dist/api/types/index.d.ts +2 -1
  80. package/dist/api/types/index.js +2 -1
  81. package/dist/version.d.ts +1 -1
  82. package/dist/version.js +1 -1
  83. package/package.json +1 -1
  84. package/reference.md +63 -1
  85. package/version.d.ts +1 -1
  86. package/version.js +1 -1
package/Client.d.ts CHANGED
@@ -7,6 +7,7 @@ import { Eligibility } from "./api/resources/eligibility/client/Client";
7
7
  import { Referrals } from "./api/resources/referrals/client/Client";
8
8
  import { Notes } from "./api/resources/notes/client/Client";
9
9
  import { Offerings } from "./api/resources/offerings/client/Client";
10
+ import { Links } from "./api/resources/links/client/Client";
10
11
  import { Public } from "./api/resources/public/client/Client";
11
12
  import { Webhooks } from "./api/resources/webhooks/client/Client";
12
13
  import { Health } from "./api/resources/health/client/Client";
@@ -35,6 +36,7 @@ export declare class ReferralExchangeClient {
35
36
  protected _referrals: Referrals | undefined;
36
37
  protected _notes: Notes | undefined;
37
38
  protected _offerings: Offerings | undefined;
39
+ protected _links: Links | undefined;
38
40
  protected _public: Public | undefined;
39
41
  protected _webhooks: Webhooks | undefined;
40
42
  protected _health: Health | undefined;
@@ -43,6 +45,7 @@ export declare class ReferralExchangeClient {
43
45
  get referrals(): Referrals;
44
46
  get notes(): Notes;
45
47
  get offerings(): Offerings;
48
+ get links(): Links;
46
49
  get public(): Public;
47
50
  get webhooks(): Webhooks;
48
51
  get health(): Health;
package/Client.js CHANGED
@@ -8,9 +8,10 @@ const Client_1 = require("./api/resources/eligibility/client/Client");
8
8
  const Client_2 = require("./api/resources/referrals/client/Client");
9
9
  const Client_3 = require("./api/resources/notes/client/Client");
10
10
  const Client_4 = require("./api/resources/offerings/client/Client");
11
- const Client_5 = require("./api/resources/public/client/Client");
12
- const Client_6 = require("./api/resources/webhooks/client/Client");
13
- const Client_7 = require("./api/resources/health/client/Client");
11
+ const Client_5 = require("./api/resources/links/client/Client");
12
+ const Client_6 = require("./api/resources/public/client/Client");
13
+ const Client_7 = require("./api/resources/webhooks/client/Client");
14
+ const Client_8 = require("./api/resources/health/client/Client");
14
15
  class ReferralExchangeClient {
15
16
  constructor(_options = {}) {
16
17
  this._options = _options;
@@ -31,17 +32,21 @@ class ReferralExchangeClient {
31
32
  var _a;
32
33
  return ((_a = this._offerings) !== null && _a !== void 0 ? _a : (this._offerings = new Client_4.Offerings(this._options)));
33
34
  }
35
+ get links() {
36
+ var _a;
37
+ return ((_a = this._links) !== null && _a !== void 0 ? _a : (this._links = new Client_5.Links(this._options)));
38
+ }
34
39
  get public() {
35
40
  var _a;
36
- return ((_a = this._public) !== null && _a !== void 0 ? _a : (this._public = new Client_5.Public(this._options)));
41
+ return ((_a = this._public) !== null && _a !== void 0 ? _a : (this._public = new Client_6.Public(this._options)));
37
42
  }
38
43
  get webhooks() {
39
44
  var _a;
40
- return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_6.Webhooks(this._options)));
45
+ return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_7.Webhooks(this._options)));
41
46
  }
42
47
  get health() {
43
48
  var _a;
44
- return ((_a = this._health) !== null && _a !== void 0 ? _a : (this._health = new Client_7.Health(this._options)));
49
+ return ((_a = this._health) !== null && _a !== void 0 ? _a : (this._health = new Client_8.Health(this._options)));
45
50
  }
46
51
  }
47
52
  exports.ReferralExchangeClient = ReferralExchangeClient;
package/api/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
+ export * from "./resources";
1
2
  export * from "./types";
2
3
  export * from "./errors";
3
- export * from "./resources";
package/api/index.js CHANGED
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./resources"), exports);
17
18
  __exportStar(require("./types"), exports);
18
19
  __exportStar(require("./errors"), exports);
19
- __exportStar(require("./resources"), exports);
@@ -73,14 +73,23 @@ class Eligibility {
73
73
  get(request, requestOptions) {
74
74
  return __awaiter(this, void 0, void 0, function* () {
75
75
  var _a, _b, _c;
76
- const { uin, offeringId } = request;
76
+ const { referrerId, referrerIdType, referrerInstitutionId, uin, offeringId } = request;
77
77
  const _queryParams = {};
78
+ if (referrerId != null) {
79
+ _queryParams["referrerId"] = referrerId;
80
+ }
81
+ if (referrerIdType != null) {
82
+ _queryParams["referrerIdType"] = referrerIdType;
83
+ }
84
+ if (referrerInstitutionId != null) {
85
+ _queryParams["referrerInstitutionId"] = referrerInstitutionId;
86
+ }
78
87
  _queryParams["uin"] = uin;
79
88
  _queryParams["offeringId"] = offeringId;
80
89
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
81
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"),
82
91
  method: "GET",
83
- headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.37", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.37", "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.39", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.39", "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),
84
93
  contentType: "application/json",
85
94
  queryParameters: _queryParams,
86
95
  requestType: "json",
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as ReferralExchange from "../../../../index";
4
5
  /**
5
6
  * @example
6
7
  * {
@@ -9,6 +10,15 @@
9
10
  * }
10
11
  */
11
12
  export interface EligibilityGetRequest {
13
+ /**
14
+ * ID of the referring individual. Use together with `referralIdType` and `referrerInstitutionId` to filter based on referrer.
15
+ */
16
+ referrerId?: string;
17
+ referrerIdType?: ReferralExchange.ReferrerIdType;
18
+ /**
19
+ * ID of the referring institution. Use together with `referrerId` and `referrerIdType` to filter based on referrer.
20
+ */
21
+ referrerInstitutionId?: string;
12
22
  /**
13
23
  * Patient's unique identity number (NRIC or FIN)
14
24
  */
@@ -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.37", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.37", "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.39", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.39", "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,
@@ -1,3 +1,5 @@
1
+ export * as links from "./links";
2
+ export * from "./links/types";
1
3
  export * as eligibility from "./eligibility";
2
4
  export * as referrals from "./referrals";
3
5
  export * as notes from "./notes";
@@ -9,4 +11,5 @@ export * from "./eligibility/client/requests";
9
11
  export * from "./referrals/client/requests";
10
12
  export * from "./notes/client/requests";
11
13
  export * from "./offerings/client/requests";
14
+ export * from "./links/client/requests";
12
15
  export * from "./public/client/requests";
@@ -36,7 +36,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.health = exports.webhooks = exports.public_ = exports.offerings = exports.notes = exports.referrals = exports.eligibility = void 0;
39
+ exports.health = exports.webhooks = exports.public_ = exports.offerings = exports.notes = exports.referrals = exports.eligibility = exports.links = void 0;
40
+ exports.links = __importStar(require("./links"));
41
+ __exportStar(require("./links/types"), exports);
40
42
  exports.eligibility = __importStar(require("./eligibility"));
41
43
  exports.referrals = __importStar(require("./referrals"));
42
44
  exports.notes = __importStar(require("./notes"));
@@ -48,4 +50,5 @@ __exportStar(require("./eligibility/client/requests"), exports);
48
50
  __exportStar(require("./referrals/client/requests"), exports);
49
51
  __exportStar(require("./notes/client/requests"), exports);
50
52
  __exportStar(require("./offerings/client/requests"), exports);
53
+ __exportStar(require("./links/client/requests"), exports);
51
54
  __exportStar(require("./public/client/requests"), exports);
@@ -0,0 +1,55 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments";
5
+ import * as core from "../../../../core";
6
+ import * as ReferralExchange from "../../../index";
7
+ export declare namespace Links {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ apiKey?: core.Supplier<string | undefined>;
13
+ fetcher?: core.FetchFunction;
14
+ }
15
+ interface RequestOptions {
16
+ /** The maximum time to wait for a response in seconds. */
17
+ timeoutInSeconds?: number;
18
+ /** The number of times to retry the request. Defaults to 2. */
19
+ maxRetries?: number;
20
+ /** A hook to abort the request. */
21
+ abortSignal?: AbortSignal;
22
+ /** Additional headers to include in the request. */
23
+ headers?: Record<string, string>;
24
+ }
25
+ }
26
+ export declare class Links {
27
+ protected readonly _options: Links.Options;
28
+ constructor(_options?: Links.Options);
29
+ /**
30
+ * @param {ReferralExchange.CreateLinkReqUpsert} request
31
+ * @param {Links.RequestOptions} requestOptions - Request-specific configuration.
32
+ *
33
+ * @throws {@link ReferralExchange.UnauthorizedError}
34
+ *
35
+ * @example
36
+ * await client.links.apiHoldingControllerCreateUpsertLink({
37
+ * referrerInstitutionId: "referrerInstitutionId",
38
+ * referrerInstitutionName: "referrerInstitutionName",
39
+ * referrerId: "referrerId",
40
+ * referrerName: "referrerName",
41
+ * referrerIdType: "referrerIdType",
42
+ * referrerEmail: "referrerEmail",
43
+ * referrerContactNumber: "referrerContactNumber",
44
+ * patientUin: "patientUin",
45
+ * patientName: "patientName",
46
+ * patientPhoneNumber: "91234567",
47
+ * patientDob: "1990-01-01",
48
+ * patientGender: "Male"
49
+ * })
50
+ */
51
+ apiHoldingControllerCreateUpsertLink(request: ReferralExchange.CreateLinkReqUpsert, requestOptions?: Links.RequestOptions): Promise<void>;
52
+ protected _getCustomAuthorizationHeaders(): Promise<{
53
+ Authorization: string | undefined;
54
+ }>;
55
+ }
@@ -0,0 +1,133 @@
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.Links = 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 Links {
58
+ constructor(_options = {}) {
59
+ this._options = _options;
60
+ }
61
+ /**
62
+ * @param {ReferralExchange.CreateLinkReqUpsert} request
63
+ * @param {Links.RequestOptions} requestOptions - Request-specific configuration.
64
+ *
65
+ * @throws {@link ReferralExchange.UnauthorizedError}
66
+ *
67
+ * @example
68
+ * await client.links.apiHoldingControllerCreateUpsertLink({
69
+ * referrerInstitutionId: "referrerInstitutionId",
70
+ * referrerInstitutionName: "referrerInstitutionName",
71
+ * referrerId: "referrerId",
72
+ * referrerName: "referrerName",
73
+ * referrerIdType: "referrerIdType",
74
+ * referrerEmail: "referrerEmail",
75
+ * referrerContactNumber: "referrerContactNumber",
76
+ * patientUin: "patientUin",
77
+ * patientName: "patientName",
78
+ * patientPhoneNumber: "91234567",
79
+ * patientDob: "1990-01-01",
80
+ * patientGender: "Male"
81
+ * })
82
+ */
83
+ apiHoldingControllerCreateUpsertLink(request, requestOptions) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ var _a, _b, _c;
86
+ const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
87
+ 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"),
88
+ method: "POST",
89
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.39", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.39", "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),
90
+ contentType: "application/json",
91
+ requestType: "json",
92
+ body: request,
93
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
94
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
95
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
96
+ });
97
+ if (_response.ok) {
98
+ return;
99
+ }
100
+ if (_response.error.reason === "status-code") {
101
+ switch (_response.error.statusCode) {
102
+ case 401:
103
+ throw new ReferralExchange.UnauthorizedError(_response.error.body);
104
+ default:
105
+ throw new errors.ReferralExchangeError({
106
+ statusCode: _response.error.statusCode,
107
+ body: _response.error.body,
108
+ });
109
+ }
110
+ }
111
+ switch (_response.error.reason) {
112
+ case "non-json":
113
+ throw new errors.ReferralExchangeError({
114
+ statusCode: _response.error.statusCode,
115
+ body: _response.error.rawBody,
116
+ });
117
+ case "timeout":
118
+ throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/links/upsert.");
119
+ case "unknown":
120
+ throw new errors.ReferralExchangeError({
121
+ message: _response.error.errorMessage,
122
+ });
123
+ }
124
+ });
125
+ }
126
+ _getCustomAuthorizationHeaders() {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
129
+ return { Authorization: apiKeyValue };
130
+ });
131
+ }
132
+ }
133
+ exports.Links = Links;
@@ -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,47 @@
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
+ * referrerInstitutionId: "referrerInstitutionId",
9
+ * referrerInstitutionName: "referrerInstitutionName",
10
+ * referrerId: "referrerId",
11
+ * referrerName: "referrerName",
12
+ * referrerIdType: "referrerIdType",
13
+ * referrerEmail: "referrerEmail",
14
+ * referrerContactNumber: "referrerContactNumber",
15
+ * patientUin: "patientUin",
16
+ * patientName: "patientName",
17
+ * patientPhoneNumber: "91234567",
18
+ * patientDob: "1990-01-01",
19
+ * patientGender: "Male"
20
+ * }
21
+ */
22
+ export interface CreateLinkReqUpsert {
23
+ /** HCI code of the institution authoring this referral. */
24
+ referrerInstitutionId: string;
25
+ /** Name of the institution authoring this referral. */
26
+ referrerInstitutionName: string;
27
+ /** MCR number of the doctor authoring this referral. */
28
+ referrerId: string;
29
+ /** Name of the doctor authoring this referral. */
30
+ referrerName: string;
31
+ /** Type of the referrer ID */
32
+ referrerIdType: string;
33
+ /** Email of the doctor authoring this referral. */
34
+ referrerEmail: string;
35
+ /** Contact number of the doctor authoring this referral. */
36
+ referrerContactNumber: string;
37
+ /** Patient UIN, e.g. NRIC or FIN */
38
+ patientUin: string;
39
+ /** Patient name */
40
+ patientName: string;
41
+ /** Patient phone number - only Singaporean accepted for now */
42
+ patientPhoneNumber: string;
43
+ /** Patient date of birth */
44
+ patientDob: string;
45
+ /** Patient gender */
46
+ patientGender: ReferralExchange.CreateLinkReqUpsertPatientGender;
47
+ }
@@ -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 @@
1
+ export { type CreateLinkReqUpsert } from "./CreateLinkReqUpsert";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./types";
2
+ export * from "./client";
@@ -0,0 +1,18 @@
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("./types"), exports);
18
+ __exportStar(require("./client"), exports);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * Patient gender
6
+ */
7
+ export type CreateLinkReqUpsertPatientGender = "Male" | "Female";
8
+ export declare const CreateLinkReqUpsertPatientGender: {
9
+ readonly Male: "Male";
10
+ readonly Female: "Female";
11
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CreateLinkReqUpsertPatientGender = void 0;
7
+ exports.CreateLinkReqUpsertPatientGender = {
8
+ Male: "Male",
9
+ Female: "Female",
10
+ };
@@ -0,0 +1 @@
1
+ export * from "./CreateLinkReqUpsertPatientGender";
@@ -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("./CreateLinkReqUpsertPatientGender"), exports);
@@ -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.37", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.37", "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.39", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.39", "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,
@@ -45,8 +45,7 @@ export declare class Offerings {
45
45
  *
46
46
  * @example
47
47
  * await client.offerings.listTimeslots("offeringId", {
48
- * from: 1.1,
49
- * isSubsidised: true
48
+ * from: 1.1
50
49
  * })
51
50
  */
52
51
  listTimeslots(offeringId: string, request: ReferralExchange.OfferingsListTimeslotsRequest, requestOptions?: Offerings.RequestOptions): Promise<ReferralExchange.Timeslot[]>;
@@ -84,7 +84,7 @@ class Offerings {
84
84
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
85
85
  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"),
86
86
  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.37", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.37", "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),
87
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.39", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.39", "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
88
  contentType: "application/json",
89
89
  queryParameters: _queryParams,
90
90
  requestType: "json",
@@ -130,8 +130,7 @@ class Offerings {
130
130
  *
131
131
  * @example
132
132
  * await client.offerings.listTimeslots("offeringId", {
133
- * from: 1.1,
134
- * isSubsidised: true
133
+ * from: 1.1
135
134
  * })
136
135
  */
137
136
  listTimeslots(offeringId, request, requestOptions) {
@@ -140,11 +139,13 @@ class Offerings {
140
139
  const { from: from_, isSubsidised } = request;
141
140
  const _queryParams = {};
142
141
  _queryParams["from"] = from_.toString();
143
- _queryParams["isSubsidised"] = isSubsidised.toString();
142
+ if (isSubsidised != null) {
143
+ _queryParams["isSubsidised"] = isSubsidised.toString();
144
+ }
144
145
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
145
146
  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`),
146
147
  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.37", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.37", "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
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.39", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.39", "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
149
  contentType: "application/json",
149
150
  queryParameters: _queryParams,
150
151
  requestType: "json",
@@ -8,12 +8,12 @@ import * as ReferralExchange from "../../../../index";
8
8
  */
9
9
  export interface OfferingsListRequest {
10
10
  /**
11
- * ID of the referring individual. Use together with `referralIdType` and `referrerInstitutionId` to return offerings that a referrer is allowed to make referrals to.
11
+ * ID of the referring individual. Use together with `referralIdType` and `referrerInstitutionId` to filter based on referrer.
12
12
  */
13
13
  referrerId?: string;
14
14
  referrerIdType?: ReferralExchange.ReferrerIdType;
15
15
  /**
16
- * ID of the referring institution. Use together with `referrerId` and `referrerIdType` to return offerings that a referrer is allowed to make referrals to.
16
+ * ID of the referring institution. Use together with `referrerId` and `referrerIdType` to filter based on referrer.
17
17
  */
18
18
  referrerInstitutionId?: string;
19
19
  }
@@ -4,11 +4,10 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * from: 1.1,
8
- * isSubsidised: true
7
+ * from: 1.1
9
8
  * }
10
9
  */
11
10
  export interface OfferingsListTimeslotsRequest {
12
11
  from: number;
13
- isSubsidised: boolean;
12
+ isSubsidised?: boolean;
14
13
  }
@@ -84,7 +84,7 @@ class Public {
84
84
  const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
85
85
  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
86
  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.37", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.37", "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),
87
+ headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.39", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.39", "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
88
  contentType: "application/json",
89
89
  queryParameters: _queryParams,
90
90
  requestType: "json",