Skip to content

Commit 2b85d12

Browse files
committed
Release 0.0.29
1 parent be2be93 commit 2b85d12

File tree

16 files changed

+265
-94
lines changed

16 files changed

+265
-94
lines changed

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": "0.0.28",
3+
"version": "0.0.29",
44
"private": false,
55
"repository": "https://github.com/opengovsg/refer-ts-sdk",
66
"main": "./index.js",

src/api/errors/BadRequestError.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
import * as errors from "../../errors/index";
6+
import * as ReferralExchange from "../index";
7+
8+
export class BadRequestError extends errors.ReferralExchangeError {
9+
constructor(body: ReferralExchange.BadRequestErrorBody) {
10+
super({
11+
message: "BadRequestError",
12+
statusCode: 400,
13+
body: body,
14+
});
15+
Object.setPrototypeOf(this, BadRequestError.prototype);
16+
}
17+
}

src/api/errors/UnauthorizedError.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
5+
import * as errors from "../../errors/index";
6+
7+
export class UnauthorizedError extends errors.ReferralExchangeError {
8+
constructor(body?: unknown) {
9+
super({
10+
message: "UnauthorizedError",
11+
statusCode: 401,
12+
body: body,
13+
});
14+
Object.setPrototypeOf(this, UnauthorizedError.prototype);
15+
}
16+
}

src/api/errors/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
export * from "./UnauthorizedError";
2+
export * from "./BadRequestError";
13
export * from "./NotFoundError";

src/api/resources/eligibility/client/Client.ts

+13-6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export class Eligibility {
3434
* @param {ReferralExchange.EligibilityGetRequest} request
3535
* @param {Eligibility.RequestOptions} requestOptions - Request-specific configuration.
3636
*
37+
* @throws {@link ReferralExchange.UnauthorizedError}
38+
*
3739
* @example
3840
* await client.eligibility.get({
3941
* uin: "uin",
@@ -58,8 +60,8 @@ export class Eligibility {
5860
headers: {
5961
"X-Fern-Language": "JavaScript",
6062
"X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk",
61-
"X-Fern-SDK-Version": "0.0.28",
62-
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.28",
63+
"X-Fern-SDK-Version": "0.0.29",
64+
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.29",
6365
"X-Fern-Runtime": core.RUNTIME.type,
6466
"X-Fern-Runtime-Version": core.RUNTIME.version,
6567
...(await this._getCustomAuthorizationHeaders()),
@@ -77,10 +79,15 @@ export class Eligibility {
7779
}
7880

7981
if (_response.error.reason === "status-code") {
80-
throw new errors.ReferralExchangeError({
81-
statusCode: _response.error.statusCode,
82-
body: _response.error.body,
83-
});
82+
switch (_response.error.statusCode) {
83+
case 401:
84+
throw new ReferralExchange.UnauthorizedError(_response.error.body as unknown);
85+
default:
86+
throw new errors.ReferralExchangeError({
87+
statusCode: _response.error.statusCode,
88+
body: _response.error.body,
89+
});
90+
}
8491
}
8592

8693
switch (_response.error.reason) {

src/api/resources/health/client/Client.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export class Health {
4747
headers: {
4848
"X-Fern-Language": "JavaScript",
4949
"X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk",
50-
"X-Fern-SDK-Version": "0.0.28",
51-
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.28",
50+
"X-Fern-SDK-Version": "0.0.29",
51+
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.29",
5252
"X-Fern-Runtime": core.RUNTIME.type,
5353
"X-Fern-Runtime-Version": core.RUNTIME.version,
5454
...(await this._getCustomAuthorizationHeaders()),

src/api/resources/notes/client/Client.ts

+13-6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export class Notes {
3535
* @param {ReferralExchange.CreateNoteReq} request
3636
* @param {Notes.RequestOptions} requestOptions - Request-specific configuration.
3737
*
38+
* @throws {@link ReferralExchange.UnauthorizedError}
39+
*
3840
* @example
3941
* await client.notes.create("referralId", {
4042
* authorHciCode: "authorHciCode"
@@ -55,8 +57,8 @@ export class Notes {
5557
headers: {
5658
"X-Fern-Language": "JavaScript",
5759
"X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk",
58-
"X-Fern-SDK-Version": "0.0.28",
59-
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.28",
60+
"X-Fern-SDK-Version": "0.0.29",
61+
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.29",
6062
"X-Fern-Runtime": core.RUNTIME.type,
6163
"X-Fern-Runtime-Version": core.RUNTIME.version,
6264
...(await this._getCustomAuthorizationHeaders()),
@@ -74,10 +76,15 @@ export class Notes {
7476
}
7577

7678
if (_response.error.reason === "status-code") {
77-
throw new errors.ReferralExchangeError({
78-
statusCode: _response.error.statusCode,
79-
body: _response.error.body,
80-
});
79+
switch (_response.error.statusCode) {
80+
case 401:
81+
throw new ReferralExchange.UnauthorizedError(_response.error.body as unknown);
82+
default:
83+
throw new errors.ReferralExchangeError({
84+
statusCode: _response.error.statusCode,
85+
body: _response.error.body,
86+
});
87+
}
8188
}
8289

8390
switch (_response.error.reason) {

src/api/resources/offerings/client/Client.ts

+26-12
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export class Offerings {
3333
/**
3434
* @param {Offerings.RequestOptions} requestOptions - Request-specific configuration.
3535
*
36+
* @throws {@link ReferralExchange.UnauthorizedError}
37+
*
3638
* @example
3739
* await client.offerings.list()
3840
*/
@@ -47,8 +49,8 @@ export class Offerings {
4749
headers: {
4850
"X-Fern-Language": "JavaScript",
4951
"X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk",
50-
"X-Fern-SDK-Version": "0.0.28",
51-
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.28",
52+
"X-Fern-SDK-Version": "0.0.29",
53+
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.29",
5254
"X-Fern-Runtime": core.RUNTIME.type,
5355
"X-Fern-Runtime-Version": core.RUNTIME.version,
5456
...(await this._getCustomAuthorizationHeaders()),
@@ -65,10 +67,15 @@ export class Offerings {
6567
}
6668

6769
if (_response.error.reason === "status-code") {
68-
throw new errors.ReferralExchangeError({
69-
statusCode: _response.error.statusCode,
70-
body: _response.error.body,
71-
});
70+
switch (_response.error.statusCode) {
71+
case 401:
72+
throw new ReferralExchange.UnauthorizedError(_response.error.body as unknown);
73+
default:
74+
throw new errors.ReferralExchangeError({
75+
statusCode: _response.error.statusCode,
76+
body: _response.error.body,
77+
});
78+
}
7279
}
7380

7481
switch (_response.error.reason) {
@@ -91,6 +98,8 @@ export class Offerings {
9198
* @param {ReferralExchange.OfferingsListTimeslotsRequest} request
9299
* @param {Offerings.RequestOptions} requestOptions - Request-specific configuration.
93100
*
101+
* @throws {@link ReferralExchange.UnauthorizedError}
102+
*
94103
* @example
95104
* await client.offerings.listTimeslots("offeringId", {
96105
* from: 1.1,
@@ -116,8 +125,8 @@ export class Offerings {
116125
headers: {
117126
"X-Fern-Language": "JavaScript",
118127
"X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk",
119-
"X-Fern-SDK-Version": "0.0.28",
120-
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.28",
128+
"X-Fern-SDK-Version": "0.0.29",
129+
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.29",
121130
"X-Fern-Runtime": core.RUNTIME.type,
122131
"X-Fern-Runtime-Version": core.RUNTIME.version,
123132
...(await this._getCustomAuthorizationHeaders()),
@@ -135,10 +144,15 @@ export class Offerings {
135144
}
136145

137146
if (_response.error.reason === "status-code") {
138-
throw new errors.ReferralExchangeError({
139-
statusCode: _response.error.statusCode,
140-
body: _response.error.body,
141-
});
147+
switch (_response.error.statusCode) {
148+
case 401:
149+
throw new ReferralExchange.UnauthorizedError(_response.error.body as unknown);
150+
default:
151+
throw new errors.ReferralExchangeError({
152+
statusCode: _response.error.statusCode,
153+
body: _response.error.body,
154+
});
155+
}
142156
}
143157

144158
switch (_response.error.reason) {

src/api/resources/public/client/Client.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ export class Public {
6161
headers: {
6262
"X-Fern-Language": "JavaScript",
6363
"X-Fern-SDK-Name": "@opengovsg/refx-ts-sdk",
64-
"X-Fern-SDK-Version": "0.0.28",
65-
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.28",
64+
"X-Fern-SDK-Version": "0.0.29",
65+
"User-Agent": "@opengovsg/refx-ts-sdk/0.0.29",
6666
"X-Fern-Runtime": core.RUNTIME.type,
6767
"X-Fern-Runtime-Version": core.RUNTIME.version,
6868
...(await this._getCustomAuthorizationHeaders()),

0 commit comments

Comments
 (0)