@healthcloudai/hc-sdk 0.8.5 → 0.8.9

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 CHANGED
@@ -125,7 +125,7 @@ sdk.ehr // connect + low-level request escape hatch
125
125
  sdk.appointments // connect + low-level request escape hatch
126
126
  sdk.rppg // connect + low-level request escape hatch
127
127
  sdk.session // connect + low-level request escape hatch
128
- sdk.telehealth // connect + low-level request escape hatch
128
+ sdk.telehealth // connect, createChannel, createPatientToken, createProviderToken, fetchRtcToken
129
129
  sdk.fieldAgent // connect, register/login/resetPassword/verifyEmail/verifySms,
130
130
  // getAgent/updateAgent, getDashboard, photo, listPatients, listEncounters
131
131
  sdk.mcp // connect + JSON-RPC proxy (patient/fieldAgent tool calls)
@@ -143,6 +143,35 @@ instances.
143
143
 
144
144
  All groups share one HTTP client, one token store, one error handler, the same URL resolver, query serialiser, and path-param interpolator.
145
145
 
146
+ ### Telehealth helpers
147
+
148
+ The telehealth client exposes the backend's channel and RTC-token routes:
149
+
150
+ ```ts
151
+ const sdk = new HCSDK({
152
+ environment: "dev",
153
+ accessToken: "patient-or-provider-token",
154
+ });
155
+
156
+ const channel = await sdk.telehealth.createChannel();
157
+
158
+ const patientToken = await sdk.telehealth.createPatientToken({
159
+ channel_id: channel.channel_id,
160
+ uid: 101,
161
+ });
162
+
163
+ const providerToken = await sdk.telehealth.createProviderToken({
164
+ channel_id: channel.channel_id,
165
+ uid: 202,
166
+ });
167
+ ```
168
+
169
+ Authentication notes:
170
+ - `createPatientToken()` requires a patient-scoped bearer token and is intended for patient-side video sessions.
171
+ - `createProviderToken()` requires a provider-scoped bearer token and is intended for clinician-side video sessions.
172
+ - `createChannel()` and `fetchRtcToken()` do not require the same role-specific token semantics as the minting methods, but they still use the shared SDK auth flow.
173
+ - If you are using a legacy integration, `fetchRtcToken()` accepts the older `{ channel_name, uid, role }` payload and returns the compatibility response.
174
+
146
175
  ---
147
176
 
148
177
  ## Connectors (`sdk.connectors`)
@@ -1217,7 +1246,8 @@ const agent = await sdk.fieldAgent.getAgent(cognitoSub);
1217
1246
  "tenant_id": "cdcprotect", "email": "agent@example.com",
1218
1247
  "first_name": "Field", "last_name": "Agent", "title": null, "phone": null,
1219
1248
  "badge_number": "FA-001", "license_number": null, "department": "QA",
1220
- "organization": null, "address_street1": null, "address_state": null,
1249
+ "organization": null,
1250
+ "addresses": [],
1221
1251
  "status": "active"
1222
1252
  }
1223
1253
  ```
package/dist/index.cjs CHANGED
@@ -310,6 +310,15 @@ var AppointmentsClient = class extends BaseServiceClient {
310
310
  query
311
311
  });
312
312
  }
313
+ /**
314
+ * Create a slot.
315
+ * POST /slots
316
+ */
317
+ createSlot(request) {
318
+ return this.send("POST", "/slots", {
319
+ body: request
320
+ });
321
+ }
313
322
  // ─── Appointments ────────────────────────────────────────────────────
314
323
  /**
315
324
  * Book an appointment for a specific slot.
@@ -484,7 +493,7 @@ var FieldAgentClient = class extends BaseServiceClient {
484
493
  }
485
494
  register(request) {
486
495
  return this.send("POST", "/auth/register", {
487
- body: withTenantId(request, this.getTenantId()),
496
+ body: withTenantId({ ...request, person_type: "field_agent" }, this.getTenantId()),
488
497
  auth: false
489
498
  });
490
499
  }
@@ -526,37 +535,37 @@ var FieldAgentClient = class extends BaseServiceClient {
526
535
  auth: false
527
536
  });
528
537
  }
529
- getAgent(agentSub) {
530
- return this.send("GET", "/agents/{sub}", {
531
- pathParams: { sub: agentSub }
538
+ getAgent(fhirPersonId) {
539
+ return this.send("GET", "/agents/{fhir_person_id}", {
540
+ pathParams: { fhir_person_id: fhirPersonId }
532
541
  });
533
542
  }
534
- updateAgent(agentSub, request) {
535
- return this.send("PATCH", "/agents/{sub}", {
536
- pathParams: { sub: agentSub },
543
+ updateAgent(fhirPersonId, request) {
544
+ return this.send("PATCH", "/agents/{fhir_person_id}", {
545
+ pathParams: { fhir_person_id: fhirPersonId },
537
546
  body: request
538
547
  });
539
548
  }
540
- getDashboard(agentSub, query) {
541
- return this.send("GET", "/agents/{sub}/dashboard", {
542
- pathParams: { sub: agentSub },
549
+ getDashboard(fhirPersonId, query) {
550
+ return this.send("GET", "/agents/{fhir_person_id}/dashboard", {
551
+ pathParams: { fhir_person_id: fhirPersonId },
543
552
  query
544
553
  });
545
554
  }
546
- getPhotoUploadUrl(agentSub) {
547
- return this.send("GET", "/agents/{sub}/photo/upload-url", {
548
- pathParams: { sub: agentSub }
555
+ getPhotoUploadUrl(fhirPersonId) {
556
+ return this.send("GET", "/agents/{fhir_person_id}/photo/upload-url", {
557
+ pathParams: { fhir_person_id: fhirPersonId }
549
558
  });
550
559
  }
551
- uploadPhoto(agentSub, request) {
552
- return this.send("POST", "/agents/{sub}/photo", {
553
- pathParams: { sub: agentSub },
560
+ uploadPhoto(fhirPersonId, request) {
561
+ return this.send("POST", "/agents/{fhir_person_id}/photo", {
562
+ pathParams: { fhir_person_id: fhirPersonId },
554
563
  body: request
555
564
  });
556
565
  }
557
- getPhoto(agentSub, query) {
558
- return this.send("GET", "/agents/{sub}/photo", {
559
- pathParams: { sub: agentSub },
566
+ getPhoto(fhirPersonId, query) {
567
+ return this.send("GET", "/agents/{fhir_person_id}/photo", {
568
+ pathParams: { fhir_person_id: fhirPersonId },
560
569
  query
561
570
  });
562
571
  }
@@ -669,6 +678,11 @@ var PatientClient = class extends BaseServiceClient {
669
678
  body: request
670
679
  });
671
680
  }
681
+ listPatientInsurances(fhirPatientId) {
682
+ return this.send("GET", "/patients/{id}/insurance", {
683
+ pathParams: { id: fhirPatientId }
684
+ });
685
+ }
672
686
  createMedication(fhirPatientId, request) {
673
687
  return this.send("POST", "/patients/{id}/medications", {
674
688
  pathParams: { id: fhirPatientId },
@@ -1019,6 +1033,18 @@ var TelehealthClient = class extends BaseServiceClient {
1019
1033
  connect() {
1020
1034
  return this.connectService();
1021
1035
  }
1036
+ createChannel() {
1037
+ return this.send("POST", "/telehealth/channels");
1038
+ }
1039
+ createPatientToken(request) {
1040
+ return this.send("POST", "/telehealth/tokens/patient", { body: request });
1041
+ }
1042
+ createProviderToken(request) {
1043
+ return this.send("POST", "/telehealth/tokens/provider", { body: request });
1044
+ }
1045
+ fetchRtcToken(request) {
1046
+ return this.send("POST", "/fetch_rtc_token", { body: request });
1047
+ }
1022
1048
  };
1023
1049
 
1024
1050
  // src/clients/VitalsClient.ts