@opengovsg/refx-ts-sdk 0.0.60 → 0.0.62
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 +3 -0
- package/Client.js +15 -10
- package/api/resources/eligibility/client/Client.js +1 -1
- package/api/resources/health/client/Client.js +1 -1
- package/api/resources/index.d.ts +2 -0
- package/api/resources/index.js +3 -1
- package/api/resources/links/client/Client.d.ts +2 -1
- package/api/resources/links/client/Client.js +2 -1
- package/api/resources/links/client/requests/CreateLinkReqUpsert.d.ts +2 -1
- package/api/resources/links/types/CreateLinkReqUpsertClinicType.d.ts +2 -1
- package/api/resources/links/types/CreateLinkReqUpsertClinicType.js +1 -0
- package/api/resources/notes/client/Client.d.ts +3 -1
- package/api/resources/notes/client/Client.js +5 -3
- package/api/resources/notes/client/requests/CreateNoteReq.d.ts +5 -1
- package/api/resources/offerings/client/Client.js +3 -3
- package/api/resources/public/client/Client.d.ts +4 -2
- package/api/resources/public/client/Client.js +10 -8
- package/api/resources/public/client/requests/PublicGetReferralRequest.d.ts +13 -3
- package/api/resources/referrals/client/Client.d.ts +32 -12
- package/api/resources/referrals/client/Client.js +59 -33
- package/api/resources/referrals/client/requests/AcceptReferralBody.d.ts +6 -1
- package/api/resources/referrals/client/requests/AmendReferralReq.d.ts +5 -1
- package/api/resources/referrals/client/requests/BackToDraftReferralBody.d.ts +14 -0
- package/api/resources/referrals/client/requests/CancelReferralReq.d.ts +6 -1
- package/api/resources/referrals/client/requests/ReferralsDeleteRequest.d.ts +21 -0
- package/api/resources/referrals/client/requests/ReferralsGetRequest.d.ts +13 -3
- package/api/resources/referrals/client/requests/RejectReferralBody.d.ts +5 -1
- package/api/resources/referrals/client/requests/index.d.ts +2 -0
- package/api/resources/referrers/client/Client.d.ts +44 -0
- package/api/resources/referrers/client/Client.js +128 -0
- package/api/resources/referrers/client/index.d.ts +1 -0
- package/api/resources/referrers/client/index.js +17 -0
- package/api/resources/referrers/client/requests/ApiHoldingControllerGetReferrersRequest.d.ts +17 -0
- package/api/resources/referrers/client/requests/ApiHoldingControllerGetReferrersRequest.js +5 -0
- package/api/resources/referrers/client/requests/index.d.ts +1 -0
- package/api/resources/referrers/client/requests/index.js +2 -0
- package/api/resources/referrers/index.d.ts +1 -0
- package/api/resources/referrers/index.js +17 -0
- package/api/resources/webhooks/client/Client.js +2 -2
- package/api/types/EligibilityReasonDto.d.ts +9 -0
- package/api/types/EligibilityReasonDto.js +5 -0
- package/api/types/FullReferralDto.d.ts +3 -1
- package/api/types/FullReferralDtoClinicType.d.ts +2 -1
- package/api/types/FullReferralDtoClinicType.js +1 -0
- package/api/types/GetReferrersRes.d.ts +7 -0
- package/api/types/GetReferrersRes.js +5 -0
- package/api/types/InstitutionIdType.d.ts +3 -0
- package/api/types/OfferingDto.d.ts +2 -0
- package/api/types/OfferingWithAllowedDto.d.ts +3 -1
- package/api/types/PublicReferralDtoClinicType.d.ts +2 -1
- package/api/types/PublicReferralDtoClinicType.js +1 -0
- package/api/types/{ReferralLinkDto.d.ts → ReferralActionLinkDto.d.ts} +2 -2
- package/api/types/ReferralActionLinkDto.js +5 -0
- package/{dist/api/types/ReferralLinkType.d.ts → api/types/ReferralActionLinkType.d.ts} +2 -3
- package/{dist/api/types/ReferralLinkType.js → api/types/ReferralActionLinkType.js} +2 -3
- package/api/types/ReferralDto.d.ts +2 -0
- package/api/types/ReferralDtoClinicType.d.ts +2 -1
- package/api/types/ReferralDtoClinicType.js +1 -0
- package/{dist/api/types/ReferralLinkDto.d.ts → api/types/ReferralUpsertLinkDto.d.ts} +2 -2
- package/api/types/ReferralUpsertLinkDto.js +5 -0
- package/api/types/ReferralUpsertLinkType.d.ts +7 -0
- package/api/types/ReferralUpsertLinkType.js +5 -0
- package/api/types/ReferrerStatusDto.d.ts +15 -0
- package/api/types/ReferrerStatusDto.js +5 -0
- package/api/types/index.d.ts +7 -2
- package/api/types/index.js +7 -2
- package/dist/Client.d.ts +3 -0
- package/dist/Client.js +15 -10
- package/dist/api/resources/eligibility/client/Client.js +1 -1
- package/dist/api/resources/health/client/Client.js +1 -1
- package/dist/api/resources/index.d.ts +2 -0
- package/dist/api/resources/index.js +3 -1
- package/dist/api/resources/links/client/Client.d.ts +2 -1
- package/dist/api/resources/links/client/Client.js +2 -1
- package/dist/api/resources/links/client/requests/CreateLinkReqUpsert.d.ts +2 -1
- package/dist/api/resources/links/types/CreateLinkReqUpsertClinicType.d.ts +2 -1
- package/dist/api/resources/links/types/CreateLinkReqUpsertClinicType.js +1 -0
- package/dist/api/resources/notes/client/Client.d.ts +3 -1
- package/dist/api/resources/notes/client/Client.js +5 -3
- package/dist/api/resources/notes/client/requests/CreateNoteReq.d.ts +5 -1
- package/dist/api/resources/offerings/client/Client.js +3 -3
- package/dist/api/resources/public/client/Client.d.ts +4 -2
- package/dist/api/resources/public/client/Client.js +10 -8
- package/dist/api/resources/public/client/requests/PublicGetReferralRequest.d.ts +13 -3
- package/dist/api/resources/referrals/client/Client.d.ts +32 -12
- package/dist/api/resources/referrals/client/Client.js +59 -33
- package/dist/api/resources/referrals/client/requests/AcceptReferralBody.d.ts +6 -1
- package/dist/api/resources/referrals/client/requests/AmendReferralReq.d.ts +5 -1
- package/dist/api/resources/referrals/client/requests/BackToDraftReferralBody.d.ts +14 -0
- package/dist/api/resources/referrals/client/requests/BackToDraftReferralBody.js +5 -0
- package/dist/api/resources/referrals/client/requests/CancelReferralReq.d.ts +6 -1
- package/dist/api/resources/referrals/client/requests/ReferralsDeleteRequest.d.ts +21 -0
- package/dist/api/resources/referrals/client/requests/ReferralsDeleteRequest.js +5 -0
- package/dist/api/resources/referrals/client/requests/ReferralsGetRequest.d.ts +13 -3
- package/dist/api/resources/referrals/client/requests/RejectReferralBody.d.ts +5 -1
- package/dist/api/resources/referrals/client/requests/index.d.ts +2 -0
- package/dist/api/resources/referrers/client/Client.d.ts +44 -0
- package/dist/api/resources/referrers/client/Client.js +128 -0
- package/dist/api/resources/referrers/client/index.d.ts +1 -0
- package/dist/api/resources/referrers/client/index.js +17 -0
- package/dist/api/resources/referrers/client/requests/ApiHoldingControllerGetReferrersRequest.d.ts +17 -0
- package/dist/api/resources/referrers/client/requests/ApiHoldingControllerGetReferrersRequest.js +5 -0
- package/dist/api/resources/referrers/client/requests/index.d.ts +1 -0
- package/dist/api/resources/referrers/client/requests/index.js +2 -0
- package/dist/api/resources/referrers/index.d.ts +1 -0
- package/dist/api/resources/referrers/index.js +17 -0
- package/dist/api/resources/webhooks/client/Client.js +2 -2
- package/dist/api/types/EligibilityReasonDto.d.ts +9 -0
- package/dist/api/types/EligibilityReasonDto.js +5 -0
- package/dist/api/types/FullReferralDto.d.ts +3 -1
- package/dist/api/types/FullReferralDtoClinicType.d.ts +2 -1
- package/dist/api/types/FullReferralDtoClinicType.js +1 -0
- package/dist/api/types/GetReferrersRes.d.ts +7 -0
- package/dist/api/types/GetReferrersRes.js +5 -0
- package/dist/api/types/InstitutionIdType.d.ts +3 -0
- package/dist/api/types/OfferingDto.d.ts +2 -0
- package/dist/api/types/OfferingWithAllowedDto.d.ts +3 -1
- package/dist/api/types/PublicReferralDtoClinicType.d.ts +2 -1
- package/dist/api/types/PublicReferralDtoClinicType.js +1 -0
- package/dist/api/types/ReferralActionLinkDto.d.ts +11 -0
- package/dist/api/types/ReferralActionLinkDto.js +5 -0
- package/{api/types/ReferralLinkType.d.ts → dist/api/types/ReferralActionLinkType.d.ts} +2 -3
- package/{api/types/ReferralLinkType.js → dist/api/types/ReferralActionLinkType.js} +2 -3
- package/dist/api/types/ReferralDto.d.ts +2 -0
- package/dist/api/types/ReferralDtoClinicType.d.ts +2 -1
- package/dist/api/types/ReferralDtoClinicType.js +1 -0
- package/dist/api/types/ReferralUpsertLinkDto.d.ts +11 -0
- package/dist/api/types/ReferralUpsertLinkDto.js +5 -0
- package/dist/api/types/ReferralUpsertLinkType.d.ts +7 -0
- package/dist/api/types/ReferralUpsertLinkType.js +5 -0
- package/dist/api/types/ReferrerStatusDto.d.ts +15 -0
- package/dist/api/types/ReferrerStatusDto.js +5 -0
- package/dist/api/types/index.d.ts +7 -2
- package/dist/api/types/index.js +7 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/reference.md +98 -7
- package/version.d.ts +1 -1
- package/version.js +1 -1
- /package/api/{types/ReferralLinkDto.js → resources/referrals/client/requests/BackToDraftReferralBody.js} +0 -0
- /package/{dist/api/types/ReferralLinkDto.js → api/resources/referrals/client/requests/ReferralsDeleteRequest.js} +0 -0
|
@@ -107,7 +107,7 @@ class Referrals {
|
|
|
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.
|
|
110
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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.
|
|
186
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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,
|
|
@@ -267,7 +267,7 @@ class Referrals {
|
|
|
267
267
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
268
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
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.
|
|
270
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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
271
|
contentType: "application/json",
|
|
272
272
|
queryParameters: _queryParams,
|
|
273
273
|
requestType: "json",
|
|
@@ -314,13 +314,15 @@ class Referrals {
|
|
|
314
314
|
*
|
|
315
315
|
* @example
|
|
316
316
|
* await client.referrals.get("referralId", {
|
|
317
|
-
* requesterIdentifier: "requester@example.com"
|
|
317
|
+
* requesterIdentifier: "requester@example.com",
|
|
318
|
+
* institutionIdType: "hci",
|
|
319
|
+
* institutionId: "institutionId"
|
|
318
320
|
* })
|
|
319
321
|
*/
|
|
320
|
-
get(
|
|
321
|
-
return __awaiter(this,
|
|
322
|
+
get(referralId, request, requestOptions) {
|
|
323
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
322
324
|
var _a, _b, _c;
|
|
323
|
-
const { additionalField, requesterIdentifier } = request;
|
|
325
|
+
const { additionalField, requesterIdentifier, institutionIdType, institutionId } = request;
|
|
324
326
|
const _queryParams = {};
|
|
325
327
|
if (additionalField != null) {
|
|
326
328
|
if (Array.isArray(additionalField)) {
|
|
@@ -330,13 +332,13 @@ class Referrals {
|
|
|
330
332
|
_queryParams["additionalField"] = additionalField;
|
|
331
333
|
}
|
|
332
334
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
335
|
+
_queryParams["requesterIdentifier"] = requesterIdentifier;
|
|
336
|
+
_queryParams["institutionIdType"] = institutionIdType;
|
|
337
|
+
_queryParams["institutionId"] = institutionId;
|
|
336
338
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
337
339
|
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)}`),
|
|
338
340
|
method: "GET",
|
|
339
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
341
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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),
|
|
340
342
|
contentType: "application/json",
|
|
341
343
|
queryParameters: _queryParams,
|
|
342
344
|
requestType: "json",
|
|
@@ -377,21 +379,30 @@ class Referrals {
|
|
|
377
379
|
}
|
|
378
380
|
/**
|
|
379
381
|
* @param {string} referralId - Referral ID
|
|
382
|
+
* @param {ReferralExchange.ReferralsDeleteRequest} request
|
|
380
383
|
* @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
|
|
381
384
|
*
|
|
382
385
|
* @throws {@link ReferralExchange.UnauthorizedError}
|
|
383
386
|
*
|
|
384
387
|
* @example
|
|
385
|
-
* await client.referrals.delete("referralId"
|
|
388
|
+
* await client.referrals.delete("referralId", {
|
|
389
|
+
* institutionIdType: "hci",
|
|
390
|
+
* institutionId: "institutionId"
|
|
391
|
+
* })
|
|
386
392
|
*/
|
|
387
|
-
delete(referralId, requestOptions) {
|
|
393
|
+
delete(referralId, request, requestOptions) {
|
|
388
394
|
return __awaiter(this, void 0, void 0, function* () {
|
|
389
395
|
var _a, _b, _c;
|
|
396
|
+
const { institutionIdType, institutionId } = request;
|
|
397
|
+
const _queryParams = {};
|
|
398
|
+
_queryParams["institutionIdType"] = institutionIdType;
|
|
399
|
+
_queryParams["institutionId"] = institutionId;
|
|
390
400
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
391
401
|
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)}`),
|
|
392
402
|
method: "DELETE",
|
|
393
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
403
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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),
|
|
394
404
|
contentType: "application/json",
|
|
405
|
+
queryParameters: _queryParams,
|
|
395
406
|
requestType: "json",
|
|
396
407
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
397
408
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
@@ -434,18 +445,21 @@ class Referrals {
|
|
|
434
445
|
* @throws {@link ReferralExchange.UnauthorizedError}
|
|
435
446
|
*
|
|
436
447
|
* @example
|
|
437
|
-
* await client.referrals.cancel("referralId"
|
|
448
|
+
* await client.referrals.cancel("referralId", {
|
|
449
|
+
* institutionIdType: "hci",
|
|
450
|
+
* institutionId: "institutionId"
|
|
451
|
+
* })
|
|
438
452
|
*/
|
|
439
|
-
cancel(
|
|
440
|
-
return __awaiter(this,
|
|
453
|
+
cancel(referralId, request, requestOptions) {
|
|
454
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
441
455
|
var _a, _b, _c;
|
|
442
456
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
443
457
|
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`),
|
|
444
458
|
method: "POST",
|
|
445
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
459
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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),
|
|
446
460
|
contentType: "application/json",
|
|
447
461
|
requestType: "json",
|
|
448
|
-
body: request,
|
|
462
|
+
body: Object.assign(Object.assign({}, request), { institutionIdType: "hci" }),
|
|
449
463
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
450
464
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
451
465
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -488,7 +502,9 @@ class Referrals {
|
|
|
488
502
|
*
|
|
489
503
|
* @example
|
|
490
504
|
* await client.referrals.amend("referralId", {
|
|
491
|
-
* timeslotStartAt: 1714857600000
|
|
505
|
+
* timeslotStartAt: 1714857600000,
|
|
506
|
+
* institutionIdType: "hci",
|
|
507
|
+
* institutionId: "institutionId"
|
|
492
508
|
* })
|
|
493
509
|
*/
|
|
494
510
|
amend(referralId, request, requestOptions) {
|
|
@@ -497,10 +513,10 @@ class Referrals {
|
|
|
497
513
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
498
514
|
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`),
|
|
499
515
|
method: "POST",
|
|
500
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
516
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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),
|
|
501
517
|
contentType: "application/json",
|
|
502
518
|
requestType: "json",
|
|
503
|
-
body: request,
|
|
519
|
+
body: Object.assign(Object.assign({}, request), { institutionIdType: "hci" }),
|
|
504
520
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
505
521
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
506
522
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -543,18 +559,21 @@ class Referrals {
|
|
|
543
559
|
* @throws {@link ReferralExchange.UnauthorizedError}
|
|
544
560
|
*
|
|
545
561
|
* @example
|
|
546
|
-
* await client.referrals.accept("referralId"
|
|
562
|
+
* await client.referrals.accept("referralId", {
|
|
563
|
+
* institutionIdType: "hci",
|
|
564
|
+
* institutionId: "institutionId"
|
|
565
|
+
* })
|
|
547
566
|
*/
|
|
548
|
-
accept(
|
|
549
|
-
return __awaiter(this,
|
|
567
|
+
accept(referralId, request, requestOptions) {
|
|
568
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
550
569
|
var _a, _b, _c;
|
|
551
570
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
552
571
|
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`),
|
|
553
572
|
method: "POST",
|
|
554
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
573
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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),
|
|
555
574
|
contentType: "application/json",
|
|
556
575
|
requestType: "json",
|
|
557
|
-
body: request,
|
|
576
|
+
body: Object.assign(Object.assign({}, request), { institutionIdType: "hci" }),
|
|
558
577
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
559
578
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
560
579
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -599,7 +618,9 @@ class Referrals {
|
|
|
599
618
|
*
|
|
600
619
|
* @example
|
|
601
620
|
* await client.referrals.reject("referralId", {
|
|
602
|
-
* rejectionMessage: "rejectionMessage"
|
|
621
|
+
* rejectionMessage: "rejectionMessage",
|
|
622
|
+
* institutionIdType: "hci",
|
|
623
|
+
* institutionId: "institutionId"
|
|
603
624
|
* })
|
|
604
625
|
*/
|
|
605
626
|
reject(referralId, request, requestOptions) {
|
|
@@ -608,10 +629,10 @@ class Referrals {
|
|
|
608
629
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
609
630
|
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`),
|
|
610
631
|
method: "POST",
|
|
611
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
632
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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),
|
|
612
633
|
contentType: "application/json",
|
|
613
634
|
requestType: "json",
|
|
614
|
-
body: request,
|
|
635
|
+
body: Object.assign(Object.assign({}, request), { institutionIdType: "hci" }),
|
|
615
636
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
616
637
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
617
638
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -647,22 +668,27 @@ class Referrals {
|
|
|
647
668
|
}
|
|
648
669
|
/**
|
|
649
670
|
* @param {string} referralId - Referral ID
|
|
671
|
+
* @param {ReferralExchange.BackToDraftReferralBody} request
|
|
650
672
|
* @param {Referrals.RequestOptions} requestOptions - Request-specific configuration.
|
|
651
673
|
*
|
|
652
674
|
* @throws {@link ReferralExchange.UnauthorizedError}
|
|
653
675
|
*
|
|
654
676
|
* @example
|
|
655
|
-
* await client.referrals.backToDraft("referralId"
|
|
677
|
+
* await client.referrals.backToDraft("referralId", {
|
|
678
|
+
* institutionIdType: "hci",
|
|
679
|
+
* institutionId: "institutionId"
|
|
680
|
+
* })
|
|
656
681
|
*/
|
|
657
|
-
backToDraft(referralId, requestOptions) {
|
|
682
|
+
backToDraft(referralId, request, requestOptions) {
|
|
658
683
|
return __awaiter(this, void 0, void 0, function* () {
|
|
659
684
|
var _a, _b, _c;
|
|
660
685
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
661
686
|
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`),
|
|
662
687
|
method: "POST",
|
|
663
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
688
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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),
|
|
664
689
|
contentType: "application/json",
|
|
665
690
|
requestType: "json",
|
|
691
|
+
body: Object.assign(Object.assign({}, request), { institutionIdType: "hci" }),
|
|
666
692
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
667
693
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
668
694
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
|
-
* {
|
|
6
|
+
* {
|
|
7
|
+
* institutionIdType: "hci",
|
|
8
|
+
* institutionId: "institutionId"
|
|
9
|
+
* }
|
|
7
10
|
*/
|
|
8
11
|
export interface AcceptReferralBody {
|
|
9
12
|
/** Appointment time, in milliseconds since epoch. */
|
|
10
13
|
appointmentTime?: number;
|
|
11
14
|
/** Note content */
|
|
12
15
|
noteContent?: string;
|
|
16
|
+
/** The institution ID */
|
|
17
|
+
institutionId: string;
|
|
13
18
|
}
|
|
@@ -4,10 +4,14 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* timeslotStartAt: 1714857600000
|
|
7
|
+
* timeslotStartAt: 1714857600000,
|
|
8
|
+
* institutionIdType: "hci",
|
|
9
|
+
* institutionId: "institutionId"
|
|
8
10
|
* }
|
|
9
11
|
*/
|
|
10
12
|
export interface AmendReferralReq {
|
|
11
13
|
/** New timeslot start time, in milliseconds since epoch. */
|
|
12
14
|
timeslotStartAt: number;
|
|
15
|
+
/** The institution ID */
|
|
16
|
+
institutionId: string;
|
|
13
17
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* institutionIdType: "hci",
|
|
8
|
+
* institutionId: "institutionId"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface BackToDraftReferralBody {
|
|
12
|
+
/** The institution ID */
|
|
13
|
+
institutionId: string;
|
|
14
|
+
}
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
|
-
* {
|
|
6
|
+
* {
|
|
7
|
+
* institutionIdType: "hci",
|
|
8
|
+
* institutionId: "institutionId"
|
|
9
|
+
* }
|
|
7
10
|
*/
|
|
8
11
|
export interface CancelReferralReq {
|
|
9
12
|
/** UIN of the person cancelling the referral, if available */
|
|
@@ -12,4 +15,6 @@ export interface CancelReferralReq {
|
|
|
12
15
|
cancelledByName?: string;
|
|
13
16
|
/** Optional note to save when cancelling the referral */
|
|
14
17
|
cancelNote?: string;
|
|
18
|
+
/** The institution ID */
|
|
19
|
+
institutionId: string;
|
|
15
20
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
* institutionIdType: "hci",
|
|
9
|
+
* institutionId: "institutionId"
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export interface ReferralsDeleteRequest {
|
|
13
|
+
/**
|
|
14
|
+
* The type of institution ID
|
|
15
|
+
*/
|
|
16
|
+
institutionIdType: ReferralExchange.InstitutionIdType;
|
|
17
|
+
/**
|
|
18
|
+
* The institution ID
|
|
19
|
+
*/
|
|
20
|
+
institutionId: string;
|
|
21
|
+
}
|
|
@@ -5,13 +5,23 @@ import * as ReferralExchange from "../../../../index";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* requesterIdentifier: "requester@example.com"
|
|
8
|
+
* requesterIdentifier: "requester@example.com",
|
|
9
|
+
* institutionIdType: "hci",
|
|
10
|
+
* institutionId: "institutionId"
|
|
9
11
|
* }
|
|
10
12
|
*/
|
|
11
13
|
export interface ReferralsGetRequest {
|
|
12
14
|
additionalField?: ReferralExchange.AdditionalReferralField | ReferralExchange.AdditionalReferralField[];
|
|
13
15
|
/**
|
|
14
|
-
* Identifier for the individual requesting
|
|
16
|
+
* Identifier for the individual requesting the referral. Preferred to be an email.
|
|
15
17
|
*/
|
|
16
|
-
requesterIdentifier
|
|
18
|
+
requesterIdentifier: string;
|
|
19
|
+
/**
|
|
20
|
+
* The type of institution ID
|
|
21
|
+
*/
|
|
22
|
+
institutionIdType: ReferralExchange.InstitutionIdType;
|
|
23
|
+
/**
|
|
24
|
+
* The institution ID
|
|
25
|
+
*/
|
|
26
|
+
institutionId: string;
|
|
17
27
|
}
|
|
@@ -4,10 +4,14 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* rejectionMessage: "rejectionMessage"
|
|
7
|
+
* rejectionMessage: "rejectionMessage",
|
|
8
|
+
* institutionIdType: "hci",
|
|
9
|
+
* institutionId: "institutionId"
|
|
8
10
|
* }
|
|
9
11
|
*/
|
|
10
12
|
export interface RejectReferralBody {
|
|
11
13
|
/** Rejection message */
|
|
12
14
|
rejectionMessage: string;
|
|
15
|
+
/** The institution ID */
|
|
16
|
+
institutionId: string;
|
|
13
17
|
}
|
|
@@ -2,7 +2,9 @@ export { type ReferralsListRequest } from "./ReferralsListRequest";
|
|
|
2
2
|
export { type CreateReferralReq } from "./CreateReferralReq";
|
|
3
3
|
export { type ReferralsListByInstitutionRequest } from "./ReferralsListByInstitutionRequest";
|
|
4
4
|
export { type ReferralsGetRequest } from "./ReferralsGetRequest";
|
|
5
|
+
export { type ReferralsDeleteRequest } from "./ReferralsDeleteRequest";
|
|
5
6
|
export { type CancelReferralReq } from "./CancelReferralReq";
|
|
6
7
|
export { type AmendReferralReq } from "./AmendReferralReq";
|
|
7
8
|
export { type AcceptReferralBody } from "./AcceptReferralBody";
|
|
8
9
|
export { type RejectReferralBody } from "./RejectReferralBody";
|
|
10
|
+
export { type BackToDraftReferralBody } from "./BackToDraftReferralBody";
|
|
@@ -0,0 +1,44 @@
|
|
|
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 Referrers {
|
|
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 Referrers {
|
|
27
|
+
protected readonly _options: Referrers.Options;
|
|
28
|
+
constructor(_options?: Referrers.Options);
|
|
29
|
+
/**
|
|
30
|
+
* @param {ReferralExchange.ApiHoldingControllerGetReferrersRequest} request
|
|
31
|
+
* @param {Referrers.RequestOptions} requestOptions - Request-specific configuration.
|
|
32
|
+
*
|
|
33
|
+
* @throws {@link ReferralExchange.UnauthorizedError}
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* await client.referrers.apiHoldingControllerGetReferrers({
|
|
37
|
+
* idType: "mcr"
|
|
38
|
+
* })
|
|
39
|
+
*/
|
|
40
|
+
apiHoldingControllerGetReferrers(request: ReferralExchange.ApiHoldingControllerGetReferrersRequest, requestOptions?: Referrers.RequestOptions): Promise<ReferralExchange.GetReferrersRes>;
|
|
41
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
42
|
+
Authorization: string | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
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.Referrers = 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 Referrers {
|
|
58
|
+
constructor(_options = {}) {
|
|
59
|
+
this._options = _options;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @param {ReferralExchange.ApiHoldingControllerGetReferrersRequest} request
|
|
63
|
+
* @param {Referrers.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
|
+
*
|
|
65
|
+
* @throws {@link ReferralExchange.UnauthorizedError}
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* await client.referrers.apiHoldingControllerGetReferrers({
|
|
69
|
+
* idType: "mcr"
|
|
70
|
+
* })
|
|
71
|
+
*/
|
|
72
|
+
apiHoldingControllerGetReferrers(request, requestOptions) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
var _a, _b, _c;
|
|
75
|
+
const { idType, whitelisted } = request;
|
|
76
|
+
const _queryParams = {};
|
|
77
|
+
_queryParams["idType"] = idType;
|
|
78
|
+
if (whitelisted != null) {
|
|
79
|
+
_queryParams["whitelisted"] = whitelisted.toString();
|
|
80
|
+
}
|
|
81
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
82
|
+
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/referrers"),
|
|
83
|
+
method: "GET",
|
|
84
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.62", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.62", "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
|
+
contentType: "application/json",
|
|
86
|
+
queryParameters: _queryParams,
|
|
87
|
+
requestType: "json",
|
|
88
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
89
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
90
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
91
|
+
});
|
|
92
|
+
if (_response.ok) {
|
|
93
|
+
return _response.body;
|
|
94
|
+
}
|
|
95
|
+
if (_response.error.reason === "status-code") {
|
|
96
|
+
switch (_response.error.statusCode) {
|
|
97
|
+
case 401:
|
|
98
|
+
throw new ReferralExchange.UnauthorizedError(_response.error.body);
|
|
99
|
+
default:
|
|
100
|
+
throw new errors.ReferralExchangeError({
|
|
101
|
+
statusCode: _response.error.statusCode,
|
|
102
|
+
body: _response.error.body,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
switch (_response.error.reason) {
|
|
107
|
+
case "non-json":
|
|
108
|
+
throw new errors.ReferralExchangeError({
|
|
109
|
+
statusCode: _response.error.statusCode,
|
|
110
|
+
body: _response.error.rawBody,
|
|
111
|
+
});
|
|
112
|
+
case "timeout":
|
|
113
|
+
throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling GET /api/v1/referrers.");
|
|
114
|
+
case "unknown":
|
|
115
|
+
throw new errors.ReferralExchangeError({
|
|
116
|
+
message: _response.error.errorMessage,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
_getCustomAuthorizationHeaders() {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
124
|
+
return { Authorization: apiKeyValue };
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.Referrers = Referrers;
|
|
@@ -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,17 @@
|
|
|
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
|
+
* idType: "mcr"
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface ApiHoldingControllerGetReferrersRequest {
|
|
12
|
+
idType: ReferralExchange.ReferrerIdType;
|
|
13
|
+
/**
|
|
14
|
+
* Filter by whitelisting status. true = whitelisted only, false = unwhitelisted only, omit = all.
|
|
15
|
+
*/
|
|
16
|
+
whitelisted?: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type ApiHoldingControllerGetReferrersRequest } from "./ApiHoldingControllerGetReferrersRequest";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client";
|