@bluehive/sdk 0.1.0-alpha.2 → 0.1.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +312 -0
- package/README.md +2 -6
- package/client.d.mts +19 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +19 -4
- package/client.d.ts.map +1 -1
- package/client.js +29 -11
- package/client.js.map +1 -1
- package/client.mjs +29 -11
- package/client.mjs.map +1 -1
- package/internal/to-file.d.mts +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.js +1 -1
- package/internal/to-file.mjs +1 -1
- package/internal/tslib.js +17 -17
- package/internal/utils/values.js +3 -3
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs +3 -3
- package/internal/utils/values.mjs.map +1 -1
- package/package.json +4 -5
- package/resources/employees.d.mts +463 -0
- package/resources/employees.d.mts.map +1 -0
- package/resources/employees.d.ts +463 -0
- package/resources/employees.d.ts.map +1 -0
- package/resources/employees.js +54 -0
- package/resources/employees.js.map +1 -0
- package/resources/employees.mjs +50 -0
- package/resources/employees.mjs.map +1 -0
- package/resources/employers/employers.d.mts +88 -0
- package/resources/employers/employers.d.mts.map +1 -0
- package/resources/employers/employers.d.ts +88 -0
- package/resources/employers/employers.d.ts.map +1 -0
- package/resources/employers/employers.js +41 -0
- package/resources/employers/employers.js.map +1 -0
- package/resources/employers/employers.mjs +36 -0
- package/resources/employers/employers.mjs.map +1 -0
- package/resources/employers/index.d.mts +3 -0
- package/resources/employers/index.d.mts.map +1 -0
- package/resources/employers/index.d.ts +3 -0
- package/resources/employers/index.d.ts.map +1 -0
- package/resources/employers/index.js +9 -0
- package/resources/employers/index.js.map +1 -0
- package/resources/employers/index.mjs +4 -0
- package/resources/employers/index.mjs.map +1 -0
- package/resources/employers/service-bundles.d.mts +146 -0
- package/resources/employers/service-bundles.d.mts.map +1 -0
- package/resources/employers/service-bundles.d.ts +146 -0
- package/resources/employers/service-bundles.d.ts.map +1 -0
- package/resources/employers/service-bundles.js +47 -0
- package/resources/employers/service-bundles.js.map +1 -0
- package/resources/employers/service-bundles.mjs +43 -0
- package/resources/employers/service-bundles.mjs.map +1 -0
- package/resources/employers.d.mts +2 -0
- package/resources/employers.d.mts.map +1 -0
- package/resources/employers.d.ts +2 -0
- package/resources/employers.d.ts.map +1 -0
- package/resources/employers.js +6 -0
- package/resources/employers.js.map +1 -0
- package/resources/employers.mjs +3 -0
- package/resources/employers.mjs.map +1 -0
- package/resources/fax.d.mts +3 -1
- package/resources/fax.d.mts.map +1 -1
- package/resources/fax.d.ts +3 -1
- package/resources/fax.d.ts.map +1 -1
- package/resources/hl7.d.mts +46 -0
- package/resources/hl7.d.mts.map +1 -0
- package/resources/hl7.d.ts +46 -0
- package/resources/hl7.d.ts.map +1 -0
- package/resources/hl7.js +15 -0
- package/resources/hl7.js.map +1 -0
- package/resources/hl7.mjs +11 -0
- package/resources/hl7.mjs.map +1 -0
- package/resources/index.d.mts +5 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +5 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +11 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +5 -0
- package/resources/index.mjs.map +1 -1
- package/resources/integrations.d.mts +42 -0
- package/resources/integrations.d.mts.map +1 -0
- package/resources/integrations.d.ts +42 -0
- package/resources/integrations.d.ts.map +1 -0
- package/resources/integrations.js +33 -0
- package/resources/integrations.js.map +1 -0
- package/resources/integrations.mjs +29 -0
- package/resources/integrations.mjs.map +1 -0
- package/resources/orders.d.mts +604 -0
- package/resources/orders.d.mts.map +1 -0
- package/resources/orders.d.ts +604 -0
- package/resources/orders.d.ts.map +1 -0
- package/resources/orders.js +71 -0
- package/resources/orders.js.map +1 -0
- package/resources/orders.mjs +67 -0
- package/resources/orders.mjs.map +1 -0
- package/src/client.ts +136 -14
- package/src/internal/polyfill/file.node.d.ts +14 -0
- package/src/internal/polyfill/file.node.mjs +9 -0
- package/src/internal/to-file.ts +1 -1
- package/src/internal/utils/values.ts +3 -3
- package/src/resources/employees.ts +634 -0
- package/src/resources/employers/employers.ts +160 -0
- package/src/resources/employers/index.ts +21 -0
- package/src/resources/employers/service-bundles.ts +264 -0
- package/src/resources/employers.ts +3 -0
- package/src/resources/fax.ts +1 -1
- package/src/resources/hl7.ts +60 -0
- package/src/resources/index.ts +49 -0
- package/src/resources/integrations.ts +72 -0
- package/src/resources/orders.ts +944 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../src/resources/orders.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;OAIG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,OAAe,EAAE,OAAwB;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,cAAc,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,MAAM,CACJ,OAAe,EACf,OAA6C,EAAE,EAC/C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,cAAc,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED;;;OAGG;I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,CAAC;IAC7F,CAAC;CACF;AA3FD,wBA2FC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
|
+
import { path } from "../internal/utils/path.mjs";
|
|
5
|
+
export class Orders extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Create orders for consumers (self-pay or employer-sponsored), employers, or bulk
|
|
8
|
+
* orders. Consolidates functionality from legacy Order.createOrder and
|
|
9
|
+
* Order.SendOrder methods.
|
|
10
|
+
*/
|
|
11
|
+
create(body, options) {
|
|
12
|
+
return this._client.post('/v1/orders', { body, ...options });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Retrieve details for a specific order
|
|
16
|
+
*/
|
|
17
|
+
retrieve(orderID, options) {
|
|
18
|
+
return this._client.get(path `/v1/orders/${orderID}`, options);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Update order details and associated order items. Allows updating order status,
|
|
22
|
+
* metadata, and modifying order item services.
|
|
23
|
+
*/
|
|
24
|
+
update(orderID, body = {}, options) {
|
|
25
|
+
return this._client.post(path `/v1/orders/${orderID}`, { body, ...options });
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Retrieve results for an order. Supports filtering by serviceId, status, date
|
|
29
|
+
* window, and pagination.
|
|
30
|
+
*/
|
|
31
|
+
retrieveResults(orderID, query = {}, options) {
|
|
32
|
+
return this._client.get(path `/v1/orders/${orderID}/results`, { query, ...options });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Schedule an appointment or walk-in for an existing order. Sends HL7 SIU^S12
|
|
36
|
+
* message for appointment booking.
|
|
37
|
+
*/
|
|
38
|
+
scheduleAppointment(orderID, body, options) {
|
|
39
|
+
return this._client.post(path `/v1/orders/${orderID}/schedule-appointment`, { body, ...options });
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Send an order for a specific employee. Requires API key, login token, and user
|
|
43
|
+
* ID. This endpoint specifically handles employer-to-employee order sending.
|
|
44
|
+
*/
|
|
45
|
+
sendForEmployee(params, options) {
|
|
46
|
+
const { 'login-token': loginToken, 'user-id': userID, ...body } = params;
|
|
47
|
+
return this._client.post('/v1/orders/send', {
|
|
48
|
+
body,
|
|
49
|
+
...options,
|
|
50
|
+
headers: buildHeaders([{ 'login-token': loginToken, 'user-id': userID }, options?.headers]),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Update the status of an existing order
|
|
55
|
+
*/
|
|
56
|
+
updateStatus(orderID, body, options) {
|
|
57
|
+
return this._client.put(path `/v1/orders/${orderID}/status`, { body, ...options });
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Upload test results for a specific order item. Supports both existing fileIds
|
|
61
|
+
* and base64 encoded files. Requires order access code and employee verification.
|
|
62
|
+
*/
|
|
63
|
+
uploadResults(orderID, body, options) {
|
|
64
|
+
return this._client.post(path `/v1/orders/${orderID}/upload-results`, { body, ...options });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=orders.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orders.mjs","sourceRoot":"","sources":["../src/resources/orders.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;OAIG;IACH,MAAM,CAAC,IAAuB,EAAE,OAAwB;QACtD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,OAAe,EAAE,OAAwB;QAChD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AO,CAAC,GAAG,CAAC,IAAI,CAAA,cAAc,OAAO,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;OAGG;IACH,aAAa,CACX,OAAe,EACf,IAA8B,EAC9B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,cAAc,OAAO,iBAAiB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -17,6 +17,21 @@ import * as Uploads from './core/uploads';
|
|
|
17
17
|
import * as API from './resources/index';
|
|
18
18
|
import { APIPromise } from './core/api-promise';
|
|
19
19
|
import { Database, DatabaseCheckHealthResponse } from './resources/database';
|
|
20
|
+
import {
|
|
21
|
+
EmployeeCreateParams,
|
|
22
|
+
EmployeeCreateResponse,
|
|
23
|
+
EmployeeDeleteResponse,
|
|
24
|
+
EmployeeLinkUserParams,
|
|
25
|
+
EmployeeLinkUserResponse,
|
|
26
|
+
EmployeeListParams,
|
|
27
|
+
EmployeeListResponse,
|
|
28
|
+
EmployeeRetrieveResponse,
|
|
29
|
+
EmployeeUnlinkUserParams,
|
|
30
|
+
EmployeeUnlinkUserResponse,
|
|
31
|
+
EmployeeUpdateParams,
|
|
32
|
+
EmployeeUpdateResponse,
|
|
33
|
+
Employees,
|
|
34
|
+
} from './resources/employees';
|
|
20
35
|
import {
|
|
21
36
|
Fax,
|
|
22
37
|
FaxListProvidersResponse,
|
|
@@ -25,8 +40,42 @@ import {
|
|
|
25
40
|
FaxSendResponse,
|
|
26
41
|
} from './resources/fax';
|
|
27
42
|
import { Health, HealthCheckResponse } from './resources/health';
|
|
43
|
+
import { Hl7, Hl7SendResultsParams, Hl7SendResultsResponse } from './resources/hl7';
|
|
44
|
+
import {
|
|
45
|
+
IntegrationCheckActiveParams,
|
|
46
|
+
IntegrationCheckActiveResponse,
|
|
47
|
+
IntegrationListParams,
|
|
48
|
+
IntegrationListResponse,
|
|
49
|
+
Integrations,
|
|
50
|
+
} from './resources/integrations';
|
|
51
|
+
import {
|
|
52
|
+
OrderCreateParams,
|
|
53
|
+
OrderCreateResponse,
|
|
54
|
+
OrderRetrieveResponse,
|
|
55
|
+
OrderRetrieveResultsParams,
|
|
56
|
+
OrderRetrieveResultsResponse,
|
|
57
|
+
OrderScheduleAppointmentParams,
|
|
58
|
+
OrderScheduleAppointmentResponse,
|
|
59
|
+
OrderSendForEmployeeParams,
|
|
60
|
+
OrderSendForEmployeeResponse,
|
|
61
|
+
OrderUpdateParams,
|
|
62
|
+
OrderUpdateResponse,
|
|
63
|
+
OrderUpdateStatusParams,
|
|
64
|
+
OrderUpdateStatusResponse,
|
|
65
|
+
OrderUploadResultsParams,
|
|
66
|
+
OrderUploadResultsResponse,
|
|
67
|
+
Orders,
|
|
68
|
+
} from './resources/orders';
|
|
28
69
|
import { ProviderLookupParams, ProviderLookupResponse, Providers } from './resources/providers';
|
|
29
70
|
import { Version, VersionRetrieveResponse } from './resources/version';
|
|
71
|
+
import {
|
|
72
|
+
EmployerCreateParams,
|
|
73
|
+
EmployerCreateResponse,
|
|
74
|
+
EmployerListParams,
|
|
75
|
+
EmployerListResponse,
|
|
76
|
+
EmployerRetrieveResponse,
|
|
77
|
+
Employers,
|
|
78
|
+
} from './resources/employers/employers';
|
|
30
79
|
import { type Fetch } from './internal/builtin-types';
|
|
31
80
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
32
81
|
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
@@ -124,7 +173,7 @@ export class BlueHive {
|
|
|
124
173
|
baseURL: string;
|
|
125
174
|
maxRetries: number;
|
|
126
175
|
timeout: number;
|
|
127
|
-
logger: Logger
|
|
176
|
+
logger: Logger;
|
|
128
177
|
logLevel: LogLevel | undefined;
|
|
129
178
|
fetchOptions: MergedRequestInit | undefined;
|
|
130
179
|
|
|
@@ -186,7 +235,7 @@ export class BlueHive {
|
|
|
186
235
|
* Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
187
236
|
*/
|
|
188
237
|
withOptions(options: Partial<ClientOptions>): this {
|
|
189
|
-
|
|
238
|
+
const client = new (this.constructor as any as new (props: ClientOptions) => typeof this)({
|
|
190
239
|
...this._options,
|
|
191
240
|
baseURL: this.baseURL,
|
|
192
241
|
maxRetries: this.maxRetries,
|
|
@@ -198,6 +247,7 @@ export class BlueHive {
|
|
|
198
247
|
apiKey: this.apiKey,
|
|
199
248
|
...options,
|
|
200
249
|
});
|
|
250
|
+
return client;
|
|
201
251
|
}
|
|
202
252
|
|
|
203
253
|
/**
|
|
@@ -215,7 +265,7 @@ export class BlueHive {
|
|
|
215
265
|
return;
|
|
216
266
|
}
|
|
217
267
|
|
|
218
|
-
protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined {
|
|
268
|
+
protected async authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
|
|
219
269
|
return buildHeaders([{ Authorization: this.apiKey }]);
|
|
220
270
|
}
|
|
221
271
|
|
|
@@ -347,7 +397,9 @@ export class BlueHive {
|
|
|
347
397
|
|
|
348
398
|
await this.prepareOptions(options);
|
|
349
399
|
|
|
350
|
-
const { req, url, timeout } = this.buildRequest(options, {
|
|
400
|
+
const { req, url, timeout } = await this.buildRequest(options, {
|
|
401
|
+
retryCount: maxRetries - retriesRemaining,
|
|
402
|
+
});
|
|
351
403
|
|
|
352
404
|
await this.prepareRequest(req, { url, options });
|
|
353
405
|
|
|
@@ -375,7 +427,7 @@ export class BlueHive {
|
|
|
375
427
|
const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError);
|
|
376
428
|
const headersTime = Date.now();
|
|
377
429
|
|
|
378
|
-
if (response instanceof Error) {
|
|
430
|
+
if (response instanceof globalThis.Error) {
|
|
379
431
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
380
432
|
if (options.signal?.aborted) {
|
|
381
433
|
throw new Errors.APIUserAbortError();
|
|
@@ -425,7 +477,7 @@ export class BlueHive {
|
|
|
425
477
|
} with status ${response.status} in ${headersTime - startTime}ms`;
|
|
426
478
|
|
|
427
479
|
if (!response.ok) {
|
|
428
|
-
const shouldRetry = this.shouldRetry(response);
|
|
480
|
+
const shouldRetry = await this.shouldRetry(response);
|
|
429
481
|
if (retriesRemaining && shouldRetry) {
|
|
430
482
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
431
483
|
|
|
@@ -524,7 +576,7 @@ export class BlueHive {
|
|
|
524
576
|
}
|
|
525
577
|
}
|
|
526
578
|
|
|
527
|
-
private shouldRetry(response: Response): boolean {
|
|
579
|
+
private async shouldRetry(response: Response): Promise<boolean> {
|
|
528
580
|
// Note this is not a standard header.
|
|
529
581
|
const shouldRetryHeader = response.headers.get('x-should-retry');
|
|
530
582
|
|
|
@@ -601,10 +653,10 @@ export class BlueHive {
|
|
|
601
653
|
return sleepSeconds * jitter * 1000;
|
|
602
654
|
}
|
|
603
655
|
|
|
604
|
-
buildRequest(
|
|
656
|
+
async buildRequest(
|
|
605
657
|
inputOptions: FinalRequestOptions,
|
|
606
658
|
{ retryCount = 0 }: { retryCount?: number } = {},
|
|
607
|
-
): { req: FinalizedRequestInit; url: string; timeout: number } {
|
|
659
|
+
): Promise<{ req: FinalizedRequestInit; url: string; timeout: number }> {
|
|
608
660
|
const options = { ...inputOptions };
|
|
609
661
|
const { method, path, query, defaultBaseURL } = options;
|
|
610
662
|
|
|
@@ -612,7 +664,7 @@ export class BlueHive {
|
|
|
612
664
|
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
|
|
613
665
|
options.timeout = options.timeout ?? this.timeout;
|
|
614
666
|
const { bodyHeaders, body } = this.buildBody({ options });
|
|
615
|
-
const reqHeaders = this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
|
|
667
|
+
const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
|
|
616
668
|
|
|
617
669
|
const req: FinalizedRequestInit = {
|
|
618
670
|
method,
|
|
@@ -628,7 +680,7 @@ export class BlueHive {
|
|
|
628
680
|
return { req, url, timeout: options.timeout };
|
|
629
681
|
}
|
|
630
682
|
|
|
631
|
-
private buildHeaders({
|
|
683
|
+
private async buildHeaders({
|
|
632
684
|
options,
|
|
633
685
|
method,
|
|
634
686
|
bodyHeaders,
|
|
@@ -638,7 +690,7 @@ export class BlueHive {
|
|
|
638
690
|
method: HTTPMethod;
|
|
639
691
|
bodyHeaders: HeadersLike;
|
|
640
692
|
retryCount: number;
|
|
641
|
-
}): Headers {
|
|
693
|
+
}): Promise<Headers> {
|
|
642
694
|
let idempotencyHeaders: HeadersLike = {};
|
|
643
695
|
if (this.idempotencyHeader && method !== 'get') {
|
|
644
696
|
if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey();
|
|
@@ -654,7 +706,7 @@ export class BlueHive {
|
|
|
654
706
|
...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}),
|
|
655
707
|
...getPlatformHeaders(),
|
|
656
708
|
},
|
|
657
|
-
this.authHeaders(options),
|
|
709
|
+
await this.authHeaders(options),
|
|
658
710
|
this._options.defaultHeaders,
|
|
659
711
|
bodyHeaders,
|
|
660
712
|
options.headers,
|
|
@@ -682,7 +734,7 @@ export class BlueHive {
|
|
|
682
734
|
// Preserve legacy string encoding behavior for now
|
|
683
735
|
headers.values.has('content-type')) ||
|
|
684
736
|
// `Blob` is superset of `File`
|
|
685
|
-
body instanceof Blob ||
|
|
737
|
+
((globalThis as any).Blob && body instanceof (globalThis as any).Blob) ||
|
|
686
738
|
// `FormData` -> `multipart/form-data`
|
|
687
739
|
body instanceof FormData ||
|
|
688
740
|
// `URLSearchParams` -> `application/x-www-form-urlencoded`
|
|
@@ -726,12 +778,24 @@ export class BlueHive {
|
|
|
726
778
|
providers: API.Providers = new API.Providers(this);
|
|
727
779
|
database: API.Database = new API.Database(this);
|
|
728
780
|
fax: API.Fax = new API.Fax(this);
|
|
781
|
+
employers: API.Employers = new API.Employers(this);
|
|
782
|
+
hl7: API.Hl7 = new API.Hl7(this);
|
|
783
|
+
orders: API.Orders = new API.Orders(this);
|
|
784
|
+
employees: API.Employees = new API.Employees(this);
|
|
785
|
+
integrations: API.Integrations = new API.Integrations(this);
|
|
729
786
|
}
|
|
787
|
+
|
|
730
788
|
BlueHive.Health = Health;
|
|
731
789
|
BlueHive.Version = Version;
|
|
732
790
|
BlueHive.Providers = Providers;
|
|
733
791
|
BlueHive.Database = Database;
|
|
734
792
|
BlueHive.Fax = Fax;
|
|
793
|
+
BlueHive.Employers = Employers;
|
|
794
|
+
BlueHive.Hl7 = Hl7;
|
|
795
|
+
BlueHive.Orders = Orders;
|
|
796
|
+
BlueHive.Employees = Employees;
|
|
797
|
+
BlueHive.Integrations = Integrations;
|
|
798
|
+
|
|
735
799
|
export declare namespace BlueHive {
|
|
736
800
|
export type RequestOptions = Opts.RequestOptions;
|
|
737
801
|
|
|
@@ -754,4 +818,62 @@ export declare namespace BlueHive {
|
|
|
754
818
|
type FaxSendResponse as FaxSendResponse,
|
|
755
819
|
type FaxSendParams as FaxSendParams,
|
|
756
820
|
};
|
|
821
|
+
|
|
822
|
+
export {
|
|
823
|
+
Employers as Employers,
|
|
824
|
+
type EmployerCreateResponse as EmployerCreateResponse,
|
|
825
|
+
type EmployerRetrieveResponse as EmployerRetrieveResponse,
|
|
826
|
+
type EmployerListResponse as EmployerListResponse,
|
|
827
|
+
type EmployerCreateParams as EmployerCreateParams,
|
|
828
|
+
type EmployerListParams as EmployerListParams,
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
export {
|
|
832
|
+
Hl7 as Hl7,
|
|
833
|
+
type Hl7SendResultsResponse as Hl7SendResultsResponse,
|
|
834
|
+
type Hl7SendResultsParams as Hl7SendResultsParams,
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
export {
|
|
838
|
+
Orders as Orders,
|
|
839
|
+
type OrderCreateResponse as OrderCreateResponse,
|
|
840
|
+
type OrderRetrieveResponse as OrderRetrieveResponse,
|
|
841
|
+
type OrderUpdateResponse as OrderUpdateResponse,
|
|
842
|
+
type OrderRetrieveResultsResponse as OrderRetrieveResultsResponse,
|
|
843
|
+
type OrderScheduleAppointmentResponse as OrderScheduleAppointmentResponse,
|
|
844
|
+
type OrderSendForEmployeeResponse as OrderSendForEmployeeResponse,
|
|
845
|
+
type OrderUpdateStatusResponse as OrderUpdateStatusResponse,
|
|
846
|
+
type OrderUploadResultsResponse as OrderUploadResultsResponse,
|
|
847
|
+
type OrderCreateParams as OrderCreateParams,
|
|
848
|
+
type OrderUpdateParams as OrderUpdateParams,
|
|
849
|
+
type OrderRetrieveResultsParams as OrderRetrieveResultsParams,
|
|
850
|
+
type OrderScheduleAppointmentParams as OrderScheduleAppointmentParams,
|
|
851
|
+
type OrderSendForEmployeeParams as OrderSendForEmployeeParams,
|
|
852
|
+
type OrderUpdateStatusParams as OrderUpdateStatusParams,
|
|
853
|
+
type OrderUploadResultsParams as OrderUploadResultsParams,
|
|
854
|
+
};
|
|
855
|
+
|
|
856
|
+
export {
|
|
857
|
+
Employees as Employees,
|
|
858
|
+
type EmployeeCreateResponse as EmployeeCreateResponse,
|
|
859
|
+
type EmployeeRetrieveResponse as EmployeeRetrieveResponse,
|
|
860
|
+
type EmployeeUpdateResponse as EmployeeUpdateResponse,
|
|
861
|
+
type EmployeeListResponse as EmployeeListResponse,
|
|
862
|
+
type EmployeeDeleteResponse as EmployeeDeleteResponse,
|
|
863
|
+
type EmployeeLinkUserResponse as EmployeeLinkUserResponse,
|
|
864
|
+
type EmployeeUnlinkUserResponse as EmployeeUnlinkUserResponse,
|
|
865
|
+
type EmployeeCreateParams as EmployeeCreateParams,
|
|
866
|
+
type EmployeeUpdateParams as EmployeeUpdateParams,
|
|
867
|
+
type EmployeeListParams as EmployeeListParams,
|
|
868
|
+
type EmployeeLinkUserParams as EmployeeLinkUserParams,
|
|
869
|
+
type EmployeeUnlinkUserParams as EmployeeUnlinkUserParams,
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
export {
|
|
873
|
+
Integrations as Integrations,
|
|
874
|
+
type IntegrationListResponse as IntegrationListResponse,
|
|
875
|
+
type IntegrationCheckActiveResponse as IntegrationCheckActiveResponse,
|
|
876
|
+
type IntegrationListParams as IntegrationListParams,
|
|
877
|
+
type IntegrationCheckActiveParams as IntegrationCheckActiveParams,
|
|
878
|
+
};
|
|
757
879
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file polyfills the global `File` object for you if it's not already defined
|
|
3
|
+
* when running on Node.js
|
|
4
|
+
*
|
|
5
|
+
* This is only needed on Node.js v18 & v19. Newer versions already define `File`
|
|
6
|
+
* as a global.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
type nodeBuffer = typeof import('node:buffer');
|
|
11
|
+
declare const File: typeof globalThis extends { File: unknown } ? (typeof globalThis)['File']
|
|
12
|
+
: nodeBuffer extends { File: unknown } ? nodeBuffer['File']
|
|
13
|
+
: any;
|
|
14
|
+
export {};
|
package/src/internal/to-file.ts
CHANGED
|
@@ -73,7 +73,7 @@ export type ToFileInput =
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats
|
|
76
|
-
* @param value the raw content of the file.
|
|
76
|
+
* @param value the raw content of the file. Can be an {@link Uploadable}, BlobLikePart, or AsyncIterable of BlobLikeParts
|
|
77
77
|
* @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible
|
|
78
78
|
* @param {Object=} options additional properties
|
|
79
79
|
* @param {string=} options.type the MIME type of the content
|
|
@@ -76,21 +76,21 @@ export const coerceBoolean = (value: unknown): boolean => {
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
export const maybeCoerceInteger = (value: unknown): number | undefined => {
|
|
79
|
-
if (value
|
|
79
|
+
if (value == null) {
|
|
80
80
|
return undefined;
|
|
81
81
|
}
|
|
82
82
|
return coerceInteger(value);
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
export const maybeCoerceFloat = (value: unknown): number | undefined => {
|
|
86
|
-
if (value
|
|
86
|
+
if (value == null) {
|
|
87
87
|
return undefined;
|
|
88
88
|
}
|
|
89
89
|
return coerceFloat(value);
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
export const maybeCoerceBoolean = (value: unknown): boolean | undefined => {
|
|
93
|
-
if (value
|
|
93
|
+
if (value == null) {
|
|
94
94
|
return undefined;
|
|
95
95
|
}
|
|
96
96
|
return coerceBoolean(value);
|