@opengovsg/refx-ts-sdk 0.0.7 → 0.0.8
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 -25
- package/Client.js +14 -145
- package/README.md +33 -8
- package/api/index.d.ts +0 -1
- package/api/index.js +0 -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 +2 -0
- package/api/resources/index.js +3 -1
- package/api/resources/notes/client/Client.d.ts +41 -0
- package/api/resources/notes/client/Client.js +105 -0
- package/api/resources/notes/index.d.ts +1 -0
- package/api/resources/notes/index.js +17 -0
- package/api/resources/offerings/client/Client.d.ts +5 -3
- package/api/resources/offerings/client/Client.js +14 -14
- package/api/resources/offerings/client/requests/OfferingsListTimeslotsRequest.d.ts +3 -2
- package/api/resources/public/client/Client.d.ts +5 -4
- package/api/resources/public/client/Client.js +6 -5
- package/api/resources/referrals/client/Client.d.ts +27 -18
- package/api/resources/referrals/client/Client.js +93 -48
- package/api/resources/referrals/client/requests/CreateReferralReq.d.ts +13 -13
- package/api/resources/referrals/client/requests/ReferralsListRequest.d.ts +8 -8
- package/api/resources/webhooks/client/Client.d.ts +7 -6
- package/api/resources/webhooks/client/Client.js +12 -11
- package/api/types/CreatePatientReq.d.ts +1 -1
- package/api/types/CreatedEventMetadata.d.ts +1 -1
- package/api/types/FormResponse.d.ts +3 -0
- package/api/types/FullReferralDto.d.ts +2 -2
- package/api/types/GetReferralPatientDto.d.ts +1 -1
- package/api/types/OfferingCoreDto.d.ts +1 -1
- package/api/types/OfferingFullDto.d.ts +4 -1
- package/api/types/PaginatedQuery.d.ts +2 -2
- package/api/types/PublicReferralDto.d.ts +2 -2
- package/api/types/ReferralDto.d.ts +2 -2
- package/api/types/ReferralEligibility.d.ts +1 -1
- package/api/types/ReferringDoctorDto.d.ts +9 -0
- package/api/types/RescheduleEventMetadata.d.ts +2 -2
- package/api/types/SubsidyEligibility.d.ts +1 -1
- package/api/types/index.d.ts +1 -3
- package/api/types/index.js +1 -3
- package/dist/Client.d.ts +6 -25
- package/dist/Client.js +14 -145
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -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 +2 -0
- package/dist/api/resources/index.js +3 -1
- 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/index.d.ts +1 -0
- package/dist/api/resources/notes/index.js +17 -0
- package/dist/api/resources/offerings/client/Client.d.ts +5 -3
- package/dist/api/resources/offerings/client/Client.js +14 -14
- package/dist/api/resources/offerings/client/requests/OfferingsListTimeslotsRequest.d.ts +3 -2
- package/dist/api/resources/public/client/Client.d.ts +5 -4
- package/dist/api/resources/public/client/Client.js +6 -5
- package/dist/api/resources/referrals/client/Client.d.ts +27 -18
- package/dist/api/resources/referrals/client/Client.js +93 -48
- package/dist/api/resources/referrals/client/requests/CreateReferralReq.d.ts +13 -13
- package/dist/api/resources/referrals/client/requests/ReferralsListRequest.d.ts +8 -8
- 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/CreatePatientReq.d.ts +1 -1
- package/dist/api/types/CreatedEventMetadata.d.ts +1 -1
- package/dist/api/types/FormResponse.d.ts +3 -0
- package/dist/api/types/FullReferralDto.d.ts +2 -2
- package/dist/api/types/GetReferralPatientDto.d.ts +1 -1
- package/dist/api/types/OfferingCoreDto.d.ts +1 -1
- package/dist/api/types/OfferingFullDto.d.ts +4 -1
- package/dist/api/types/PaginatedQuery.d.ts +2 -2
- package/dist/api/types/PublicReferralDto.d.ts +2 -2
- package/dist/api/types/ReferralDto.d.ts +2 -2
- package/dist/api/types/ReferralEligibility.d.ts +1 -1
- package/dist/api/types/ReferringDoctorDto.d.ts +9 -0
- package/dist/api/types/RescheduleEventMetadata.d.ts +2 -2
- package/dist/api/types/SubsidyEligibility.d.ts +1 -1
- package/dist/api/types/index.d.ts +1 -3
- package/dist/api/types/index.js +1 -3
- 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 +133 -72
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/api/types/FullReferralDtoReferringDoctor.d.ts +0 -9
- package/api/types/PublicReferralDtoReferringDoctor.d.ts +0 -9
- package/api/types/ReferralDtoReferringDoctor.d.ts +0 -9
- package/api/types/ReferralDtoReferringDoctor.js +0 -5
- package/dist/api/types/FullReferralDtoReferringDoctor.d.ts +0 -9
- package/dist/api/types/FullReferralDtoReferringDoctor.js +0 -5
- package/dist/api/types/PublicReferralDtoReferringDoctor.d.ts +0 -9
- package/dist/api/types/PublicReferralDtoReferringDoctor.js +0 -5
- package/dist/api/types/ReferralDtoReferringDoctor.d.ts +0 -9
- package/dist/api/types/ReferralDtoReferringDoctor.js +0 -5
- /package/api/{client → resources/notes/client}/index.d.ts +0 -0
- /package/api/{client → resources/notes/client}/index.js +0 -0
- /package/api/{client → resources/notes/client}/requests/CreateNoteReq.d.ts +0 -0
- /package/api/{client → resources/notes/client}/requests/CreateNoteReq.js +0 -0
- /package/api/{client → resources/notes/client}/requests/index.d.ts +0 -0
- /package/api/{client → resources/notes/client}/requests/index.js +0 -0
- /package/api/types/{FullReferralDtoReferringDoctor.js → ReferringDoctorDto.js} +0 -0
- /package/dist/api/{client → resources/notes/client}/index.d.ts +0 -0
- /package/dist/api/{client → resources/notes/client}/index.js +0 -0
- /package/dist/api/{client → resources/notes/client}/requests/CreateNoteReq.d.ts +0 -0
- /package/dist/api/{client → resources/notes/client}/requests/CreateNoteReq.js +0 -0
- /package/dist/api/{client → resources/notes/client}/requests/index.d.ts +0 -0
- /package/dist/api/{client → resources/notes/client}/requests/index.js +0 -0
- /package/{api/types/PublicReferralDtoReferringDoctor.js → dist/api/types/ReferringDoctorDto.js} +0 -0
package/Client.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
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
|
-
import * as ReferralExchange from "./api/index";
|
|
6
6
|
import { Eligibility } from "./api/resources/eligibility/client/Client";
|
|
7
7
|
import { Referrals } from "./api/resources/referrals/client/Client";
|
|
8
|
+
import { Notes } from "./api/resources/notes/client/Client";
|
|
8
9
|
import { Offerings } from "./api/resources/offerings/client/Client";
|
|
9
10
|
import { Public } from "./api/resources/public/client/Client";
|
|
10
11
|
import { Webhooks } from "./api/resources/webhooks/client/Client";
|
|
11
12
|
import { Health } from "./api/resources/health/client/Client";
|
|
12
13
|
export declare namespace ReferralExchangeClient {
|
|
13
14
|
interface Options {
|
|
14
|
-
environment
|
|
15
|
+
environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
|
|
15
16
|
apiKey?: core.Supplier<string | undefined>;
|
|
16
17
|
fetcher?: core.FetchFunction;
|
|
17
18
|
}
|
|
@@ -30,37 +31,17 @@ export declare class ReferralExchangeClient {
|
|
|
30
31
|
protected readonly _options: ReferralExchangeClient.Options;
|
|
31
32
|
protected _eligibility: Eligibility | undefined;
|
|
32
33
|
protected _referrals: Referrals | undefined;
|
|
34
|
+
protected _notes: Notes | undefined;
|
|
33
35
|
protected _offerings: Offerings | undefined;
|
|
34
36
|
protected _public: Public | undefined;
|
|
35
37
|
protected _webhooks: Webhooks | undefined;
|
|
36
38
|
protected _health: Health | undefined;
|
|
37
|
-
constructor(_options
|
|
39
|
+
constructor(_options?: ReferralExchangeClient.Options);
|
|
38
40
|
get eligibility(): Eligibility;
|
|
39
41
|
get referrals(): Referrals;
|
|
42
|
+
get notes(): Notes;
|
|
40
43
|
get offerings(): Offerings;
|
|
41
44
|
get public(): Public;
|
|
42
45
|
get webhooks(): Webhooks;
|
|
43
46
|
get health(): Health;
|
|
44
|
-
/**
|
|
45
|
-
* @param {string} referralId
|
|
46
|
-
* @param {ReferralExchange.CreateNoteReq} request
|
|
47
|
-
* @param {ReferralExchangeClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* await client.apiHoldingControllerCreateNote("referralId", {
|
|
51
|
-
* authorHciCode: "authorHciCode"
|
|
52
|
-
* })
|
|
53
|
-
*/
|
|
54
|
-
apiHoldingControllerCreateNote(referralId: string, request: ReferralExchange.CreateNoteReq, requestOptions?: ReferralExchangeClient.RequestOptions): Promise<ReferralExchange.NoteDto>;
|
|
55
|
-
/**
|
|
56
|
-
* @param {string} referralId
|
|
57
|
-
* @param {ReferralExchangeClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* await client.apiHoldingControllerBackToDraftReferral("referralId")
|
|
61
|
-
*/
|
|
62
|
-
apiHoldingControllerBackToDraftReferral(referralId: string, requestOptions?: ReferralExchangeClient.RequestOptions): Promise<ReferralExchange.ReferralDto>;
|
|
63
|
-
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
64
|
-
Authorization: string | undefined;
|
|
65
|
-
}>;
|
|
66
47
|
}
|
package/Client.js
CHANGED
|
@@ -2,54 +2,17 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file was auto-generated by Fern from our API Definition.
|
|
4
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 (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
-
};
|
|
40
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
6
|
exports.ReferralExchangeClient = void 0;
|
|
42
|
-
const core = __importStar(require("./core"));
|
|
43
|
-
const url_join_1 = __importDefault(require("url-join"));
|
|
44
|
-
const errors = __importStar(require("./errors/index"));
|
|
45
7
|
const Client_1 = require("./api/resources/eligibility/client/Client");
|
|
46
8
|
const Client_2 = require("./api/resources/referrals/client/Client");
|
|
47
|
-
const Client_3 = require("./api/resources/
|
|
48
|
-
const Client_4 = require("./api/resources/
|
|
49
|
-
const Client_5 = require("./api/resources/
|
|
50
|
-
const Client_6 = require("./api/resources/
|
|
9
|
+
const Client_3 = require("./api/resources/notes/client/Client");
|
|
10
|
+
const Client_4 = require("./api/resources/offerings/client/Client");
|
|
11
|
+
const Client_5 = require("./api/resources/public/client/Client");
|
|
12
|
+
const Client_6 = require("./api/resources/webhooks/client/Client");
|
|
13
|
+
const Client_7 = require("./api/resources/health/client/Client");
|
|
51
14
|
class ReferralExchangeClient {
|
|
52
|
-
constructor(_options) {
|
|
15
|
+
constructor(_options = {}) {
|
|
53
16
|
this._options = _options;
|
|
54
17
|
}
|
|
55
18
|
get eligibility() {
|
|
@@ -60,119 +23,25 @@ class ReferralExchangeClient {
|
|
|
60
23
|
var _a;
|
|
61
24
|
return ((_a = this._referrals) !== null && _a !== void 0 ? _a : (this._referrals = new Client_2.Referrals(this._options)));
|
|
62
25
|
}
|
|
26
|
+
get notes() {
|
|
27
|
+
var _a;
|
|
28
|
+
return ((_a = this._notes) !== null && _a !== void 0 ? _a : (this._notes = new Client_3.Notes(this._options)));
|
|
29
|
+
}
|
|
63
30
|
get offerings() {
|
|
64
31
|
var _a;
|
|
65
|
-
return ((_a = this._offerings) !== null && _a !== void 0 ? _a : (this._offerings = new
|
|
32
|
+
return ((_a = this._offerings) !== null && _a !== void 0 ? _a : (this._offerings = new Client_4.Offerings(this._options)));
|
|
66
33
|
}
|
|
67
34
|
get public() {
|
|
68
35
|
var _a;
|
|
69
|
-
return ((_a = this._public) !== null && _a !== void 0 ? _a : (this._public = new
|
|
36
|
+
return ((_a = this._public) !== null && _a !== void 0 ? _a : (this._public = new Client_5.Public(this._options)));
|
|
70
37
|
}
|
|
71
38
|
get webhooks() {
|
|
72
39
|
var _a;
|
|
73
|
-
return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new
|
|
40
|
+
return ((_a = this._webhooks) !== null && _a !== void 0 ? _a : (this._webhooks = new Client_6.Webhooks(this._options)));
|
|
74
41
|
}
|
|
75
42
|
get health() {
|
|
76
43
|
var _a;
|
|
77
|
-
return ((_a = this._health) !== null && _a !== void 0 ? _a : (this._health = new
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @param {string} referralId
|
|
81
|
-
* @param {ReferralExchange.CreateNoteReq} request
|
|
82
|
-
* @param {ReferralExchangeClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* await client.apiHoldingControllerCreateNote("referralId", {
|
|
86
|
-
* authorHciCode: "authorHciCode"
|
|
87
|
-
* })
|
|
88
|
-
*/
|
|
89
|
-
apiHoldingControllerCreateNote(referralId, request, requestOptions) {
|
|
90
|
-
var _a;
|
|
91
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
93
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `api/v1/referrals/${encodeURIComponent(referralId)}/notes`),
|
|
94
|
-
method: "POST",
|
|
95
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.7", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.7", "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),
|
|
96
|
-
contentType: "application/json",
|
|
97
|
-
requestType: "json",
|
|
98
|
-
body: request,
|
|
99
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
100
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
101
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
102
|
-
});
|
|
103
|
-
if (_response.ok) {
|
|
104
|
-
return _response.body;
|
|
105
|
-
}
|
|
106
|
-
if (_response.error.reason === "status-code") {
|
|
107
|
-
throw new errors.ReferralExchangeError({
|
|
108
|
-
statusCode: _response.error.statusCode,
|
|
109
|
-
body: _response.error.body,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
switch (_response.error.reason) {
|
|
113
|
-
case "non-json":
|
|
114
|
-
throw new errors.ReferralExchangeError({
|
|
115
|
-
statusCode: _response.error.statusCode,
|
|
116
|
-
body: _response.error.rawBody,
|
|
117
|
-
});
|
|
118
|
-
case "timeout":
|
|
119
|
-
throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/referrals/{referralId}/notes.");
|
|
120
|
-
case "unknown":
|
|
121
|
-
throw new errors.ReferralExchangeError({
|
|
122
|
-
message: _response.error.errorMessage,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* @param {string} referralId
|
|
129
|
-
* @param {ReferralExchangeClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* await client.apiHoldingControllerBackToDraftReferral("referralId")
|
|
133
|
-
*/
|
|
134
|
-
apiHoldingControllerBackToDraftReferral(referralId, requestOptions) {
|
|
135
|
-
var _a;
|
|
136
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
138
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), `api/v1/referrals/${encodeURIComponent(referralId)}/back-to-draft`),
|
|
139
|
-
method: "POST",
|
|
140
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.7", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.7", "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),
|
|
141
|
-
contentType: "application/json",
|
|
142
|
-
requestType: "json",
|
|
143
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
144
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
145
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
146
|
-
});
|
|
147
|
-
if (_response.ok) {
|
|
148
|
-
return _response.body;
|
|
149
|
-
}
|
|
150
|
-
if (_response.error.reason === "status-code") {
|
|
151
|
-
throw new errors.ReferralExchangeError({
|
|
152
|
-
statusCode: _response.error.statusCode,
|
|
153
|
-
body: _response.error.body,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
switch (_response.error.reason) {
|
|
157
|
-
case "non-json":
|
|
158
|
-
throw new errors.ReferralExchangeError({
|
|
159
|
-
statusCode: _response.error.statusCode,
|
|
160
|
-
body: _response.error.rawBody,
|
|
161
|
-
});
|
|
162
|
-
case "timeout":
|
|
163
|
-
throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/referrals/{referralId}/back-to-draft.");
|
|
164
|
-
case "unknown":
|
|
165
|
-
throw new errors.ReferralExchangeError({
|
|
166
|
-
message: _response.error.errorMessage,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
_getCustomAuthorizationHeaders() {
|
|
172
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
-
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
174
|
-
return { Authorization: apiKeyValue };
|
|
175
|
-
});
|
|
44
|
+
return ((_a = this._health) !== null && _a !== void 0 ? _a : (this._health = new Client_7.Health(this._options)));
|
|
176
45
|
}
|
|
177
46
|
}
|
|
178
47
|
exports.ReferralExchangeClient = ReferralExchangeClient;
|
package/README.md
CHANGED
|
@@ -22,9 +22,34 @@ Instantiate and use the client with the following:
|
|
|
22
22
|
```typescript
|
|
23
23
|
import { ReferralExchangeClient } from "@opengovsg/refx-ts-sdk";
|
|
24
24
|
|
|
25
|
-
const client = new ReferralExchangeClient({
|
|
26
|
-
await client.
|
|
27
|
-
|
|
25
|
+
const client = new ReferralExchangeClient({ apiKey: "YOUR_API_KEY" });
|
|
26
|
+
await client.referrals.upsert({
|
|
27
|
+
patient: {
|
|
28
|
+
uin: "uin",
|
|
29
|
+
name: "name",
|
|
30
|
+
phoneNumber: "91234567",
|
|
31
|
+
dob: "1990-01-01",
|
|
32
|
+
gender: "Male",
|
|
33
|
+
},
|
|
34
|
+
offeringId: "offeringId",
|
|
35
|
+
senderHciCode: "senderHciCode",
|
|
36
|
+
senderInstitutionName: "senderInstitutionName",
|
|
37
|
+
doctorMcr: "doctorMcr",
|
|
38
|
+
doctorName: "doctorName",
|
|
39
|
+
doctorEmail: "doctorEmail",
|
|
40
|
+
doctorContactNumber: "doctorContactNumber",
|
|
41
|
+
isSubsidised: true,
|
|
42
|
+
isUrgent: true,
|
|
43
|
+
isDraft: true,
|
|
44
|
+
formResponses: [
|
|
45
|
+
{
|
|
46
|
+
question: "question",
|
|
47
|
+
id: "id",
|
|
48
|
+
answer: {
|
|
49
|
+
key: "value",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
28
53
|
});
|
|
29
54
|
```
|
|
30
55
|
|
|
@@ -50,7 +75,7 @@ will be thrown.
|
|
|
50
75
|
import { ReferralExchangeError } from "@opengovsg/refx-ts-sdk";
|
|
51
76
|
|
|
52
77
|
try {
|
|
53
|
-
await client.
|
|
78
|
+
await client.referrals.upsert(...);
|
|
54
79
|
} catch (err) {
|
|
55
80
|
if (err instanceof ReferralExchangeError) {
|
|
56
81
|
console.log(err.statusCode);
|
|
@@ -67,7 +92,7 @@ try {
|
|
|
67
92
|
If you would like to send additional headers as part of the request, use the `headers` request option.
|
|
68
93
|
|
|
69
94
|
```typescript
|
|
70
|
-
const response = await client.
|
|
95
|
+
const response = await client.referrals.upsert(..., {
|
|
71
96
|
headers: {
|
|
72
97
|
'X-Custom-Header': 'custom value'
|
|
73
98
|
}
|
|
@@ -89,7 +114,7 @@ A request is deemed retriable when any of the following HTTP status codes is ret
|
|
|
89
114
|
Use the `maxRetries` request option to configure this behavior.
|
|
90
115
|
|
|
91
116
|
```typescript
|
|
92
|
-
const response = await client.
|
|
117
|
+
const response = await client.referrals.upsert(..., {
|
|
93
118
|
maxRetries: 0 // override maxRetries at the request level
|
|
94
119
|
});
|
|
95
120
|
```
|
|
@@ -99,7 +124,7 @@ const response = await client.apiHoldingControllerCreateNote(..., {
|
|
|
99
124
|
The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
|
|
100
125
|
|
|
101
126
|
```typescript
|
|
102
|
-
const response = await client.
|
|
127
|
+
const response = await client.referrals.upsert(..., {
|
|
103
128
|
timeoutInSeconds: 30 // override timeout to 30s
|
|
104
129
|
});
|
|
105
130
|
```
|
|
@@ -110,7 +135,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
|
|
|
110
135
|
|
|
111
136
|
```typescript
|
|
112
137
|
const controller = new AbortController();
|
|
113
|
-
const response = await client.
|
|
138
|
+
const response = await client.referrals.upsert(..., {
|
|
114
139
|
abortSignal: controller.signal
|
|
115
140
|
});
|
|
116
141
|
controller.abort(); // aborts the request
|
package/api/index.d.ts
CHANGED
package/api/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
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
|
import * as ReferralExchange from "../../../index";
|
|
6
7
|
export declare namespace Eligibility {
|
|
7
8
|
interface Options {
|
|
8
|
-
environment
|
|
9
|
+
environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
|
|
9
10
|
apiKey?: core.Supplier<string | undefined>;
|
|
10
11
|
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
@@ -22,7 +23,7 @@ export declare namespace Eligibility {
|
|
|
22
23
|
}
|
|
23
24
|
export declare class Eligibility {
|
|
24
25
|
protected readonly _options: Eligibility.Options;
|
|
25
|
-
constructor(_options
|
|
26
|
+
constructor(_options?: Eligibility.Options);
|
|
26
27
|
/**
|
|
27
28
|
* @param {ReferralExchange.EligibilityGetRequest} request
|
|
28
29
|
* @param {Eligibility.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -39,11 +39,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Eligibility = 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 Eligibility {
|
|
46
|
-
constructor(_options) {
|
|
47
|
+
constructor(_options = {}) {
|
|
47
48
|
this._options = _options;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
@@ -57,16 +58,16 @@ class Eligibility {
|
|
|
57
58
|
* })
|
|
58
59
|
*/
|
|
59
60
|
get(request, requestOptions) {
|
|
60
|
-
var _a;
|
|
61
|
+
var _a, _b;
|
|
61
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
63
|
const { uin, offeringId } = request;
|
|
63
64
|
const _queryParams = {};
|
|
64
65
|
_queryParams["uin"] = uin;
|
|
65
66
|
_queryParams["offeringId"] = offeringId;
|
|
66
67
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
67
|
-
url: (0, url_join_1.default)(yield core.Supplier.get(this._options.environment), "api/v1/eligibility"),
|
|
68
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.ReferralExchangeEnvironment.Production, "api/v1/eligibility"),
|
|
68
69
|
method: "GET",
|
|
69
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
70
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.8", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.8", "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),
|
|
70
71
|
contentType: "application/json",
|
|
71
72
|
queryParameters: _queryParams,
|
|
72
73
|
requestType: "json",
|
|
@@ -1,11 +1,12 @@
|
|
|
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
|
import * as ReferralExchange from "../../../index";
|
|
6
7
|
export declare namespace Health {
|
|
7
8
|
interface Options {
|
|
8
|
-
environment
|
|
9
|
+
environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
|
|
9
10
|
apiKey?: core.Supplier<string | undefined>;
|
|
10
11
|
fetcher?: core.FetchFunction;
|
|
11
12
|
}
|
|
@@ -22,7 +23,7 @@ export declare namespace Health {
|
|
|
22
23
|
}
|
|
23
24
|
export declare class Health {
|
|
24
25
|
protected readonly _options: Health.Options;
|
|
25
|
-
constructor(_options
|
|
26
|
+
constructor(_options?: Health.Options);
|
|
26
27
|
/**
|
|
27
28
|
* @param {Health.RequestOptions} requestOptions - Request-specific configuration.
|
|
28
29
|
*
|
|
@@ -39,11 +39,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.Health = 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 Health {
|
|
46
|
-
constructor(_options) {
|
|
47
|
+
constructor(_options = {}) {
|
|
47
48
|
this._options = _options;
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
@@ -53,12 +54,12 @@ class Health {
|
|
|
53
54
|
* await client.health.check()
|
|
54
55
|
*/
|
|
55
56
|
check(requestOptions) {
|
|
56
|
-
var _a;
|
|
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/health"),
|
|
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/health"),
|
|
60
61
|
method: "GET",
|
|
61
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.
|
|
62
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.8", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.8", "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,
|
package/api/resources/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export * as referrals from "./referrals";
|
|
2
2
|
export * from "./referrals/types";
|
|
3
3
|
export * as eligibility from "./eligibility";
|
|
4
|
+
export * as notes from "./notes";
|
|
4
5
|
export * as offerings from "./offerings";
|
|
5
6
|
export * as public_ from "./public";
|
|
6
7
|
export * as webhooks from "./webhooks";
|
|
7
8
|
export * as health from "./health";
|
|
8
9
|
export * from "./eligibility/client/requests";
|
|
9
10
|
export * from "./referrals/client/requests";
|
|
11
|
+
export * from "./notes/client/requests";
|
|
10
12
|
export * from "./offerings/client/requests";
|
|
11
13
|
export * from "./public/client/requests";
|
package/api/resources/index.js
CHANGED
|
@@ -26,15 +26,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.health = exports.webhooks = exports.public_ = exports.offerings = exports.eligibility = exports.referrals = void 0;
|
|
29
|
+
exports.health = exports.webhooks = exports.public_ = exports.offerings = exports.notes = exports.eligibility = exports.referrals = void 0;
|
|
30
30
|
exports.referrals = __importStar(require("./referrals"));
|
|
31
31
|
__exportStar(require("./referrals/types"), exports);
|
|
32
32
|
exports.eligibility = __importStar(require("./eligibility"));
|
|
33
|
+
exports.notes = __importStar(require("./notes"));
|
|
33
34
|
exports.offerings = __importStar(require("./offerings"));
|
|
34
35
|
exports.public_ = __importStar(require("./public"));
|
|
35
36
|
exports.webhooks = __importStar(require("./webhooks"));
|
|
36
37
|
exports.health = __importStar(require("./health"));
|
|
37
38
|
__exportStar(require("./eligibility/client/requests"), exports);
|
|
38
39
|
__exportStar(require("./referrals/client/requests"), exports);
|
|
40
|
+
__exportStar(require("./notes/client/requests"), exports);
|
|
39
41
|
__exportStar(require("./offerings/client/requests"), exports);
|
|
40
42
|
__exportStar(require("./public/client/requests"), exports);
|
|
@@ -0,0 +1,41 @@
|
|
|
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 Notes {
|
|
8
|
+
interface Options {
|
|
9
|
+
environment?: core.Supplier<environments.ReferralExchangeEnvironment | string>;
|
|
10
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
11
|
+
fetcher?: core.FetchFunction;
|
|
12
|
+
}
|
|
13
|
+
interface RequestOptions {
|
|
14
|
+
/** The maximum time to wait for a response in seconds. */
|
|
15
|
+
timeoutInSeconds?: number;
|
|
16
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
17
|
+
maxRetries?: number;
|
|
18
|
+
/** A hook to abort the request. */
|
|
19
|
+
abortSignal?: AbortSignal;
|
|
20
|
+
/** Additional headers to include in the request. */
|
|
21
|
+
headers?: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export declare class Notes {
|
|
25
|
+
protected readonly _options: Notes.Options;
|
|
26
|
+
constructor(_options?: Notes.Options);
|
|
27
|
+
/**
|
|
28
|
+
* @param {string} referralId - Referral ID
|
|
29
|
+
* @param {ReferralExchange.CreateNoteReq} request
|
|
30
|
+
* @param {Notes.RequestOptions} requestOptions - Request-specific configuration.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* await client.notes.apiHoldingControllerCreateNote("referralId", {
|
|
34
|
+
* authorHciCode: "authorHciCode"
|
|
35
|
+
* })
|
|
36
|
+
*/
|
|
37
|
+
apiHoldingControllerCreateNote(referralId: string, request: ReferralExchange.CreateNoteReq, requestOptions?: Notes.RequestOptions): Promise<ReferralExchange.NoteDto>;
|
|
38
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
39
|
+
Authorization: string | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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 (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
38
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.Notes = void 0;
|
|
42
|
+
const environments = __importStar(require("../../../../environments"));
|
|
43
|
+
const core = __importStar(require("../../../../core"));
|
|
44
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
45
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
46
|
+
class Notes {
|
|
47
|
+
constructor(_options = {}) {
|
|
48
|
+
this._options = _options;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @param {string} referralId - Referral ID
|
|
52
|
+
* @param {ReferralExchange.CreateNoteReq} request
|
|
53
|
+
* @param {Notes.RequestOptions} requestOptions - Request-specific configuration.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* await client.notes.apiHoldingControllerCreateNote("referralId", {
|
|
57
|
+
* authorHciCode: "authorHciCode"
|
|
58
|
+
* })
|
|
59
|
+
*/
|
|
60
|
+
apiHoldingControllerCreateNote(referralId, request, requestOptions) {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
64
|
+
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)}/notes`),
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk", "X-Fern-SDK-Version": "0.0.8", "User-Agent": "@opengovsg/refx-ts-sdk/0.0.8", "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),
|
|
67
|
+
contentType: "application/json",
|
|
68
|
+
requestType: "json",
|
|
69
|
+
body: request,
|
|
70
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
71
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
72
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
73
|
+
});
|
|
74
|
+
if (_response.ok) {
|
|
75
|
+
return _response.body;
|
|
76
|
+
}
|
|
77
|
+
if (_response.error.reason === "status-code") {
|
|
78
|
+
throw new errors.ReferralExchangeError({
|
|
79
|
+
statusCode: _response.error.statusCode,
|
|
80
|
+
body: _response.error.body,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
switch (_response.error.reason) {
|
|
84
|
+
case "non-json":
|
|
85
|
+
throw new errors.ReferralExchangeError({
|
|
86
|
+
statusCode: _response.error.statusCode,
|
|
87
|
+
body: _response.error.rawBody,
|
|
88
|
+
});
|
|
89
|
+
case "timeout":
|
|
90
|
+
throw new errors.ReferralExchangeTimeoutError("Timeout exceeded when calling POST /api/v1/referrals/{referralId}/notes.");
|
|
91
|
+
case "unknown":
|
|
92
|
+
throw new errors.ReferralExchangeError({
|
|
93
|
+
message: _response.error.errorMessage,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
_getCustomAuthorizationHeaders() {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
101
|
+
return { Authorization: apiKeyValue };
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.Notes = Notes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client";
|