@opengovsg/refx-ts-sdk 0.0.36 → 0.0.38
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 +11 -6
- package/api/resources/eligibility/client/Client.js +11 -2
- package/api/resources/eligibility/client/requests/EligibilityGetRequest.d.ts +10 -0
- 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 +48 -0
- package/api/resources/links/client/Client.js +126 -0
- package/api/resources/links/client/index.d.ts +1 -0
- package/api/resources/links/client/index.js +17 -0
- package/api/resources/links/client/requests/CreateLinkReqUpsert.d.ts +25 -0
- package/api/resources/links/client/requests/CreateLinkReqUpsert.js +5 -0
- package/api/resources/links/client/requests/index.d.ts +1 -0
- package/api/resources/links/client/requests/index.js +2 -0
- package/api/resources/links/index.d.ts +1 -0
- package/api/resources/links/index.js +17 -0
- package/api/resources/notes/client/Client.js +1 -1
- package/api/resources/offerings/client/Client.js +6 -3
- package/api/resources/offerings/client/requests/OfferingsListRequest.d.ts +4 -3
- package/api/resources/public/client/Client.js +2 -5
- package/api/resources/public/client/requests/PublicGetReferralRequest.d.ts +0 -1
- package/api/resources/referrals/client/Client.js +10 -13
- package/api/resources/referrals/client/requests/ReferralsGetRequest.d.ts +0 -1
- package/api/resources/webhooks/client/Client.js +2 -2
- package/api/types/EligibilityRes.d.ts +2 -1
- package/api/types/ReferralEligibility.d.ts +2 -1
- package/api/types/ReferrerIdType.d.ts +3 -0
- package/api/types/SubsidyEligibility.d.ts +4 -2
- package/api/types/SubsidyEligibilityScheme.d.ts +9 -0
- package/api/types/SubsidyEligibilityScheme.js +11 -0
- package/api/types/index.d.ts +2 -1
- package/api/types/index.js +2 -1
- package/dist/Client.d.ts +3 -0
- package/dist/Client.js +11 -6
- package/dist/api/resources/eligibility/client/Client.js +11 -2
- package/dist/api/resources/eligibility/client/requests/EligibilityGetRequest.d.ts +10 -0
- 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 +48 -0
- package/dist/api/resources/links/client/Client.js +126 -0
- package/dist/api/resources/links/client/index.d.ts +1 -0
- package/dist/api/resources/links/client/index.js +17 -0
- package/dist/api/resources/links/client/requests/CreateLinkReqUpsert.d.ts +25 -0
- package/dist/api/resources/links/client/requests/CreateLinkReqUpsert.js +5 -0
- package/dist/api/resources/links/client/requests/index.d.ts +1 -0
- package/dist/api/resources/links/client/requests/index.js +2 -0
- package/dist/api/resources/links/index.d.ts +1 -0
- package/dist/api/resources/links/index.js +17 -0
- package/dist/api/resources/notes/client/Client.js +1 -1
- package/dist/api/resources/offerings/client/Client.js +6 -3
- package/dist/api/resources/offerings/client/requests/OfferingsListRequest.d.ts +4 -3
- package/dist/api/resources/public/client/Client.js +2 -5
- package/dist/api/resources/public/client/requests/PublicGetReferralRequest.d.ts +0 -1
- package/dist/api/resources/referrals/client/Client.js +10 -13
- package/dist/api/resources/referrals/client/requests/ReferralsGetRequest.d.ts +0 -1
- package/dist/api/resources/webhooks/client/Client.js +2 -2
- package/dist/api/types/EligibilityRes.d.ts +2 -1
- package/dist/api/types/ReferralEligibility.d.ts +2 -1
- package/dist/api/types/ReferrerIdType.d.ts +3 -0
- package/dist/api/types/SubsidyEligibility.d.ts +4 -2
- package/dist/api/types/SubsidyEligibilityScheme.d.ts +9 -0
- package/dist/api/types/SubsidyEligibilityScheme.js +11 -0
- package/dist/api/types/index.d.ts +2 -1
- package/dist/api/types/index.js +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/reference.md +56 -0
- package/version.d.ts +1 -1
- 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/
|
|
12
|
-
const Client_6 = require("./api/resources/
|
|
13
|
-
const Client_7 = require("./api/resources/
|
|
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
|
|
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
|
|
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
|
|
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;
|
|
@@ -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.
|
|
92
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.38", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.38", "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.
|
|
72
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.38", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.38", "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,
|
package/api/resources/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * as eligibility from "./eligibility";
|
|
|
2
2
|
export * as referrals from "./referrals";
|
|
3
3
|
export * as notes from "./notes";
|
|
4
4
|
export * as offerings from "./offerings";
|
|
5
|
+
export * as links from "./links";
|
|
5
6
|
export * as public_ from "./public";
|
|
6
7
|
export * as webhooks from "./webhooks";
|
|
7
8
|
export * as health from "./health";
|
|
@@ -9,4 +10,5 @@ export * from "./eligibility/client/requests";
|
|
|
9
10
|
export * from "./referrals/client/requests";
|
|
10
11
|
export * from "./notes/client/requests";
|
|
11
12
|
export * from "./offerings/client/requests";
|
|
13
|
+
export * from "./links/client/requests";
|
|
12
14
|
export * from "./public/client/requests";
|
package/api/resources/index.js
CHANGED
|
@@ -36,11 +36,12 @@ 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.links = exports.offerings = exports.notes = exports.referrals = exports.eligibility = void 0;
|
|
40
40
|
exports.eligibility = __importStar(require("./eligibility"));
|
|
41
41
|
exports.referrals = __importStar(require("./referrals"));
|
|
42
42
|
exports.notes = __importStar(require("./notes"));
|
|
43
43
|
exports.offerings = __importStar(require("./offerings"));
|
|
44
|
+
exports.links = __importStar(require("./links"));
|
|
44
45
|
exports.public_ = __importStar(require("./public"));
|
|
45
46
|
exports.webhooks = __importStar(require("./webhooks"));
|
|
46
47
|
exports.health = __importStar(require("./health"));
|
|
@@ -48,4 +49,5 @@ __exportStar(require("./eligibility/client/requests"), exports);
|
|
|
48
49
|
__exportStar(require("./referrals/client/requests"), exports);
|
|
49
50
|
__exportStar(require("./notes/client/requests"), exports);
|
|
50
51
|
__exportStar(require("./offerings/client/requests"), exports);
|
|
52
|
+
__exportStar(require("./links/client/requests"), exports);
|
|
51
53
|
__exportStar(require("./public/client/requests"), exports);
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
* refererInstitutionId: "refererInstitutionId",
|
|
38
|
+
* refererInstitutionName: "refererInstitutionName",
|
|
39
|
+
* referrerId: "referrerId",
|
|
40
|
+
* referrerName: "referrerName",
|
|
41
|
+
* referrerIdType: "referrerIdType"
|
|
42
|
+
* })
|
|
43
|
+
*/
|
|
44
|
+
apiHoldingControllerCreateUpsertLink(request: ReferralExchange.CreateLinkReqUpsert, requestOptions?: Links.RequestOptions): Promise<void>;
|
|
45
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
46
|
+
Authorization: string | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
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
|
+
* refererInstitutionId: "refererInstitutionId",
|
|
70
|
+
* refererInstitutionName: "refererInstitutionName",
|
|
71
|
+
* referrerId: "referrerId",
|
|
72
|
+
* referrerName: "referrerName",
|
|
73
|
+
* referrerIdType: "referrerIdType"
|
|
74
|
+
* })
|
|
75
|
+
*/
|
|
76
|
+
apiHoldingControllerCreateUpsertLink(request, requestOptions) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
80
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, "api/v1/links/upsert"),
|
|
81
|
+
method: "POST",
|
|
82
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.38", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.38", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
83
|
+
contentType: "application/json",
|
|
84
|
+
requestType: "json",
|
|
85
|
+
body: request,
|
|
86
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
87
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
88
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
89
|
+
});
|
|
90
|
+
if (_response.ok) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (_response.error.reason === "status-code") {
|
|
94
|
+
switch (_response.error.statusCode) {
|
|
95
|
+
case 401:
|
|
96
|
+
throw new ReferralExchange.UnauthorizedError(_response.error.body);
|
|
97
|
+
default:
|
|
98
|
+
throw new errors.ReferralExchangeError({
|
|
99
|
+
statusCode: _response.error.statusCode,
|
|
100
|
+
body: _response.error.body,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
switch (_response.error.reason) {
|
|
105
|
+
case "non-json":
|
|
106
|
+
throw new errors.ReferralExchangeError({
|
|
107
|
+
statusCode: _response.error.statusCode,
|
|
108
|
+
body: _response.error.rawBody,
|
|
109
|
+
});
|
|
110
|
+
case "timeout":
|
|
111
|
+
throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/links/upsert.");
|
|
112
|
+
case "unknown":
|
|
113
|
+
throw new errors.ReferralExchangeError({
|
|
114
|
+
message: _response.error.errorMessage,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
_getCustomAuthorizationHeaders() {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
122
|
+
return { Authorization: apiKeyValue };
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* refererInstitutionId: "refererInstitutionId",
|
|
8
|
+
* refererInstitutionName: "refererInstitutionName",
|
|
9
|
+
* referrerId: "referrerId",
|
|
10
|
+
* referrerName: "referrerName",
|
|
11
|
+
* referrerIdType: "referrerIdType"
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
export interface CreateLinkReqUpsert {
|
|
15
|
+
/** HCI code of the institution authoring this referral. */
|
|
16
|
+
refererInstitutionId: string;
|
|
17
|
+
/** Name of the institution authoring this referral. */
|
|
18
|
+
refererInstitutionName: string;
|
|
19
|
+
/** MCR number of the doctor authoring this referral. */
|
|
20
|
+
referrerId: string;
|
|
21
|
+
/** Name of the doctor authoring this referral. */
|
|
22
|
+
referrerName: string;
|
|
23
|
+
/** Type of the referrer ID */
|
|
24
|
+
referrerIdType: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type CreateLinkReqUpsert } from "./CreateLinkReqUpsert";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client";
|
|
@@ -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("./client"), 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.
|
|
79
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.38", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.38", "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,
|
|
@@ -70,7 +70,7 @@ class Offerings {
|
|
|
70
70
|
list() {
|
|
71
71
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
72
72
|
var _a, _b, _c;
|
|
73
|
-
const { referrerId, referrerIdType } = request;
|
|
73
|
+
const { referrerId, referrerIdType, referrerInstitutionId } = request;
|
|
74
74
|
const _queryParams = {};
|
|
75
75
|
if (referrerId != null) {
|
|
76
76
|
_queryParams["referrerId"] = referrerId;
|
|
@@ -78,10 +78,13 @@ class Offerings {
|
|
|
78
78
|
if (referrerIdType != null) {
|
|
79
79
|
_queryParams["referrerIdType"] = referrerIdType;
|
|
80
80
|
}
|
|
81
|
+
if (referrerInstitutionId != null) {
|
|
82
|
+
_queryParams["referrerInstitutionId"] = referrerInstitutionId;
|
|
83
|
+
}
|
|
81
84
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
82
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"),
|
|
83
86
|
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.
|
|
87
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.38", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.38", "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
88
|
contentType: "application/json",
|
|
86
89
|
queryParameters: _queryParams,
|
|
87
90
|
requestType: "json",
|
|
@@ -141,7 +144,7 @@ class Offerings {
|
|
|
141
144
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
142
145
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.ReferralExchangeEnvironment.SmartCms, `api/v1/offerings/${encodeURIComponent(offeringId)}/timeslots`),
|
|
143
146
|
method: "GET",
|
|
144
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
147
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.38", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.38", "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),
|
|
145
148
|
contentType: "application/json",
|
|
146
149
|
queryParameters: _queryParams,
|
|
147
150
|
requestType: "json",
|
|
@@ -8,11 +8,12 @@ import * as ReferralExchange from "../../../../index";
|
|
|
8
8
|
*/
|
|
9
9
|
export interface OfferingsListRequest {
|
|
10
10
|
/**
|
|
11
|
-
* Use together with `referralIdType` 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
|
+
referrerIdType?: ReferralExchange.ReferrerIdType;
|
|
14
15
|
/**
|
|
15
|
-
* Use together with `referrerId` to
|
|
16
|
+
* ID of the referring institution. Use together with `referrerId` and `referrerIdType` to filter based on referrer.
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
referrerInstitutionId?: string;
|
|
18
19
|
}
|
|
@@ -71,11 +71,8 @@ class Public {
|
|
|
71
71
|
getReferral(referralId_1) {
|
|
72
72
|
return __awaiter(this, arguments, void 0, function* (referralId, request = {}, requestOptions) {
|
|
73
73
|
var _a, _b, _c;
|
|
74
|
-
const {
|
|
74
|
+
const { additionalField } = request;
|
|
75
75
|
const _queryParams = {};
|
|
76
|
-
if (includeAttachments != null) {
|
|
77
|
-
_queryParams["includeAttachments"] = includeAttachments.toString();
|
|
78
|
-
}
|
|
79
76
|
if (additionalField != null) {
|
|
80
77
|
if (Array.isArray(additionalField)) {
|
|
81
78
|
_queryParams["additionalField"] = additionalField.map((item) => item);
|
|
@@ -87,7 +84,7 @@ class Public {
|
|
|
87
84
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
88
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)}`),
|
|
89
86
|
method: "GET",
|
|
90
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
87
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.38", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.38", "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),
|
|
91
88
|
contentType: "application/json",
|
|
92
89
|
queryParameters: _queryParams,
|
|
93
90
|
requestType: "json",
|