@@ -22,9 +22,34 @@ Instantiate and use the client with the following:
2222``` typescript
2323import { 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.
5075import { ReferralExchangeError } from " @opengovsg/refx-ts-sdk" ;
5176
5277try {
53- await client .apiHoldingControllerCreateNote (... );
78+ await client .referrals . upsert (... );
5479} catch (err ) {
5580 if (err instanceof ReferralExchangeError ) {
5681 console .log (err .statusCode );
6792If 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
89114Use 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(..., {
99124The 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
112137const controller = new AbortController ();
113- const response = await client .apiHoldingControllerCreateNote (... , {
138+ const response = await client .referrals . upsert (... , {
114139 abortSignal: controller .signal
115140});
116141controller .abort (); // aborts the request
0 commit comments