|
3 | 3 | */
|
4 | 4 |
|
5 | 5 | import * as core from "./core";
|
6 |
| -import urlJoin from "url-join"; |
7 |
| -import * as errors from "./errors/index"; |
8 | 6 | import { Eligibility } from "./api/resources/eligibility/client/Client";
|
9 | 7 | import { Referrals } from "./api/resources/referrals/client/Client";
|
10 | 8 | import { Offerings } from "./api/resources/offerings/client/Client";
|
@@ -64,72 +62,4 @@ export class ReferralExchangeClient {
|
64 | 62 | public get health(): Health {
|
65 | 63 | return (this._health ??= new Health(this._options));
|
66 | 64 | }
|
67 |
| - |
68 |
| - /** |
69 |
| - * @param {unknown} formId |
70 |
| - * @param {ReferralExchangeClient.RequestOptions} requestOptions - Request-specific configuration. |
71 |
| - * |
72 |
| - * @example |
73 |
| - * await client.formSgWebhooksControllerHandleDoctorNotesFormWebhook({ |
74 |
| - * "key": "value" |
75 |
| - * }) |
76 |
| - */ |
77 |
| - public async formSgWebhooksControllerHandleDoctorNotesFormWebhook( |
78 |
| - formId: unknown, |
79 |
| - requestOptions?: ReferralExchangeClient.RequestOptions |
80 |
| - ): Promise<void> { |
81 |
| - const _response = await (this._options.fetcher ?? core.fetcher)({ |
82 |
| - url: urlJoin( |
83 |
| - await core.Supplier.get(this._options.environment), |
84 |
| - `api/v1/webhooks/formsg/form-submission/${encodeURIComponent(formId)}` |
85 |
| - ), |
86 |
| - method: "POST", |
87 |
| - headers: { |
88 |
| - "X-Fern-Language": "JavaScript", |
89 |
| - "X-Fern-SDK-Name": "ogp-refx", |
90 |
| - "X-Fern-SDK-Version": "0.0.1", |
91 |
| - "User-Agent": "ogp-refx/0.0.1", |
92 |
| - "X-Fern-Runtime": core.RUNTIME.type, |
93 |
| - "X-Fern-Runtime-Version": core.RUNTIME.version, |
94 |
| - ...(await this._getCustomAuthorizationHeaders()), |
95 |
| - ...requestOptions?.headers, |
96 |
| - }, |
97 |
| - contentType: "application/json", |
98 |
| - requestType: "json", |
99 |
| - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, |
100 |
| - maxRetries: requestOptions?.maxRetries, |
101 |
| - abortSignal: requestOptions?.abortSignal, |
102 |
| - }); |
103 |
| - if (_response.ok) { |
104 |
| - return; |
105 |
| - } |
106 |
| - |
107 |
| - if (_response.error.reason === "status-code") { |
108 |
| - throw new errors.ReferralExchangeError({ |
109 |
| - statusCode: _response.error.statusCode, |
110 |
| - body: _response.error.body, |
111 |
| - }); |
112 |
| - } |
113 |
| - |
114 |
| - switch (_response.error.reason) { |
115 |
| - case "non-json": |
116 |
| - throw new errors.ReferralExchangeError({ |
117 |
| - statusCode: _response.error.statusCode, |
118 |
| - body: _response.error.rawBody, |
119 |
| - }); |
120 |
| - case "timeout": |
121 |
| - throw new errors.ReferralExchangeTimeoutError( |
122 |
| - "Timeout exceeded when calling POST /api/v1/webhooks/formsg/form-submission/{formId}." |
123 |
| - ); |
124 |
| - case "unknown": |
125 |
| - throw new errors.ReferralExchangeError({ |
126 |
| - message: _response.error.errorMessage, |
127 |
| - }); |
128 |
| - } |
129 |
| - } |
130 |
| - |
131 |
| - protected async _getCustomAuthorizationHeaders() { |
132 |
| - const apiKeyValue = await core.Supplier.get(this._options.apiKey); |
133 |
| - return { Authorization: apiKeyValue }; |
134 |
| - } |
135 | 65 | }
|
0 commit comments