Skip to content

Commit

Permalink
Release 0.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 14, 2024
1 parent 4450526 commit 7f419e5
Show file tree
Hide file tree
Showing 41 changed files with 551 additions and 391 deletions.
41 changes: 33 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,34 @@ Instantiate and use the client with the following:
```typescript
import { ReferralExchangeClient } from "@opengovsg/refx-ts-sdk";

const client = new ReferralExchangeClient({ environment: "YOUR_BASE_URL", apiKey: "YOUR_API_KEY" });
await client.apiHoldingControllerCreateNote("referralId", {
authorHciCode: "authorHciCode",
const client = new ReferralExchangeClient({ apiKey: "YOUR_API_KEY" });
await client.referrals.upsert({
patient: {
uin: "uin",
name: "name",
phoneNumber: "91234567",
dob: "1990-01-01",
gender: "Male",
},
offeringId: "offeringId",
senderHciCode: "senderHciCode",
senderInstitutionName: "senderInstitutionName",
doctorMcr: "doctorMcr",
doctorName: "doctorName",
doctorEmail: "doctorEmail",
doctorContactNumber: "doctorContactNumber",
isSubsidised: true,
isUrgent: true,
isDraft: true,
formResponses: [
{
question: "question",
id: "id",
answer: {
key: "value",
},
},
],
});
```

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

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

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

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

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

```typescript
const controller = new AbortController();
const response = await client.apiHoldingControllerCreateNote(..., {
const response = await client.referrals.upsert(..., {
abortSignal: controller.signal
});
controller.abort(); // aborts the request
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opengovsg/refx-ts-sdk",
"version": "2024.10.5",
"version": "0.0.8",
"private": false,
"repository": "https://github.com/opengovsg/refer-ts-sdk",
"main": "./index.js",
Expand Down
Loading

0 comments on commit 7f419e5

Please sign in to comment.