@opengovsg/refx-ts-sdk 2024.10.3 → 2025.2.20
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.
- package/Client.d.ts +6 -2
- package/Client.js +14 -9
- package/README.md +11 -11
- package/api/index.d.ts +1 -1
- package/api/index.js +1 -1
- package/api/resources/eligibility/client/Client.d.ts +3 -2
- package/api/resources/eligibility/client/Client.js +5 -4
- package/api/resources/health/client/Client.d.ts +3 -2
- package/api/resources/health/client/Client.js +5 -4
- package/api/resources/index.d.ts +4 -2
- package/api/resources/index.js +5 -3
- package/api/resources/notes/client/Client.d.ts +41 -0
- package/api/resources/notes/client/Client.js +105 -0
- package/api/resources/notes/client/index.d.ts +1 -0
- package/api/resources/{referrals/types → notes/client}/index.js +1 -2
- package/api/resources/notes/client/requests/CreateNoteReq.d.ts +15 -0
- package/api/resources/notes/client/requests/index.d.ts +1 -0
- package/api/resources/notes/client/requests/index.js +2 -0
- package/api/resources/notes/index.d.ts +1 -0
- package/{dist/api/resources/referrals/types → api/resources/notes}/index.js +1 -2
- package/api/resources/offerings/client/Client.d.ts +6 -12
- package/api/resources/offerings/client/Client.js +11 -55
- package/api/resources/offerings/client/requests/OfferingsListTimeslotsRequest.d.ts +3 -2
- package/api/resources/public/client/Client.d.ts +6 -4
- package/api/resources/public/client/Client.js +14 -6
- package/api/resources/public/client/index.d.ts +1 -1
- package/api/resources/public/client/index.js +15 -0
- package/api/resources/public/client/requests/PublicGetReferralRequest.d.ts +10 -0
- package/api/resources/public/client/requests/index.d.ts +1 -0
- package/api/resources/public/client/requests/index.js +2 -0
- package/api/resources/referrals/client/Client.d.ts +27 -19
- package/api/resources/referrals/client/Client.js +99 -49
- package/api/resources/referrals/client/requests/CreateReferralReq.d.ts +11 -13
- package/api/resources/referrals/client/requests/ReferralsGetRequest.d.ts +10 -0
- package/api/resources/referrals/client/requests/ReferralsListRequest.d.ts +9 -9
- package/api/resources/referrals/client/requests/index.d.ts +1 -0
- package/api/resources/referrals/index.d.ts +0 -1
- package/api/resources/referrals/index.js +0 -1
- package/api/resources/webhooks/client/Client.d.ts +7 -6
- package/api/resources/webhooks/client/Client.js +12 -11
- package/api/types/AttachmentDto.d.ts +8 -0
- package/api/types/CreatePatientReq.d.ts +1 -1
- package/api/types/Form.d.ts +11 -0
- package/api/types/FormResponse.d.ts +4 -0
- package/{dist/api/types/CancelledEventMetadata.d.ts → api/types/FormResponseAnswer.d.ts} +1 -3
- package/api/types/FullReferralDto.d.ts +7 -4
- package/api/types/FullReferralDtoStatus.d.ts +3 -1
- package/api/types/FullReferralDtoStatus.js +2 -0
- package/api/types/GetReferralPatientDto.d.ts +1 -1
- package/api/types/InstitutionCoreDto.d.ts +2 -1
- package/api/types/{OfferingFullDto.d.ts → OfferingDto.d.ts} +6 -3
- package/api/types/PaginatedQuery.d.ts +2 -2
- package/api/types/PublicReferralDto.d.ts +7 -2
- package/api/types/ReferralDto.d.ts +7 -4
- package/api/types/ReferralDtoStatus.d.ts +3 -1
- package/api/types/ReferralDtoStatus.js +2 -0
- package/api/types/ReferralEligibility.d.ts +1 -1
- package/api/{resources/referrals/types/ReferralsListRequestRole.d.ts → types/ReferralRole.d.ts} +2 -2
- package/{dist/api/resources/referrals/types/ReferralsListRequestRole.js → api/types/ReferralRole.js} +2 -2
- package/{dist/api/resources/referrals/types/ReferralsListRequestStatusItem.d.ts → api/types/ReferralStatusFilter.d.ts} +2 -2
- package/{dist/api/resources/referrals/types/ReferralsListRequestStatusItem.js → api/types/ReferralStatusFilter.js} +2 -2
- package/api/types/ReferringDoctorDto.d.ts +9 -0
- package/api/types/SubsidyEligibility.d.ts +1 -1
- package/api/types/System.d.ts +11 -0
- package/api/types/System.js +13 -0
- package/api/types/TimelineEventDto.d.ts +4 -2
- package/api/types/TimelineEventDtoSystem.d.ts +5 -1
- package/api/types/TimelineEventDtoSystem.js +1 -0
- package/{dist/api/types/TimelineEventDtoType.d.ts → api/types/TimelineEventType.d.ts} +3 -2
- package/{dist/api/types/TimelineEventDtoType.js → api/types/TimelineEventType.js} +3 -2
- package/api/types/TimeslotPolicy.d.ts +15 -0
- package/api/types/TimeslotPolicy.js +11 -0
- package/api/types/index.d.ts +10 -15
- package/api/types/index.js +10 -15
- package/dist/Client.d.ts +6 -2
- package/dist/Client.js +14 -9
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/resources/eligibility/client/Client.d.ts +3 -2
- package/dist/api/resources/eligibility/client/Client.js +5 -4
- package/dist/api/resources/health/client/Client.d.ts +3 -2
- package/dist/api/resources/health/client/Client.js +5 -4
- package/dist/api/resources/index.d.ts +4 -2
- package/dist/api/resources/index.js +5 -3
- package/dist/api/resources/notes/client/Client.d.ts +41 -0
- package/dist/api/resources/notes/client/Client.js +105 -0
- package/dist/api/resources/notes/client/index.d.ts +1 -0
- package/dist/api/resources/notes/client/index.js +17 -0
- package/dist/api/resources/notes/client/requests/CreateNoteReq.d.ts +15 -0
- package/dist/api/resources/notes/client/requests/index.d.ts +1 -0
- package/dist/api/resources/notes/client/requests/index.js +2 -0
- package/dist/api/resources/notes/index.d.ts +1 -0
- package/dist/api/resources/notes/index.js +17 -0
- package/dist/api/resources/offerings/client/Client.d.ts +6 -12
- package/dist/api/resources/offerings/client/Client.js +11 -55
- package/dist/api/resources/offerings/client/requests/OfferingsListTimeslotsRequest.d.ts +3 -2
- package/dist/api/resources/public/client/Client.d.ts +6 -4
- package/dist/api/resources/public/client/Client.js +14 -6
- package/dist/api/resources/public/client/index.d.ts +1 -1
- package/dist/api/resources/public/client/index.js +15 -0
- package/dist/api/resources/public/client/requests/PublicGetReferralRequest.d.ts +10 -0
- package/dist/api/resources/public/client/requests/index.d.ts +1 -0
- package/dist/api/resources/public/client/requests/index.js +2 -0
- package/dist/api/resources/referrals/client/Client.d.ts +27 -19
- package/dist/api/resources/referrals/client/Client.js +99 -49
- package/dist/api/resources/referrals/client/requests/CreateReferralReq.d.ts +11 -13
- package/dist/api/resources/referrals/client/requests/ReferralsGetRequest.d.ts +10 -0
- package/dist/api/resources/referrals/client/requests/ReferralsListRequest.d.ts +9 -9
- package/dist/api/resources/referrals/client/requests/index.d.ts +1 -0
- package/dist/api/resources/referrals/index.d.ts +0 -1
- package/dist/api/resources/referrals/index.js +0 -1
- package/dist/api/resources/webhooks/client/Client.d.ts +7 -6
- package/dist/api/resources/webhooks/client/Client.js +12 -11
- package/dist/api/types/AttachmentDto.d.ts +8 -0
- package/dist/api/types/CreatePatientReq.d.ts +1 -1
- package/dist/api/types/Form.d.ts +11 -0
- package/dist/api/types/FormResponse.d.ts +4 -0
- package/{api/types/CancelledEventMetadata.d.ts → dist/api/types/FormResponseAnswer.d.ts} +1 -3
- package/dist/api/types/FullReferralDto.d.ts +7 -4
- package/dist/api/types/FullReferralDtoStatus.d.ts +3 -1
- package/dist/api/types/FullReferralDtoStatus.js +2 -0
- package/dist/api/types/GetReferralPatientDto.d.ts +1 -1
- package/dist/api/types/InstitutionCoreDto.d.ts +2 -1
- package/dist/api/types/{OfferingFullDto.d.ts → OfferingDto.d.ts} +6 -3
- package/dist/api/types/PaginatedQuery.d.ts +2 -2
- package/dist/api/types/PublicReferralDto.d.ts +7 -2
- package/dist/api/types/ReferralDto.d.ts +7 -4
- package/dist/api/types/ReferralDtoStatus.d.ts +3 -1
- package/dist/api/types/ReferralDtoStatus.js +2 -0
- package/dist/api/types/ReferralEligibility.d.ts +1 -1
- package/dist/api/{resources/referrals/types/ReferralsListRequestRole.d.ts → types/ReferralRole.d.ts} +2 -2
- package/{api/resources/referrals/types/ReferralsListRequestRole.js → dist/api/types/ReferralRole.js} +2 -2
- package/{api/resources/referrals/types/ReferralsListRequestStatusItem.d.ts → dist/api/types/ReferralStatusFilter.d.ts} +2 -2
- package/{api/resources/referrals/types/ReferralsListRequestStatusItem.js → dist/api/types/ReferralStatusFilter.js} +2 -2
- package/dist/api/types/ReferringDoctorDto.d.ts +9 -0
- package/dist/api/types/SubsidyEligibility.d.ts +1 -1
- package/dist/api/types/System.d.ts +11 -0
- package/dist/api/types/System.js +13 -0
- package/dist/api/types/TimelineEventDto.d.ts +4 -2
- package/dist/api/types/TimelineEventDtoSystem.d.ts +5 -1
- package/dist/api/types/TimelineEventDtoSystem.js +1 -0
- package/{api/types/TimelineEventDtoType.d.ts → dist/api/types/TimelineEventType.d.ts} +3 -2
- package/{api/types/TimelineEventDtoType.js → dist/api/types/TimelineEventType.js} +3 -2
- package/dist/api/types/TimeslotPolicy.d.ts +15 -0
- package/dist/api/types/TimeslotPolicy.js +11 -0
- package/dist/api/types/index.d.ts +10 -15
- package/dist/api/types/index.js +10 -15
- package/dist/environments.d.ts +8 -0
- package/dist/environments.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/environments.d.ts +8 -0
- package/environments.js +10 -0
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/package.json +1 -1
- package/reference.md +108 -31
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/api/resources/referrals/types/index.d.ts +0 -2
- package/api/types/CreatedEventMetadata.d.ts +0 -6
- package/api/types/EaReminderSentMetadata.d.ts +0 -6
- package/api/types/FullReferralDtoReferringDoctor.d.ts +0 -9
- package/api/types/NoteCreatedMetadata.d.ts +0 -8
- package/api/types/OfferingCoreDto.d.ts +0 -15
- package/api/types/PublicReferralDtoReferringDoctor.d.ts +0 -9
- package/api/types/ReferralAmendedMetadata.d.ts +0 -7
- package/api/types/ReferralDtoReferringDoctor.d.ts +0 -9
- package/api/types/RejectedEventMetadata.d.ts +0 -7
- package/api/types/RescheduleEventMetadata.d.ts +0 -8
- package/api/types/SingHealthPatientDetailsMetadata.d.ts +0 -7
- package/api/types/TimelineEventDtoMetadata.d.ts +0 -5
- package/dist/api/resources/referrals/types/index.d.ts +0 -2
- package/dist/api/types/CreatedEventMetadata.d.ts +0 -6
- package/dist/api/types/EaReminderSentMetadata.d.ts +0 -6
- package/dist/api/types/EaReminderSentMetadata.js +0 -5
- package/dist/api/types/FullReferralDtoReferringDoctor.d.ts +0 -9
- package/dist/api/types/FullReferralDtoReferringDoctor.js +0 -5
- package/dist/api/types/NoteCreatedMetadata.d.ts +0 -8
- package/dist/api/types/NoteCreatedMetadata.js +0 -5
- package/dist/api/types/OfferingCoreDto.d.ts +0 -15
- package/dist/api/types/OfferingCoreDto.js +0 -5
- package/dist/api/types/OfferingFullDto.js +0 -5
- package/dist/api/types/PublicReferralDtoReferringDoctor.d.ts +0 -9
- package/dist/api/types/PublicReferralDtoReferringDoctor.js +0 -5
- package/dist/api/types/ReferralAmendedMetadata.d.ts +0 -7
- package/dist/api/types/ReferralAmendedMetadata.js +0 -5
- package/dist/api/types/ReferralDtoReferringDoctor.d.ts +0 -9
- package/dist/api/types/ReferralDtoReferringDoctor.js +0 -5
- package/dist/api/types/RejectedEventMetadata.d.ts +0 -7
- package/dist/api/types/RejectedEventMetadata.js +0 -5
- package/dist/api/types/RescheduleEventMetadata.d.ts +0 -8
- package/dist/api/types/RescheduleEventMetadata.js +0 -5
- package/dist/api/types/SingHealthPatientDetailsMetadata.d.ts +0 -7
- package/dist/api/types/SingHealthPatientDetailsMetadata.js +0 -5
- package/dist/api/types/TimelineEventDtoMetadata.d.ts +0 -5
- package/dist/api/types/TimelineEventDtoMetadata.js +0 -5
- /package/api/{types/CancelledEventMetadata.js → resources/notes/client/requests/CreateNoteReq.js} +0 -0
- /package/api/{types/CreatedEventMetadata.js → resources/public/client/requests/PublicGetReferralRequest.js} +0 -0
- /package/api/{types/EaReminderSentMetadata.js → resources/referrals/client/requests/ReferralsGetRequest.js} +0 -0
- /package/api/types/{FullReferralDtoReferringDoctor.js → AttachmentDto.js} +0 -0
- /package/api/types/{NoteCreatedMetadata.js → Form.js} +0 -0
- /package/api/types/{OfferingCoreDto.js → FormResponseAnswer.js} +0 -0
- /package/api/types/{OfferingFullDto.js → OfferingDto.js} +0 -0
- /package/api/types/{PublicReferralDtoReferringDoctor.js → ReferringDoctorDto.js} +0 -0
- /package/{api/types/ReferralAmendedMetadata.js → dist/api/resources/notes/client/requests/CreateNoteReq.js} +0 -0
- /package/{api/types/ReferralDtoReferringDoctor.js → dist/api/resources/public/client/requests/PublicGetReferralRequest.js} +0 -0
- /package/{api/types/RejectedEventMetadata.js → dist/api/resources/referrals/client/requests/ReferralsGetRequest.js} +0 -0
- /package/{api/types/RescheduleEventMetadata.js → dist/api/types/AttachmentDto.js} +0 -0
- /package/{api/types/SingHealthPatientDetailsMetadata.js → dist/api/types/Form.js} +0 -0
- /package/{api/types/TimelineEventDtoMetadata.js → dist/api/types/FormResponseAnswer.js} +0 -0
- /package/dist/api/types/{CancelledEventMetadata.js → OfferingDto.js} +0 -0
- /package/dist/api/types/{CreatedEventMetadata.js → ReferringDoctorDto.js} +0 -0
|
@@ -39,11 +39,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Referrals = void 0;
|
|
42
|
+
const environments = __importStar(require("../../../../environments"));
|
|
42
43
|
const core = __importStar(require("../../../../core"));
|
|
43
44
|
const url_join_1 = __importDefault(require("url-join"));
|
|
44
45
|
const errors = __importStar(require("../../../../errors/index"));
|
|
45
46
|
class Referrals {
|
|
46
|
-
constructor(_options) {
|
|
47
|
+
constructor(_options = {}) {
|
|
47
48
|
this._options = _options;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
@@ -56,10 +57,16 @@ class Referrals {
|
|
|
56
57
|
* })
|
|
57
58
|
*/
|
|
58
59
|
list(request, requestOptions) {
|
|
59
|
-
var _a;
|
|
60
|
+
var _a, _b;
|
|
60
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const {
|
|
62
|
+
const { offset, pageSize, hciCode, status, role } = request;
|
|
62
63
|
const _queryParams = {};
|
|
64
|
+
if (offset != null) {
|
|
65
|
+
_queryParams["offset"] = offset.toString();
|
|
66
|
+
}
|
|
67
|
+
if (pageSize != null) {
|
|
68
|
+
_queryParams["pageSize"] = pageSize.toString();
|
|
69
|
+
}
|
|
63
70
|
_queryParams["hciCode"] = hciCode;
|
|
64
71
|
if (status != null) {
|
|
65
72
|
if (Array.isArray(status)) {
|
|
@@ -72,16 +79,10 @@ class Referrals {
|
|
|
72
79
|
if (role != null) {
|
|
73
80
|
_queryParams["role"] = role;
|
|
74
81
|
}
|
|
75
|
-
if (offset != null) {
|
|
76
|
-
_queryParams["offset"] = JSON.stringify(offset);
|
|
77
|
-
}
|
|
78
|
-
if (pageSize != null) {
|
|
79
|
-
_queryParams["pageSize"] = JSON.stringify(pageSize);
|
|
80
|
-
}
|
|
81
82
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
82
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "api/v1/referrals"),
|
|
83
|
+
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"),
|
|
83
84
|
method: "GET",
|
|
84
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "
|
|
85
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
85
86
|
contentType: "application/json",
|
|
86
87
|
queryParameters: _queryParams,
|
|
87
88
|
requestType: "json",
|
|
@@ -133,25 +134,23 @@ class Referrals {
|
|
|
133
134
|
* doctorName: "doctorName",
|
|
134
135
|
* doctorEmail: "doctorEmail",
|
|
135
136
|
* doctorContactNumber: "doctorContactNumber",
|
|
136
|
-
* isSubsidised:
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* },
|
|
145
|
-
* formResponses: [{}]
|
|
137
|
+
* isSubsidised: true,
|
|
138
|
+
* isUrgent: true,
|
|
139
|
+
* isDraft: true,
|
|
140
|
+
* formResponses: [{
|
|
141
|
+
* question: "question",
|
|
142
|
+
* id: "id",
|
|
143
|
+
* answer: "answer"
|
|
144
|
+
* }]
|
|
146
145
|
* })
|
|
147
146
|
*/
|
|
148
147
|
upsert(request, requestOptions) {
|
|
149
|
-
var _a;
|
|
148
|
+
var _a, _b;
|
|
150
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
150
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
152
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "api/v1/referrals"),
|
|
151
|
+
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"),
|
|
153
152
|
method: "POST",
|
|
154
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "
|
|
153
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
155
154
|
contentType: "application/json",
|
|
156
155
|
requestType: "json",
|
|
157
156
|
body: request,
|
|
@@ -184,20 +183,27 @@ class Referrals {
|
|
|
184
183
|
});
|
|
185
184
|
}
|
|
186
185
|
/**
|
|
187
|
-
* @param {string} referralId
|
|
186
|
+
* @param {string} referralId - Referral ID
|
|
187
|
+
* @param {ReferralExchange.ReferralsGetRequest} request
|
|
188
188
|
* @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
|
|
189
189
|
*
|
|
190
190
|
* @example
|
|
191
191
|
* await client.referrals.get("referralId")
|
|
192
192
|
*/
|
|
193
|
-
get(referralId, requestOptions) {
|
|
194
|
-
var _a;
|
|
193
|
+
get(referralId, request = {}, requestOptions) {
|
|
194
|
+
var _a, _b;
|
|
195
195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
const { includeAttachments } = request;
|
|
197
|
+
const _queryParams = {};
|
|
198
|
+
if (includeAttachments != null) {
|
|
199
|
+
_queryParams["includeAttachments"] = includeAttachments.toString();
|
|
200
|
+
}
|
|
196
201
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
197
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `api/v1/referrals/${encodeURIComponent(referralId)}`),
|
|
202
|
+
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)}`),
|
|
198
203
|
method: "GET",
|
|
199
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "
|
|
204
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
200
205
|
contentType: "application/json",
|
|
206
|
+
queryParameters: _queryParams,
|
|
201
207
|
requestType: "json",
|
|
202
208
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
203
209
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -228,19 +234,19 @@ class Referrals {
|
|
|
228
234
|
});
|
|
229
235
|
}
|
|
230
236
|
/**
|
|
231
|
-
* @param {string} referralId
|
|
237
|
+
* @param {string} referralId - Referral ID
|
|
232
238
|
* @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
|
|
233
239
|
*
|
|
234
240
|
* @example
|
|
235
241
|
* await client.referrals.delete("referralId")
|
|
236
242
|
*/
|
|
237
243
|
delete(referralId, requestOptions) {
|
|
238
|
-
var _a;
|
|
244
|
+
var _a, _b;
|
|
239
245
|
return __awaiter(this, void 0, void 0, function* () {
|
|
240
246
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
241
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `api/v1/referrals/${encodeURIComponent(referralId)}`),
|
|
247
|
+
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)}`),
|
|
242
248
|
method: "DELETE",
|
|
243
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "
|
|
249
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
244
250
|
contentType: "application/json",
|
|
245
251
|
requestType: "json",
|
|
246
252
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -272,7 +278,7 @@ class Referrals {
|
|
|
272
278
|
});
|
|
273
279
|
}
|
|
274
280
|
/**
|
|
275
|
-
* @param {string} referralId
|
|
281
|
+
* @param {string} referralId - Referral ID
|
|
276
282
|
* @param {ReferralExchange.CancelReferralReq} request
|
|
277
283
|
* @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
|
|
278
284
|
*
|
|
@@ -280,12 +286,12 @@ class Referrals {
|
|
|
280
286
|
* await client.referrals.cancel("referralId")
|
|
281
287
|
*/
|
|
282
288
|
cancel(referralId, request = {}, requestOptions) {
|
|
283
|
-
var _a;
|
|
289
|
+
var _a, _b;
|
|
284
290
|
return __awaiter(this, void 0, void 0, function* () {
|
|
285
291
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
286
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `api/v1/referrals/${encodeURIComponent(referralId)}/cancel`),
|
|
292
|
+
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)}/cancel`),
|
|
287
293
|
method: "POST",
|
|
288
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "
|
|
294
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
289
295
|
contentType: "application/json",
|
|
290
296
|
requestType: "json",
|
|
291
297
|
body: request,
|
|
@@ -318,7 +324,7 @@ class Referrals {
|
|
|
318
324
|
});
|
|
319
325
|
}
|
|
320
326
|
/**
|
|
321
|
-
* @param {string} referralId
|
|
327
|
+
* @param {string} referralId - Referral ID
|
|
322
328
|
* @param {ReferralExchange.AmendReferralReq} request
|
|
323
329
|
* @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
|
|
324
330
|
*
|
|
@@ -328,12 +334,12 @@ class Referrals {
|
|
|
328
334
|
* })
|
|
329
335
|
*/
|
|
330
336
|
amend(referralId, request, requestOptions) {
|
|
331
|
-
var _a;
|
|
337
|
+
var _a, _b;
|
|
332
338
|
return __awaiter(this, void 0, void 0, function* () {
|
|
333
339
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
334
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `api/v1/referrals/${encodeURIComponent(referralId)}/amend`),
|
|
340
|
+
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)}/amend`),
|
|
335
341
|
method: "POST",
|
|
336
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "
|
|
342
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
337
343
|
contentType: "application/json",
|
|
338
344
|
requestType: "json",
|
|
339
345
|
body: request,
|
|
@@ -366,7 +372,7 @@ class Referrals {
|
|
|
366
372
|
});
|
|
367
373
|
}
|
|
368
374
|
/**
|
|
369
|
-
* @param {string} referralId
|
|
375
|
+
* @param {string} referralId - Referral ID
|
|
370
376
|
* @param {ReferralExchange.EaConfirmReferralBody} request
|
|
371
377
|
* @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
|
|
372
378
|
*
|
|
@@ -376,12 +382,12 @@ class Referrals {
|
|
|
376
382
|
* })
|
|
377
383
|
*/
|
|
378
384
|
accept(referralId, request, requestOptions) {
|
|
379
|
-
var _a;
|
|
385
|
+
var _a, _b;
|
|
380
386
|
return __awaiter(this, void 0, void 0, function* () {
|
|
381
387
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
382
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `api/v1/referrals/${encodeURIComponent(referralId)}/accept/ea`),
|
|
388
|
+
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)}/accept/ea`),
|
|
383
389
|
method: "POST",
|
|
384
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "
|
|
390
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
385
391
|
contentType: "application/json",
|
|
386
392
|
requestType: "json",
|
|
387
393
|
body: request,
|
|
@@ -414,7 +420,7 @@ class Referrals {
|
|
|
414
420
|
});
|
|
415
421
|
}
|
|
416
422
|
/**
|
|
417
|
-
* @param {string} referralId
|
|
423
|
+
* @param {string} referralId - Referral ID
|
|
418
424
|
* @param {ReferralExchange.EaRejectReferralBody} request
|
|
419
425
|
* @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
|
|
420
426
|
*
|
|
@@ -424,12 +430,12 @@ class Referrals {
|
|
|
424
430
|
* })
|
|
425
431
|
*/
|
|
426
432
|
reject(referralId, request, requestOptions) {
|
|
427
|
-
var _a;
|
|
433
|
+
var _a, _b;
|
|
428
434
|
return __awaiter(this, void 0, void 0, function* () {
|
|
429
435
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
430
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `api/v1/referrals/${encodeURIComponent(referralId)}/reject/ea`),
|
|
436
|
+
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)}/reject/ea`),
|
|
431
437
|
method: "POST",
|
|
432
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "
|
|
438
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
433
439
|
contentType: "application/json",
|
|
434
440
|
requestType: "json",
|
|
435
441
|
body: request,
|
|
@@ -461,6 +467,50 @@ class Referrals {
|
|
|
461
467
|
}
|
|
462
468
|
});
|
|
463
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* @param {string} referralId - Referral ID
|
|
472
|
+
* @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* await client.referrals.backToDraft("referralId")
|
|
476
|
+
*/
|
|
477
|
+
backToDraft(referralId, requestOptions) {
|
|
478
|
+
var _a, _b;
|
|
479
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
480
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
481
|
+
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)}/back-to-draft`),
|
|
482
|
+
method: "POST",
|
|
483
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
484
|
+
contentType: "application/json",
|
|
485
|
+
requestType: "json",
|
|
486
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
487
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
488
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
489
|
+
});
|
|
490
|
+
if (_response.ok) {
|
|
491
|
+
return _response.body;
|
|
492
|
+
}
|
|
493
|
+
if (_response.error.reason === "status-code") {
|
|
494
|
+
throw new errors.ReferralExchangeError({
|
|
495
|
+
statusCode: _response.error.statusCode,
|
|
496
|
+
body: _response.error.body,
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
switch (_response.error.reason) {
|
|
500
|
+
case "non-json":
|
|
501
|
+
throw new errors.ReferralExchangeError({
|
|
502
|
+
statusCode: _response.error.statusCode,
|
|
503
|
+
body: _response.error.rawBody,
|
|
504
|
+
});
|
|
505
|
+
case "timeout":
|
|
506
|
+
throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/referrals/{referralId}/back-to-draft.");
|
|
507
|
+
case "unknown":
|
|
508
|
+
throw new errors.ReferralExchangeError({
|
|
509
|
+
message: _response.error.errorMessage,
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
}
|
|
464
514
|
_getCustomAuthorizationHeaders() {
|
|
465
515
|
return __awaiter(this, void 0, void 0, function* () {
|
|
466
516
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
@@ -19,16 +19,14 @@ import * as ReferralExchange from "../../../../index";
|
|
|
19
19
|
* doctorName: "doctorName",
|
|
20
20
|
* doctorEmail: "doctorEmail",
|
|
21
21
|
* doctorContactNumber: "doctorContactNumber",
|
|
22
|
-
* isSubsidised:
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* },
|
|
31
|
-
* formResponses: [{}]
|
|
22
|
+
* isSubsidised: true,
|
|
23
|
+
* isUrgent: true,
|
|
24
|
+
* isDraft: true,
|
|
25
|
+
* formResponses: [{
|
|
26
|
+
* question: "question",
|
|
27
|
+
* id: "id",
|
|
28
|
+
* answer: "answer"
|
|
29
|
+
* }]
|
|
32
30
|
* }
|
|
33
31
|
*/
|
|
34
32
|
export interface CreateReferralReq {
|
|
@@ -46,10 +44,10 @@ export interface CreateReferralReq {
|
|
|
46
44
|
doctorEmail: string;
|
|
47
45
|
/** Contact number of the doctor authoring this referral. */
|
|
48
46
|
doctorContactNumber: string;
|
|
49
|
-
isSubsidised:
|
|
50
|
-
isUrgent:
|
|
47
|
+
isSubsidised: boolean;
|
|
48
|
+
isUrgent: boolean;
|
|
51
49
|
/** In draft state, further edits can be made. No referral will be emitted to the service provider yet. */
|
|
52
|
-
isDraft:
|
|
50
|
+
isDraft: boolean;
|
|
53
51
|
/** Referral ID */
|
|
54
52
|
id?: string;
|
|
55
53
|
/** Timeslot start time, in milliseconds since epoch. */
|
|
@@ -10,20 +10,20 @@ import * as ReferralExchange from "../../../../index";
|
|
|
10
10
|
*/
|
|
11
11
|
export interface ReferralsListRequest {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Offset for pagination
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
status?: ReferralExchange.ReferralsListRequestStatusItem | ReferralExchange.ReferralsListRequestStatusItem[];
|
|
15
|
+
offset?: number;
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
17
|
+
* Number of items per page
|
|
19
18
|
*/
|
|
20
|
-
|
|
19
|
+
pageSize?: number;
|
|
21
20
|
/**
|
|
22
|
-
*
|
|
21
|
+
* To identify the requesting institution
|
|
23
22
|
*/
|
|
24
|
-
|
|
23
|
+
hciCode: string;
|
|
24
|
+
status?: ReferralExchange.ReferralStatusFilter | ReferralExchange.ReferralStatusFilter[];
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* To filter by the institution's role in the referral. e.g. For outbound referrals, use "sender'
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
role?: ReferralExchange.ReferralRole;
|
|
29
29
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { type ReferralsListRequest } from "./ReferralsListRequest";
|
|
2
2
|
export { type CreateReferralReq } from "./CreateReferralReq";
|
|
3
|
+
export { type ReferralsGetRequest } from "./ReferralsGetRequest";
|
|
3
4
|
export { type CancelReferralReq } from "./CancelReferralReq";
|
|
4
5
|
export { type AmendReferralReq } from "./AmendReferralReq";
|
|
5
6
|
export { type EaConfirmReferralBody } from "./EaConfirmReferralBody";
|
|
@@ -14,5 +14,4 @@ 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("./types"), exports);
|
|
18
17
|
__exportStar(require("./client"), exports);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as environments from "../../../../environments";
|
|
4
5
|
import * as core from "../../../../core";
|
|
5
6
|
export declare namespace Webhooks {
|
|
6
7
|
interface Options {
|
|
7
|
-
environment
|
|
8
|
+
environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
|
|
8
9
|
apiKey?: core.Supplier<string | undefined>;
|
|
9
10
|
fetcher?: core.FetchFunction;
|
|
10
11
|
}
|
|
@@ -21,22 +22,22 @@ export declare namespace Webhooks {
|
|
|
21
22
|
}
|
|
22
23
|
export declare class Webhooks {
|
|
23
24
|
protected readonly _options: Webhooks.Options;
|
|
24
|
-
constructor(_options
|
|
25
|
+
constructor(_options?: Webhooks.Options);
|
|
25
26
|
/**
|
|
26
27
|
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
27
28
|
*
|
|
28
29
|
* @example
|
|
29
|
-
* await client.webhooks.
|
|
30
|
+
* await client.webhooks.submitSingHealthFormsg()
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
|
+
submitSingHealthFormsg(requestOptions?: Webhooks.RequestOptions): Promise<void>;
|
|
32
33
|
/**
|
|
33
34
|
* @param {string} formId
|
|
34
35
|
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
35
36
|
*
|
|
36
37
|
* @example
|
|
37
|
-
* await client.webhooks.
|
|
38
|
+
* await client.webhooks.submitFormsg("formId")
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
submitFormsg(formId: string, requestOptions?: Webhooks.RequestOptions): Promise<void>;
|
|
40
41
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
41
42
|
Authorization: string | undefined;
|
|
42
43
|
}>;
|
|
@@ -39,26 +39,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Webhooks = void 0;
|
|
42
|
+
const environments = __importStar(require("../../../../environments"));
|
|
42
43
|
const core = __importStar(require("../../../../core"));
|
|
43
44
|
const url_join_1 = __importDefault(require("url-join"));
|
|
44
45
|
const errors = __importStar(require("../../../../errors/index"));
|
|
45
46
|
class Webhooks {
|
|
46
|
-
constructor(_options) {
|
|
47
|
+
constructor(_options = {}) {
|
|
47
48
|
this._options = _options;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
51
52
|
*
|
|
52
53
|
* @example
|
|
53
|
-
* await client.webhooks.
|
|
54
|
+
* await client.webhooks.submitSingHealthFormsg()
|
|
54
55
|
*/
|
|
55
|
-
|
|
56
|
-
var _a;
|
|
56
|
+
submitSingHealthFormsg(requestOptions) {
|
|
57
|
+
var _a, _b;
|
|
57
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
59
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
59
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "api/v1/webhooks/formsg/singhealth-profile"),
|
|
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/webhooks/formsg/singhealth-profile"),
|
|
60
61
|
method: "POST",
|
|
61
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "
|
|
62
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
62
63
|
contentType: "application/json",
|
|
63
64
|
requestType: "json",
|
|
64
65
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -94,15 +95,15 @@ class Webhooks {
|
|
|
94
95
|
* @param {Webhooks.RequestOptions} requestOptions - Request-specific configuration.
|
|
95
96
|
*
|
|
96
97
|
* @example
|
|
97
|
-
* await client.webhooks.
|
|
98
|
+
* await client.webhooks.submitFormsg("formId")
|
|
98
99
|
*/
|
|
99
|
-
|
|
100
|
-
var _a;
|
|
100
|
+
submitFormsg(formId, requestOptions) {
|
|
101
|
+
var _a, _b;
|
|
101
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
103
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
103
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `api/v1/webhooks/formsg/form-submission/${encodeURIComponent(formId)}`),
|
|
104
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ReferralExchangeEnvironment.Production, `api/v1/webhooks/formsg/form-submission/${encodeURIComponent(formId)}`),
|
|
104
105
|
method: "POST",
|
|
105
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "
|
|
106
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "2025.2.20", "User-Agent": "@opengovsg/refx-ts-sdk/2025.2.20", "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),
|
|
106
107
|
contentType: "application/json",
|
|
107
108
|
requestType: "json",
|
|
108
109
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as ReferralExchange from "../index";
|
|
5
|
+
export interface Form {
|
|
6
|
+
id: string;
|
|
7
|
+
url: string;
|
|
8
|
+
description: string;
|
|
9
|
+
isFilled: boolean;
|
|
10
|
+
formResponses: ReferralExchange.FormResponse[];
|
|
11
|
+
}
|
|
@@ -5,19 +5,22 @@ import * as ReferralExchange from "../index";
|
|
|
5
5
|
export interface FullReferralDto {
|
|
6
6
|
id: string;
|
|
7
7
|
sender: ReferralExchange.InstitutionCoreDto;
|
|
8
|
-
offering: ReferralExchange.
|
|
8
|
+
offering: ReferralExchange.OfferingDto;
|
|
9
9
|
patient: ReferralExchange.GetReferralPatientDto;
|
|
10
|
-
referringDoctor: ReferralExchange.
|
|
10
|
+
referringDoctor: ReferralExchange.ReferringDoctorDto;
|
|
11
11
|
isSubsidised: boolean;
|
|
12
12
|
isUrgent: boolean;
|
|
13
13
|
/** Created at (ISO datetime) */
|
|
14
14
|
createdAt: string;
|
|
15
15
|
formResponses: ReferralExchange.FormResponse[];
|
|
16
|
+
/** Form ID of the referral form */
|
|
17
|
+
formId?: string;
|
|
18
|
+
/** List of forms required to complete the referral */
|
|
19
|
+
forms?: ReferralExchange.Form[];
|
|
20
|
+
attachments: ReferralExchange.AttachmentDto[];
|
|
16
21
|
status: ReferralExchange.FullReferralDtoStatus;
|
|
17
22
|
/** Timeslot start time (ISO datetime) */
|
|
18
23
|
timeslotStartAt?: string;
|
|
19
|
-
/** TODO - do not use this, will be removed */
|
|
20
|
-
rejectionReason?: string;
|
|
21
24
|
notes: ReferralExchange.NoteDto[];
|
|
22
25
|
/** URL of the FormSG required to complete the referral */
|
|
23
26
|
formUrl?: string;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
export declare type FullReferralDtoStatus = "draft" | "created" | "processing-has" | "processing-pb" | "processing-ea" | "pending-singhealth-formsg" | "pending-singhealth-call-centre" | "referral-confirmed-pending-appt" | "pending-email-ack" | "pending-amend-timeslot" | "confirmed" | "rejected" | "failed" | "pending-cancelled" | "cancelled";
|
|
4
|
+
export declare type FullReferralDtoStatus = "draft" | "created" | "processing-has" | "processing-pb" | "processing-ea" | "processing-bright" | "pending-singhealth-formsg" | "pending-singhealth-call-centre" | "referral-confirmed-pending-appt" | "pending-email-ack" | "submitted-to-bright" | "pending-amend-timeslot" | "confirmed" | "rejected" | "failed" | "pending-cancelled" | "cancelled";
|
|
5
5
|
export declare const FullReferralDtoStatus: {
|
|
6
6
|
readonly Draft: "draft";
|
|
7
7
|
readonly Created: "created";
|
|
8
8
|
readonly ProcessingHas: "processing-has";
|
|
9
9
|
readonly ProcessingPb: "processing-pb";
|
|
10
10
|
readonly ProcessingEa: "processing-ea";
|
|
11
|
+
readonly ProcessingBright: "processing-bright";
|
|
11
12
|
readonly PendingSinghealthFormsg: "pending-singhealth-formsg";
|
|
12
13
|
readonly PendingSinghealthCallCentre: "pending-singhealth-call-centre";
|
|
13
14
|
readonly ReferralConfirmedPendingAppt: "referral-confirmed-pending-appt";
|
|
14
15
|
readonly PendingEmailAck: "pending-email-ack";
|
|
16
|
+
readonly SubmittedToBright: "submitted-to-bright";
|
|
15
17
|
readonly PendingAmendTimeslot: "pending-amend-timeslot";
|
|
16
18
|
readonly Confirmed: "confirmed";
|
|
17
19
|
readonly Rejected: "rejected";
|
|
@@ -10,10 +10,12 @@ exports.FullReferralDtoStatus = {
|
|
|
10
10
|
ProcessingHas: "processing-has",
|
|
11
11
|
ProcessingPb: "processing-pb",
|
|
12
12
|
ProcessingEa: "processing-ea",
|
|
13
|
+
ProcessingBright: "processing-bright",
|
|
13
14
|
PendingSinghealthFormsg: "pending-singhealth-formsg",
|
|
14
15
|
PendingSinghealthCallCentre: "pending-singhealth-call-centre",
|
|
15
16
|
ReferralConfirmedPendingAppt: "referral-confirmed-pending-appt",
|
|
16
17
|
PendingEmailAck: "pending-email-ack",
|
|
18
|
+
SubmittedToBright: "submitted-to-bright",
|
|
17
19
|
PendingAmendTimeslot: "pending-amend-timeslot",
|
|
18
20
|
Confirmed: "confirmed",
|
|
19
21
|
Rejected: "rejected",
|