@@ -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 ({ 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
+ ],
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 .apiHoldingControllerCreateNote (... );
78
+ await client .referrals . upsert (... );
54
79
} catch (err ) {
55
80
if (err instanceof ReferralExchangeError ) {
56
81
console .log (err .statusCode );
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 .apiHoldingControllerCreateNote (... , {
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 .apiHoldingControllerCreateNote (... , {
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 .apiHoldingControllerCreateNote (... , {
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 .apiHoldingControllerCreateNote (... , {
138
+ const response = await client .referrals . upsert (... , {
114
139
abortSignal: controller .signal
115
140
});
116
141
controller .abort (); // aborts the request
0 commit comments