@haau3/sdk 0.1.2 → 0.2.1
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/README.md +37 -2
- package/dist/index.cjs +197 -49
- package/dist/index.d.cts +128 -52
- package/dist/index.d.mts +128 -52
- package/dist/index.mjs +197 -50
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
import * as fhir4 from "fhir/r4.js";
|
|
2
2
|
import { Bundle, OperationOutcome } from "fhir/r4.js";
|
|
3
|
+
//#region src/api-promise.d.ts
|
|
4
|
+
/** What the API answered besides the body: the same names {@link Transport.request} uses. */
|
|
5
|
+
interface ResponseMeta {
|
|
6
|
+
/** The `X-Request-Id` the API sent. Quote it when you ask for help. */
|
|
7
|
+
requestId: string | undefined;
|
|
8
|
+
/** Milliseconds from the first attempt to the answer, waits between attempts included. */
|
|
9
|
+
durationMs: number;
|
|
10
|
+
/** How many attempts were made. */
|
|
11
|
+
attempts: number;
|
|
12
|
+
status: number;
|
|
13
|
+
headers: Headers;
|
|
14
|
+
}
|
|
15
|
+
/** A typed call's answer together with what came with it. */
|
|
16
|
+
type WithResponse<T> = ResponseMeta & {
|
|
17
|
+
data: T;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* What every typed method returns: a promise of the answer, as before, that can also give the
|
|
21
|
+
* request id and timing that came with it.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* const plan = await haau3.readInsurancePlan(id);
|
|
25
|
+
* const { data, requestId, durationMs } = await haau3.readInsurancePlan(id).withResponse();
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* The request is sent once, when the method is called, whichever way it is awaited.
|
|
29
|
+
*/
|
|
30
|
+
export declare class APIPromise<T> extends Promise<T> {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(response: Promise<WithResponse<T>>);
|
|
33
|
+
/** The answer, its request id, its timing, its status and its headers. */
|
|
34
|
+
withResponse(): Promise<WithResponse<T>>;
|
|
35
|
+
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
36
|
+
catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
37
|
+
finally(onfinally?: (() => void) | null): Promise<T>;
|
|
38
|
+
/** `Promise.prototype.then` and friends build plain promises from an APIPromise. */
|
|
39
|
+
static get [Symbol.species](): PromiseConstructor;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
3
42
|
//#region src/generated/openapi.d.ts
|
|
4
43
|
interface components {
|
|
5
44
|
schemas: {
|
|
@@ -3928,6 +3967,15 @@ type ResponseOf<Op extends OperationId> = operations[Op]["responses"] extends {
|
|
|
3928
3967
|
} ? Content[keyof Content] : never;
|
|
3929
3968
|
//#endregion
|
|
3930
3969
|
//#region src/transport.d.ts
|
|
3970
|
+
/**
|
|
3971
|
+
* Options passed on to `fetch` with every request: anything the runtime's `RequestInit` takes, such
|
|
3972
|
+
* as `cache`, undici's `dispatcher`, Cloudflare's `cf` or Next.js's `next`. The SDK's own method,
|
|
3973
|
+
* headers, body, signal and redirect always win. `cache` is declared here because Node's own `RequestInit` type leaves it out,
|
|
3974
|
+
* though Node's fetch takes it.
|
|
3975
|
+
*/
|
|
3976
|
+
type FetchOptions = Omit<RequestInit, "method" | "headers" | "body" | "signal" | "redirect" | "cache"> & {
|
|
3977
|
+
cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
|
|
3978
|
+
};
|
|
3931
3979
|
/** How to construct the client. Every option has a default. */
|
|
3932
3980
|
interface ClientOptions {
|
|
3933
3981
|
/** Your platform API key (`haau3_sk_…`). Defaults to `process.env.HAAU3_API_KEY`. */
|
|
@@ -3940,6 +3988,14 @@ interface ClientOptions {
|
|
|
3940
3988
|
maxRetries?: number;
|
|
3941
3989
|
/** The fetch to send requests with. Defaults to the global `fetch`. */
|
|
3942
3990
|
fetch?: typeof fetch;
|
|
3991
|
+
/**
|
|
3992
|
+
* Passed on to `fetch` with every request: anything the runtime's fetch takes, such as undici's
|
|
3993
|
+
* `dispatcher` for a proxy in Node, Cloudflare's `cf` or Next.js's `next`. Unless it sets `cache`
|
|
3994
|
+
* (or Next.js's `next`), every request is sent with `cache: "no-store"` where the runtime takes
|
|
3995
|
+
* the field: an API answer is live data for one key, never one a fetch cache should keep. Pass
|
|
3996
|
+
* `{ cache: undefined }` to send no `cache` at all.
|
|
3997
|
+
*/
|
|
3998
|
+
fetchOptions?: FetchOptions;
|
|
3943
3999
|
}
|
|
3944
4000
|
/** Options for one call. Each overrides the client's own for that call only. */
|
|
3945
4001
|
interface RequestOptions {
|
|
@@ -3951,6 +4007,8 @@ interface RequestOptions {
|
|
|
3951
4007
|
signal?: AbortSignal;
|
|
3952
4008
|
/** Extra headers for this call, such as `X-Request-Id` with your own UUID. */
|
|
3953
4009
|
headers?: Record<string, string>;
|
|
4010
|
+
/** Passed on to `fetch` for this call, over the client's own `fetchOptions`. */
|
|
4011
|
+
fetchOptions?: FetchOptions;
|
|
3954
4012
|
}
|
|
3955
4013
|
/** A query parameter's value. A list sends the parameter once per value. */
|
|
3956
4014
|
type QueryValue = string | number | boolean | ReadonlyArray<string | number | boolean> | undefined;
|
|
@@ -3964,15 +4022,9 @@ interface RawRequest extends RequestOptions {
|
|
|
3964
4022
|
body?: unknown;
|
|
3965
4023
|
}
|
|
3966
4024
|
/** What the API answered, whatever its status. */
|
|
3967
|
-
interface RawResponse {
|
|
3968
|
-
status: number;
|
|
3969
|
-
headers: Headers;
|
|
4025
|
+
interface RawResponse extends ResponseMeta {
|
|
3970
4026
|
/** The body, parsed when it is JSON, else its text. */
|
|
3971
4027
|
body: unknown;
|
|
3972
|
-
/** The `X-Request-Id` the API sent. */
|
|
3973
|
-
requestId: string | undefined;
|
|
3974
|
-
attempts: number;
|
|
3975
|
-
durationMs: number;
|
|
3976
4028
|
}
|
|
3977
4029
|
/** What a generated method passes to {@link Transport.operation}. */
|
|
3978
4030
|
interface OperationCall {
|
|
@@ -3981,6 +4033,8 @@ interface OperationCall {
|
|
|
3981
4033
|
pathParams?: Record<string, string>;
|
|
3982
4034
|
query?: object;
|
|
3983
4035
|
body?: unknown;
|
|
4036
|
+
/** The FHIR resource types the operation answers with, from the spec. Unset for other answers. */
|
|
4037
|
+
expects?: readonly string[];
|
|
3984
4038
|
}
|
|
3985
4039
|
/** The connection, retries and errors every operation shares. */
|
|
3986
4040
|
declare abstract class Transport {
|
|
@@ -3997,13 +4051,19 @@ declare abstract class Transport {
|
|
|
3997
4051
|
* answer arrived ({@link NoAnswerError}), or for a URL that is not on the client's own `baseURL`.
|
|
3998
4052
|
*/
|
|
3999
4053
|
request(request: RawRequest): Promise<RawResponse>;
|
|
4000
|
-
/**
|
|
4001
|
-
|
|
4054
|
+
/**
|
|
4055
|
+
* Runs one operation of the spec and returns its answer, or throws one of the three errors. The
|
|
4056
|
+
* answer's `.withResponse()` gives its request id and timing too.
|
|
4057
|
+
*/
|
|
4058
|
+
protected operation<T>(call: OperationCall, options?: RequestOptions): APIPromise<T>;
|
|
4059
|
+
/** Sends a request and returns its answer only. See {@link Transport.respond}. */
|
|
4060
|
+
protected answer<T>(method: "GET" | "POST", url: URL, body: unknown, options: RequestOptions, label: string, expects?: readonly string[]): Promise<T>;
|
|
4002
4061
|
/**
|
|
4003
4062
|
* Sends a request and reads its answer. `label` names the request in an error message: the
|
|
4004
4063
|
* operation's path with its `{id}` left in, so no value a caller sent ends up in a message.
|
|
4064
|
+
* `expects`, when set, are the FHIR resource types the answer may be; any other is not an answer.
|
|
4005
4065
|
*/
|
|
4006
|
-
protected
|
|
4066
|
+
protected respond<T>(method: "GET" | "POST", url: URL, body: unknown, options: RequestOptions, label: string, expects?: readonly string[]): Promise<WithResponse<T>>;
|
|
4007
4067
|
/** A URL on this client's base, refusing any other host so the key is never sent to one. */
|
|
4008
4068
|
protected url(pathOrUrl: string): URL;
|
|
4009
4069
|
}
|
|
@@ -4072,7 +4132,7 @@ declare abstract class Operations extends Transport {
|
|
|
4072
4132
|
*
|
|
4073
4133
|
* `GET /v1/fhir/r4/InsurancePlan/{id}/$in-network`
|
|
4074
4134
|
*/
|
|
4075
|
-
checkInsurancePlanNetwork(id: string, params: CheckInsurancePlanNetworkParams, options?: RequestOptions):
|
|
4135
|
+
checkInsurancePlanNetwork(id: string, params: CheckInsurancePlanNetworkParams, options?: RequestOptions): APIPromise<ResponseOf<"checkInsurancePlanNetwork">>;
|
|
4076
4136
|
/**
|
|
4077
4137
|
* Look up a code
|
|
4078
4138
|
*
|
|
@@ -4080,7 +4140,7 @@ declare abstract class Operations extends Transport {
|
|
|
4080
4140
|
*
|
|
4081
4141
|
* `GET /v1/fhir/r4/CodeSystem/$lookup`
|
|
4082
4142
|
*/
|
|
4083
|
-
codeSystemLookup(params: CodeSystemLookupParams, options?: RequestOptions):
|
|
4143
|
+
codeSystemLookup(params: CodeSystemLookupParams, options?: RequestOptions): APIPromise<ResponseOf<"codeSystemLookup">>;
|
|
4084
4144
|
/**
|
|
4085
4145
|
* Look up a code
|
|
4086
4146
|
*
|
|
@@ -4088,7 +4148,7 @@ declare abstract class Operations extends Transport {
|
|
|
4088
4148
|
*
|
|
4089
4149
|
* `POST /v1/fhir/r4/CodeSystem/$lookup`
|
|
4090
4150
|
*/
|
|
4091
|
-
codeSystemLookupPost(body: BodyOf<"codeSystemLookupPost">, options?: RequestOptions):
|
|
4151
|
+
codeSystemLookupPost(body: BodyOf<"codeSystemLookupPost">, options?: RequestOptions): APIPromise<ResponseOf<"codeSystemLookupPost">>;
|
|
4092
4152
|
/**
|
|
4093
4153
|
* Validate a code in a code system
|
|
4094
4154
|
*
|
|
@@ -4096,7 +4156,7 @@ declare abstract class Operations extends Transport {
|
|
|
4096
4156
|
*
|
|
4097
4157
|
* `GET /v1/fhir/r4/CodeSystem/$validate-code`
|
|
4098
4158
|
*/
|
|
4099
|
-
codeSystemValidateCode(params: CodeSystemValidateCodeParams, options?: RequestOptions):
|
|
4159
|
+
codeSystemValidateCode(params: CodeSystemValidateCodeParams, options?: RequestOptions): APIPromise<ResponseOf<"codeSystemValidateCode">>;
|
|
4100
4160
|
/**
|
|
4101
4161
|
* Validate a code in a code system
|
|
4102
4162
|
*
|
|
@@ -4104,7 +4164,7 @@ declare abstract class Operations extends Transport {
|
|
|
4104
4164
|
*
|
|
4105
4165
|
* `POST /v1/fhir/r4/CodeSystem/$validate-code`
|
|
4106
4166
|
*/
|
|
4107
|
-
codeSystemValidateCodePost(body: BodyOf<"codeSystemValidateCodePost">, options?: RequestOptions):
|
|
4167
|
+
codeSystemValidateCodePost(body: BodyOf<"codeSystemValidateCodePost">, options?: RequestOptions): APIPromise<ResponseOf<"codeSystemValidateCodePost">>;
|
|
4108
4168
|
/**
|
|
4109
4169
|
* Run several operations in one request (batch)
|
|
4110
4170
|
*
|
|
@@ -4112,7 +4172,7 @@ declare abstract class Operations extends Transport {
|
|
|
4112
4172
|
*
|
|
4113
4173
|
* `POST /v1/fhir/r4`
|
|
4114
4174
|
*/
|
|
4115
|
-
fhirBatch(body: BodyOf<"fhirBatch">, options?: RequestOptions):
|
|
4175
|
+
fhirBatch(body: BodyOf<"fhirBatch">, options?: RequestOptions): APIPromise<ResponseOf<"fhirBatch">>;
|
|
4116
4176
|
/**
|
|
4117
4177
|
* Capability statement
|
|
4118
4178
|
*
|
|
@@ -4120,7 +4180,7 @@ declare abstract class Operations extends Transport {
|
|
|
4120
4180
|
*
|
|
4121
4181
|
* `GET /v1/fhir/r4/metadata`
|
|
4122
4182
|
*/
|
|
4123
|
-
fhirMetadata(params?: FhirMetadataParams, options?: RequestOptions):
|
|
4183
|
+
fhirMetadata(params?: FhirMetadataParams, options?: RequestOptions): APIPromise<ResponseOf<"fhirMetadata">>;
|
|
4124
4184
|
/**
|
|
4125
4185
|
* List a state's counties
|
|
4126
4186
|
*
|
|
@@ -4128,7 +4188,7 @@ declare abstract class Operations extends Transport {
|
|
|
4128
4188
|
*
|
|
4129
4189
|
* `GET /v1/fhir/r4/InsurancePlan/$counties`
|
|
4130
4190
|
*/
|
|
4131
|
-
listInsurancePlanCounties(params: ListInsurancePlanCountiesParams, options?: RequestOptions):
|
|
4191
|
+
listInsurancePlanCounties(params: ListInsurancePlanCountiesParams, options?: RequestOptions): APIPromise<ResponseOf<"listInsurancePlanCounties">>;
|
|
4132
4192
|
/**
|
|
4133
4193
|
* List scheduling publishers
|
|
4134
4194
|
*
|
|
@@ -4136,7 +4196,7 @@ declare abstract class Operations extends Transport {
|
|
|
4136
4196
|
*
|
|
4137
4197
|
* `GET /v1/scheduling/publishers`
|
|
4138
4198
|
*/
|
|
4139
|
-
listPublishers(options?: RequestOptions):
|
|
4199
|
+
listPublishers(options?: RequestOptions): APIPromise<ResponseOf<"listPublishers">>;
|
|
4140
4200
|
/**
|
|
4141
4201
|
* List service types
|
|
4142
4202
|
*
|
|
@@ -4144,7 +4204,7 @@ declare abstract class Operations extends Transport {
|
|
|
4144
4204
|
*
|
|
4145
4205
|
* `GET /v1/scheduling/service-types`
|
|
4146
4206
|
*/
|
|
4147
|
-
listServiceTypes(params?: ListServiceTypesParams, options?: RequestOptions):
|
|
4207
|
+
listServiceTypes(params?: ListServiceTypesParams, options?: RequestOptions): APIPromise<ResponseOf<"listServiceTypes">>;
|
|
4148
4208
|
/**
|
|
4149
4209
|
* List specialties
|
|
4150
4210
|
*
|
|
@@ -4152,7 +4212,7 @@ declare abstract class Operations extends Transport {
|
|
|
4152
4212
|
*
|
|
4153
4213
|
* `GET /v1/scheduling/specialties`
|
|
4154
4214
|
*/
|
|
4155
|
-
listSpecialties(params?: ListSpecialtiesParams, options?: RequestOptions):
|
|
4215
|
+
listSpecialties(params?: ListSpecialtiesParams, options?: RequestOptions): APIPromise<ResponseOf<"listSpecialties">>;
|
|
4156
4216
|
/**
|
|
4157
4217
|
* Read an Endpoint
|
|
4158
4218
|
*
|
|
@@ -4160,7 +4220,7 @@ declare abstract class Operations extends Transport {
|
|
|
4160
4220
|
*
|
|
4161
4221
|
* `GET /v1/fhir/r4/Endpoint/{id}`
|
|
4162
4222
|
*/
|
|
4163
|
-
readEndpoint(id: string, options?: RequestOptions):
|
|
4223
|
+
readEndpoint(id: string, options?: RequestOptions): APIPromise<ResponseOf<"readEndpoint">>;
|
|
4164
4224
|
/**
|
|
4165
4225
|
* Read a HealthcareService
|
|
4166
4226
|
*
|
|
@@ -4168,7 +4228,7 @@ declare abstract class Operations extends Transport {
|
|
|
4168
4228
|
*
|
|
4169
4229
|
* `GET /v1/fhir/r4/HealthcareService/{id}`
|
|
4170
4230
|
*/
|
|
4171
|
-
readHealthcareService(id: string, options?: RequestOptions):
|
|
4231
|
+
readHealthcareService(id: string, options?: RequestOptions): APIPromise<ResponseOf<"readHealthcareService">>;
|
|
4172
4232
|
/**
|
|
4173
4233
|
* Read a plan
|
|
4174
4234
|
*
|
|
@@ -4176,7 +4236,7 @@ declare abstract class Operations extends Transport {
|
|
|
4176
4236
|
*
|
|
4177
4237
|
* `GET /v1/fhir/r4/InsurancePlan/{id}`
|
|
4178
4238
|
*/
|
|
4179
|
-
readInsurancePlan(id: string, options?: RequestOptions):
|
|
4239
|
+
readInsurancePlan(id: string, options?: RequestOptions): APIPromise<ResponseOf<"readInsurancePlan">>;
|
|
4180
4240
|
/**
|
|
4181
4241
|
* Read a Location
|
|
4182
4242
|
*
|
|
@@ -4184,7 +4244,7 @@ declare abstract class Operations extends Transport {
|
|
|
4184
4244
|
*
|
|
4185
4245
|
* `GET /v1/fhir/r4/Location/{id}`
|
|
4186
4246
|
*/
|
|
4187
|
-
readLocation(id: string, options?: RequestOptions):
|
|
4247
|
+
readLocation(id: string, options?: RequestOptions): APIPromise<ResponseOf<"readLocation">>;
|
|
4188
4248
|
/**
|
|
4189
4249
|
* Read an Organization
|
|
4190
4250
|
*
|
|
@@ -4192,7 +4252,7 @@ declare abstract class Operations extends Transport {
|
|
|
4192
4252
|
*
|
|
4193
4253
|
* `GET /v1/fhir/r4/Organization/{id}`
|
|
4194
4254
|
*/
|
|
4195
|
-
readOrganization(id: string, options?: RequestOptions):
|
|
4255
|
+
readOrganization(id: string, options?: RequestOptions): APIPromise<ResponseOf<"readOrganization">>;
|
|
4196
4256
|
/**
|
|
4197
4257
|
* Read an OrganizationAffiliation
|
|
4198
4258
|
*
|
|
@@ -4200,7 +4260,7 @@ declare abstract class Operations extends Transport {
|
|
|
4200
4260
|
*
|
|
4201
4261
|
* `GET /v1/fhir/r4/OrganizationAffiliation/{id}`
|
|
4202
4262
|
*/
|
|
4203
|
-
readOrganizationAffiliation(id: string, options?: RequestOptions):
|
|
4263
|
+
readOrganizationAffiliation(id: string, options?: RequestOptions): APIPromise<ResponseOf<"readOrganizationAffiliation">>;
|
|
4204
4264
|
/**
|
|
4205
4265
|
* Read a Practitioner
|
|
4206
4266
|
*
|
|
@@ -4208,7 +4268,7 @@ declare abstract class Operations extends Transport {
|
|
|
4208
4268
|
*
|
|
4209
4269
|
* `GET /v1/fhir/r4/Practitioner/{id}`
|
|
4210
4270
|
*/
|
|
4211
|
-
readPractitioner(id: string, options?: RequestOptions):
|
|
4271
|
+
readPractitioner(id: string, options?: RequestOptions): APIPromise<ResponseOf<"readPractitioner">>;
|
|
4212
4272
|
/**
|
|
4213
4273
|
* Read a PractitionerRole
|
|
4214
4274
|
*
|
|
@@ -4216,7 +4276,7 @@ declare abstract class Operations extends Transport {
|
|
|
4216
4276
|
*
|
|
4217
4277
|
* `GET /v1/fhir/r4/PractitionerRole/{id}`
|
|
4218
4278
|
*/
|
|
4219
|
-
readPractitionerRole(id: string, options?: RequestOptions):
|
|
4279
|
+
readPractitionerRole(id: string, options?: RequestOptions): APIPromise<ResponseOf<"readPractitionerRole">>;
|
|
4220
4280
|
/**
|
|
4221
4281
|
* Read a questionnaire
|
|
4222
4282
|
*
|
|
@@ -4226,7 +4286,7 @@ declare abstract class Operations extends Transport {
|
|
|
4226
4286
|
*
|
|
4227
4287
|
* `GET /v1/fhir/r4/Questionnaire/{id}`
|
|
4228
4288
|
*/
|
|
4229
|
-
readQuestionnaire(id: string, options?: RequestOptions):
|
|
4289
|
+
readQuestionnaire(id: string, options?: RequestOptions): APIPromise<ResponseOf<"readQuestionnaire">>;
|
|
4230
4290
|
/**
|
|
4231
4291
|
* Reconcile one patient's medication records
|
|
4232
4292
|
*
|
|
@@ -4234,7 +4294,7 @@ declare abstract class Operations extends Transport {
|
|
|
4234
4294
|
*
|
|
4235
4295
|
* `POST /v1/fhir/r4/$reconcile-medications`
|
|
4236
4296
|
*/
|
|
4237
|
-
reconcileMedications(body: BodyOf<"reconcileMedications">, options?: RequestOptions):
|
|
4297
|
+
reconcileMedications(body: BodyOf<"reconcileMedications">, options?: RequestOptions): APIPromise<ResponseOf<"reconcileMedications">>;
|
|
4238
4298
|
/**
|
|
4239
4299
|
* Find endpoints
|
|
4240
4300
|
*
|
|
@@ -4242,7 +4302,7 @@ declare abstract class Operations extends Transport {
|
|
|
4242
4302
|
*
|
|
4243
4303
|
* `GET /v1/fhir/r4/Endpoint`
|
|
4244
4304
|
*/
|
|
4245
|
-
searchEndpoint(params?: SearchEndpointParams, options?: RequestOptions):
|
|
4305
|
+
searchEndpoint(params?: SearchEndpointParams, options?: RequestOptions): APIPromise<ResponseOf<"searchEndpoint">>;
|
|
4246
4306
|
/**
|
|
4247
4307
|
* Find healthcare services
|
|
4248
4308
|
*
|
|
@@ -4250,7 +4310,7 @@ declare abstract class Operations extends Transport {
|
|
|
4250
4310
|
*
|
|
4251
4311
|
* `GET /v1/fhir/r4/HealthcareService`
|
|
4252
4312
|
*/
|
|
4253
|
-
searchHealthcareService(params?: SearchHealthcareServiceParams, options?: RequestOptions):
|
|
4313
|
+
searchHealthcareService(params?: SearchHealthcareServiceParams, options?: RequestOptions): APIPromise<ResponseOf<"searchHealthcareService">>;
|
|
4254
4314
|
/**
|
|
4255
4315
|
* Find a plan
|
|
4256
4316
|
*
|
|
@@ -4264,7 +4324,7 @@ declare abstract class Operations extends Transport {
|
|
|
4264
4324
|
*
|
|
4265
4325
|
* `GET /v1/fhir/r4/InsurancePlan`
|
|
4266
4326
|
*/
|
|
4267
|
-
searchInsurancePlan(params?: SearchInsurancePlanParams, options?: RequestOptions):
|
|
4327
|
+
searchInsurancePlan(params?: SearchInsurancePlanParams, options?: RequestOptions): APIPromise<ResponseOf<"searchInsurancePlan">>;
|
|
4268
4328
|
/**
|
|
4269
4329
|
* Find practice locations
|
|
4270
4330
|
*
|
|
@@ -4272,7 +4332,7 @@ declare abstract class Operations extends Transport {
|
|
|
4272
4332
|
*
|
|
4273
4333
|
* `GET /v1/fhir/r4/Location`
|
|
4274
4334
|
*/
|
|
4275
|
-
searchLocation(params?: SearchLocationParams, options?: RequestOptions):
|
|
4335
|
+
searchLocation(params?: SearchLocationParams, options?: RequestOptions): APIPromise<ResponseOf<"searchLocation">>;
|
|
4276
4336
|
/**
|
|
4277
4337
|
* Find organizations, payers and networks
|
|
4278
4338
|
*
|
|
@@ -4284,7 +4344,7 @@ declare abstract class Operations extends Transport {
|
|
|
4284
4344
|
*
|
|
4285
4345
|
* `GET /v1/fhir/r4/Organization`
|
|
4286
4346
|
*/
|
|
4287
|
-
searchOrganization(params?: SearchOrganizationParams, options?: RequestOptions):
|
|
4347
|
+
searchOrganization(params?: SearchOrganizationParams, options?: RequestOptions): APIPromise<ResponseOf<"searchOrganization">>;
|
|
4288
4348
|
/**
|
|
4289
4349
|
* Find the organizations in a network
|
|
4290
4350
|
*
|
|
@@ -4292,7 +4352,7 @@ declare abstract class Operations extends Transport {
|
|
|
4292
4352
|
*
|
|
4293
4353
|
* `GET /v1/fhir/r4/OrganizationAffiliation`
|
|
4294
4354
|
*/
|
|
4295
|
-
searchOrganizationAffiliation(params?: SearchOrganizationAffiliationParams, options?: RequestOptions):
|
|
4355
|
+
searchOrganizationAffiliation(params?: SearchOrganizationAffiliationParams, options?: RequestOptions): APIPromise<ResponseOf<"searchOrganizationAffiliation">>;
|
|
4296
4356
|
/**
|
|
4297
4357
|
* Find a practitioner by NPI or name
|
|
4298
4358
|
*
|
|
@@ -4304,7 +4364,7 @@ declare abstract class Operations extends Transport {
|
|
|
4304
4364
|
*
|
|
4305
4365
|
* `GET /v1/fhir/r4/Practitioner`
|
|
4306
4366
|
*/
|
|
4307
|
-
searchPractitioner(params?: SearchPractitionerParams, options?: RequestOptions):
|
|
4367
|
+
searchPractitioner(params?: SearchPractitionerParams, options?: RequestOptions): APIPromise<ResponseOf<"searchPractitioner">>;
|
|
4308
4368
|
/**
|
|
4309
4369
|
* Find practitioner roles
|
|
4310
4370
|
*
|
|
@@ -4316,7 +4376,7 @@ declare abstract class Operations extends Transport {
|
|
|
4316
4376
|
*
|
|
4317
4377
|
* `GET /v1/fhir/r4/PractitionerRole`
|
|
4318
4378
|
*/
|
|
4319
|
-
searchPractitionerRole(params?: SearchPractitionerRoleParams, options?: RequestOptions):
|
|
4379
|
+
searchPractitionerRole(params?: SearchPractitionerRoleParams, options?: RequestOptions): APIPromise<ResponseOf<"searchPractitionerRole">>;
|
|
4320
4380
|
/**
|
|
4321
4381
|
* Search provider locations
|
|
4322
4382
|
*
|
|
@@ -4324,7 +4384,7 @@ declare abstract class Operations extends Transport {
|
|
|
4324
4384
|
*
|
|
4325
4385
|
* `GET /v1/scheduling/provider-locations`
|
|
4326
4386
|
*/
|
|
4327
|
-
searchProviderLocations(params?: SearchProviderLocationsParams, options?: RequestOptions):
|
|
4387
|
+
searchProviderLocations(params?: SearchProviderLocationsParams, options?: RequestOptions): APIPromise<ResponseOf<"searchProviderLocations">>;
|
|
4328
4388
|
/**
|
|
4329
4389
|
* List or find a questionnaire
|
|
4330
4390
|
*
|
|
@@ -4340,7 +4400,7 @@ declare abstract class Operations extends Transport {
|
|
|
4340
4400
|
*
|
|
4341
4401
|
* `GET /v1/fhir/r4/Questionnaire`
|
|
4342
4402
|
*/
|
|
4343
|
-
searchQuestionnaire(params?: SearchQuestionnaireParams, options?: RequestOptions):
|
|
4403
|
+
searchQuestionnaire(params?: SearchQuestionnaireParams, options?: RequestOptions): APIPromise<ResponseOf<"searchQuestionnaire">>;
|
|
4344
4404
|
/**
|
|
4345
4405
|
* Search appointment slots
|
|
4346
4406
|
*
|
|
@@ -4348,7 +4408,7 @@ declare abstract class Operations extends Transport {
|
|
|
4348
4408
|
*
|
|
4349
4409
|
* `GET /v1/scheduling/slots`
|
|
4350
4410
|
*/
|
|
4351
|
-
searchSlots(params?: SearchSlotsParams, options?: RequestOptions):
|
|
4411
|
+
searchSlots(params?: SearchSlotsParams, options?: RequestOptions): APIPromise<ResponseOf<"searchSlots">>;
|
|
4352
4412
|
/**
|
|
4353
4413
|
* Expand a value set
|
|
4354
4414
|
*
|
|
@@ -4356,7 +4416,7 @@ declare abstract class Operations extends Transport {
|
|
|
4356
4416
|
*
|
|
4357
4417
|
* `GET /v1/fhir/r4/ValueSet/$expand`
|
|
4358
4418
|
*/
|
|
4359
|
-
valueSetExpand(params?: ValueSetExpandParams, options?: RequestOptions):
|
|
4419
|
+
valueSetExpand(params?: ValueSetExpandParams, options?: RequestOptions): APIPromise<ResponseOf<"valueSetExpand">>;
|
|
4360
4420
|
/**
|
|
4361
4421
|
* Expand a value set
|
|
4362
4422
|
*
|
|
@@ -4364,7 +4424,7 @@ declare abstract class Operations extends Transport {
|
|
|
4364
4424
|
*
|
|
4365
4425
|
* `POST /v1/fhir/r4/ValueSet/$expand`
|
|
4366
4426
|
*/
|
|
4367
|
-
valueSetExpandPost(body: BodyOf<"valueSetExpandPost">, options?: RequestOptions):
|
|
4427
|
+
valueSetExpandPost(body: BodyOf<"valueSetExpandPost">, options?: RequestOptions): APIPromise<ResponseOf<"valueSetExpandPost">>;
|
|
4368
4428
|
/**
|
|
4369
4429
|
* Validate a code against a value set
|
|
4370
4430
|
*
|
|
@@ -4372,7 +4432,7 @@ declare abstract class Operations extends Transport {
|
|
|
4372
4432
|
*
|
|
4373
4433
|
* `GET /v1/fhir/r4/ValueSet/$validate-code`
|
|
4374
4434
|
*/
|
|
4375
|
-
valueSetValidateCode(params: ValueSetValidateCodeParams, options?: RequestOptions):
|
|
4435
|
+
valueSetValidateCode(params: ValueSetValidateCodeParams, options?: RequestOptions): APIPromise<ResponseOf<"valueSetValidateCode">>;
|
|
4376
4436
|
/**
|
|
4377
4437
|
* Validate a code against a value set
|
|
4378
4438
|
*
|
|
@@ -4380,7 +4440,7 @@ declare abstract class Operations extends Transport {
|
|
|
4380
4440
|
*
|
|
4381
4441
|
* `POST /v1/fhir/r4/ValueSet/$validate-code`
|
|
4382
4442
|
*/
|
|
4383
|
-
valueSetValidateCodePost(body: BodyOf<"valueSetValidateCodePost">, options?: RequestOptions):
|
|
4443
|
+
valueSetValidateCodePost(body: BodyOf<"valueSetValidateCodePost">, options?: RequestOptions): APIPromise<ResponseOf<"valueSetValidateCodePost">>;
|
|
4384
4444
|
}
|
|
4385
4445
|
//#endregion
|
|
4386
4446
|
//#region src/client.d.ts
|
|
@@ -4423,8 +4483,8 @@ export declare class Haau3 extends Operations {
|
|
|
4423
4483
|
* - `rate-limited`: the API answered 429. `retryAfter` says when to try again.
|
|
4424
4484
|
* - `unavailable`: the API, or a source it reads, could not answer (502, 503).
|
|
4425
4485
|
* - `server-error`: the API failed (500).
|
|
4426
|
-
* - `unreadable`: the API answered with something that is not an answer
|
|
4427
|
-
*
|
|
4486
|
+
* - `unreadable`: the API answered with something that is not an answer: a body that is not JSON,
|
|
4487
|
+
* or a FHIR resource of another type than the operation answers with.
|
|
4428
4488
|
*/
|
|
4429
4489
|
type NoAnswerReason = "timeout" | "network" | "rate-limited" | "unavailable" | "server-error" | "unreadable";
|
|
4430
4490
|
/** What every error this package throws has. */
|
|
@@ -4442,15 +4502,24 @@ type AnswerBody = {
|
|
|
4442
4502
|
kind: "problem";
|
|
4443
4503
|
value: Problem;
|
|
4444
4504
|
};
|
|
4505
|
+
/** How long an answered request took, and in how many attempts. */
|
|
4506
|
+
interface Timing {
|
|
4507
|
+
attempts: number;
|
|
4508
|
+
durationMs: number;
|
|
4509
|
+
}
|
|
4445
4510
|
/** The API refused the key: none was sent, it is not one the API knows, or it was revoked (401, 403). */
|
|
4446
4511
|
export declare class AuthError extends Haau3Error {
|
|
4447
4512
|
name: string;
|
|
4448
4513
|
readonly status: number;
|
|
4514
|
+
/** How many attempts were made. */
|
|
4515
|
+
readonly attempts: number;
|
|
4516
|
+
/** Milliseconds from the first attempt to the answer. */
|
|
4517
|
+
readonly durationMs: number | undefined;
|
|
4449
4518
|
/** The OperationOutcome the FHIR base answered with. Not enumerable, so it is never printed. */
|
|
4450
4519
|
readonly outcome?: OperationOutcome;
|
|
4451
4520
|
/** The problem the other services answered with. Not enumerable, so it is never printed. */
|
|
4452
4521
|
readonly problem?: Problem;
|
|
4453
|
-
constructor(message: string, status: number, requestId?: string, body?: AnswerBody);
|
|
4522
|
+
constructor(message: string, status: number, requestId?: string, body?: AnswerBody, timing?: Timing);
|
|
4454
4523
|
}
|
|
4455
4524
|
/**
|
|
4456
4525
|
* The API answered and refused the request: a parameter it does not take, a record that does not
|
|
@@ -4460,11 +4529,15 @@ export declare class AuthError extends Haau3Error {
|
|
|
4460
4529
|
export declare class RefusedError extends Haau3Error {
|
|
4461
4530
|
name: string;
|
|
4462
4531
|
readonly status: number;
|
|
4532
|
+
/** How many attempts were made. */
|
|
4533
|
+
readonly attempts: number;
|
|
4534
|
+
/** Milliseconds from the first attempt to the answer. */
|
|
4535
|
+
readonly durationMs: number | undefined;
|
|
4463
4536
|
/** The OperationOutcome the FHIR base answered with. Not enumerable, so it is never printed. */
|
|
4464
4537
|
readonly outcome?: OperationOutcome;
|
|
4465
4538
|
/** The problem the other services answered with. Not enumerable, so it is never printed. */
|
|
4466
4539
|
readonly problem?: Problem;
|
|
4467
|
-
constructor(message: string, status: number, requestId?: string, body?: AnswerBody);
|
|
4540
|
+
constructor(message: string, status: number, requestId?: string, body?: AnswerBody, timing?: Timing);
|
|
4468
4541
|
}
|
|
4469
4542
|
/**
|
|
4470
4543
|
* The request got no answer, after every attempt the client was allowed. This never means "no
|
|
@@ -4479,6 +4552,8 @@ export declare class NoAnswerError extends Haau3Error {
|
|
|
4479
4552
|
readonly retryAfter: number | undefined;
|
|
4480
4553
|
/** How many attempts were made. */
|
|
4481
4554
|
readonly attempts: number;
|
|
4555
|
+
/** Milliseconds from the first attempt to the last failure, waits between attempts included. */
|
|
4556
|
+
readonly durationMs: number | undefined;
|
|
4482
4557
|
/** The OperationOutcome the FHIR base answered with. Not enumerable, so it is never printed. */
|
|
4483
4558
|
readonly outcome?: OperationOutcome;
|
|
4484
4559
|
/** The problem the other services answered with. Not enumerable, so it is never printed. */
|
|
@@ -4486,6 +4561,7 @@ export declare class NoAnswerError extends Haau3Error {
|
|
|
4486
4561
|
constructor(message: string, details: {
|
|
4487
4562
|
reason: NoAnswerReason;
|
|
4488
4563
|
attempts: number;
|
|
4564
|
+
durationMs?: number;
|
|
4489
4565
|
status?: number;
|
|
4490
4566
|
retryAfter?: number;
|
|
4491
4567
|
requestId?: string;
|
|
@@ -4496,6 +4572,6 @@ export declare class NoAnswerError extends Haau3Error {
|
|
|
4496
4572
|
//#endregion
|
|
4497
4573
|
//#region src/version.d.ts
|
|
4498
4574
|
/** This package's version, sent in the `User-Agent` header. A test holds it to package.json. */
|
|
4499
|
-
export declare const VERSION = "0.1
|
|
4575
|
+
export declare const VERSION = "0.2.1";
|
|
4500
4576
|
//#endregion
|
|
4501
|
-
export type { CheckInsurancePlanNetworkParams, ClientOptions, CodeSystemLookupParams, CodeSystemValidateCodeParams, FhirMetadataParams, ListInsurancePlanCountiesParams, ListPublishersResponse, ListServiceTypesParams, ListServiceTypesResponse, ListSpecialtiesParams, ListSpecialtiesResponse, NoAnswerReason, OperationId, Problem, ProblemIssue, QueryValue, RawRequest, RawResponse, RequestOptions, SchedulingProviderLocation, SchedulingPublisher, SchedulingServiceType, SchedulingSlot, SchedulingSpecialty, SearchEndpointParams, SearchHealthcareServiceParams, SearchInsurancePlanParams, SearchLocationParams, SearchOrganizationAffiliationParams, SearchOrganizationParams, SearchPractitionerParams, SearchPractitionerRoleParams, SearchProviderLocationsParams, SearchProviderLocationsResponse, SearchQuestionnaireParams, SearchSlotsParams, SearchSlotsResponse, ValueSetExpandParams, ValueSetValidateCodeParams, fhir4 };
|
|
4577
|
+
export type { CheckInsurancePlanNetworkParams, ClientOptions, CodeSystemLookupParams, CodeSystemValidateCodeParams, FetchOptions, FhirMetadataParams, ListInsurancePlanCountiesParams, ListPublishersResponse, ListServiceTypesParams, ListServiceTypesResponse, ListSpecialtiesParams, ListSpecialtiesResponse, NoAnswerReason, OperationId, Problem, ProblemIssue, QueryValue, RawRequest, RawResponse, RequestOptions, ResponseMeta, SchedulingProviderLocation, SchedulingPublisher, SchedulingServiceType, SchedulingSlot, SchedulingSpecialty, SearchEndpointParams, SearchHealthcareServiceParams, SearchInsurancePlanParams, SearchLocationParams, SearchOrganizationAffiliationParams, SearchOrganizationParams, SearchPractitionerParams, SearchPractitionerRoleParams, SearchProviderLocationsParams, SearchProviderLocationsResponse, SearchQuestionnaireParams, SearchSlotsParams, SearchSlotsResponse, ValueSetExpandParams, ValueSetValidateCodeParams, WithResponse, fhir4 };
|