Skip to content

Commit 7f419e5

Browse files
committed
Release 0.0.8
1 parent 4450526 commit 7f419e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+551
-391
lines changed

README.md

+33-8
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,34 @@ Instantiate and use the client with the following:
2222
```typescript
2323
import { ReferralExchangeClient } from "@opengovsg/refx-ts-sdk";
2424

25-
const client = new ReferralExchangeClient({ environment: "YOUR_BASE_URL", apiKey: "YOUR_API_KEY" });
26-
await client.apiHoldingControllerCreateNote("referralId", {
27-
authorHciCode: "authorHciCode",
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+
],
2853
});
2954
```
3055

@@ -50,7 +75,7 @@ will be thrown.
5075
import { ReferralExchangeError } from "@opengovsg/refx-ts-sdk";
5176

5277
try {
53-
await client.apiHoldingControllerCreateNote(...);
78+
await client.referrals.upsert(...);
5479
} catch (err) {
5580
if (err instanceof ReferralExchangeError) {
5681
console.log(err.statusCode);
@@ -67,7 +92,7 @@ try {
6792
If you would like to send additional headers as part of the request, use the `headers` request option.
6893

6994
```typescript
70-
const response = await client.apiHoldingControllerCreateNote(..., {
95+
const response = await client.referrals.upsert(..., {
7196
headers: {
7297
'X-Custom-Header': 'custom value'
7398
}
@@ -89,7 +114,7 @@ A request is deemed retriable when any of the following HTTP status codes is ret
89114
Use the `maxRetries` request option to configure this behavior.
90115

91116
```typescript
92-
const response = await client.apiHoldingControllerCreateNote(..., {
117+
const response = await client.referrals.upsert(..., {
93118
maxRetries: 0 // override maxRetries at the request level
94119
});
95120
```
@@ -99,7 +124,7 @@ const response = await client.apiHoldingControllerCreateNote(..., {
99124
The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
100125

101126
```typescript
102-
const response = await client.apiHoldingControllerCreateNote(..., {
127+
const response = await client.referrals.upsert(..., {
103128
timeoutInSeconds: 30 // override timeout to 30s
104129
});
105130
```
@@ -110,7 +135,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
110135

111136
```typescript
112137
const controller = new AbortController();
113-
const response = await client.apiHoldingControllerCreateNote(..., {
138+
const response = await client.referrals.upsert(..., {
114139
abortSignal: controller.signal
115140
});
116141
controller.abort(); // aborts the request

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opengovsg/refx-ts-sdk",
3-
"version": "2024.10.5",
3+
"version": "0.0.8",
44
"private": false,
55
"repository": "https://github.com/opengovsg/refer-ts-sdk",
66
"main": "./index.js",

0 commit comments

Comments
 (0)