@gpt-platform/client 0.10.5 → 0.11.0
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/dist/_internal/client/client.gen.d.ts +3 -0
- package/dist/_internal/client/client.gen.d.ts.map +1 -0
- package/dist/_internal/client/index.d.ts +9 -0
- package/dist/_internal/client/index.d.ts.map +1 -0
- package/dist/_internal/client/types.gen.d.ts +118 -0
- package/dist/_internal/client/types.gen.d.ts.map +1 -0
- package/dist/_internal/client/utils.gen.d.ts +34 -0
- package/dist/_internal/client/utils.gen.d.ts.map +1 -0
- package/dist/_internal/client.gen.d.ts +13 -0
- package/dist/_internal/client.gen.d.ts.map +1 -0
- package/dist/_internal/core/auth.gen.d.ts +19 -0
- package/dist/_internal/core/auth.gen.d.ts.map +1 -0
- package/dist/_internal/core/bodySerializer.gen.d.ts +26 -0
- package/dist/_internal/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/_internal/core/params.gen.d.ts +44 -0
- package/dist/_internal/core/params.gen.d.ts.map +1 -0
- package/dist/_internal/core/pathSerializer.gen.d.ts +34 -0
- package/dist/_internal/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/_internal/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/_internal/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/_internal/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/_internal/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/_internal/core/types.gen.d.ts +79 -0
- package/dist/_internal/core/types.gen.d.ts.map +1 -0
- package/dist/_internal/core/utils.gen.d.ts +20 -0
- package/dist/_internal/core/utils.gen.d.ts.map +1 -0
- package/dist/_internal/index.d.ts +3 -0
- package/dist/_internal/index.d.ts.map +1 -0
- package/dist/_internal/sdk.gen.d.ts +7053 -0
- package/dist/_internal/sdk.gen.d.ts.map +1 -0
- package/dist/_internal/types.gen.d.ts +146633 -0
- package/dist/_internal/types.gen.d.ts.map +1 -0
- package/dist/base-client.d.ts +199 -0
- package/dist/base-client.d.ts.map +1 -0
- package/dist/errors/index.d.ts +128 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/events.d.ts +69 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/execution-events.d.ts +95 -0
- package/dist/execution-events.d.ts.map +1 -0
- package/dist/gpt-client.d.ts +2175 -0
- package/dist/gpt-client.d.ts.map +1 -0
- package/dist/index.d.ts +51 -30734
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +311 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +311 -4
- package/dist/index.mjs.map +1 -1
- package/dist/json-api.d.ts +26 -0
- package/dist/json-api.d.ts.map +1 -0
- package/dist/logging.d.ts +22 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/namespace-types.d.ts +79 -0
- package/dist/namespace-types.d.ts.map +1 -0
- package/dist/namespaces/access-grants.d.ts +71 -0
- package/dist/namespaces/access-grants.d.ts.map +1 -0
- package/dist/namespaces/agents.d.ts +1406 -0
- package/dist/namespaces/agents.d.ts.map +1 -0
- package/dist/namespaces/ai.d.ts +407 -0
- package/dist/namespaces/ai.d.ts.map +1 -0
- package/dist/namespaces/audit.d.ts +83 -0
- package/dist/namespaces/audit.d.ts.map +1 -0
- package/dist/namespaces/billing.d.ts +854 -0
- package/dist/namespaces/billing.d.ts.map +1 -0
- package/dist/namespaces/campaigns.d.ts +973 -0
- package/dist/namespaces/campaigns.d.ts.map +1 -0
- package/dist/namespaces/catalog.d.ts +964 -0
- package/dist/namespaces/catalog.d.ts.map +1 -0
- package/dist/namespaces/channels.d.ts +162 -0
- package/dist/namespaces/channels.d.ts.map +1 -0
- package/dist/namespaces/clinical.d.ts +2443 -0
- package/dist/namespaces/clinical.d.ts.map +1 -0
- package/dist/namespaces/communication.d.ts +439 -0
- package/dist/namespaces/communication.d.ts.map +1 -0
- package/dist/namespaces/compliance.d.ts +2310 -0
- package/dist/namespaces/compliance.d.ts.map +1 -0
- package/dist/namespaces/connectors.d.ts +1368 -0
- package/dist/namespaces/connectors.d.ts.map +1 -0
- package/dist/namespaces/content.d.ts +188 -0
- package/dist/namespaces/content.d.ts.map +1 -0
- package/dist/namespaces/crawler.d.ts +408 -0
- package/dist/namespaces/crawler.d.ts.map +1 -0
- package/dist/namespaces/crm-clusters.d.ts +31 -0
- package/dist/namespaces/crm-clusters.d.ts.map +1 -0
- package/dist/namespaces/crm.d.ts +1539 -0
- package/dist/namespaces/crm.d.ts.map +1 -0
- package/dist/namespaces/documents.d.ts +136 -0
- package/dist/namespaces/documents.d.ts.map +1 -0
- package/dist/namespaces/email.d.ts +550 -0
- package/dist/namespaces/email.d.ts.map +1 -0
- package/dist/namespaces/extraction.d.ts +1249 -0
- package/dist/namespaces/extraction.d.ts.map +1 -0
- package/dist/namespaces/identity.d.ts +411 -0
- package/dist/namespaces/identity.d.ts.map +1 -0
- package/dist/namespaces/imports.d.ts +177 -0
- package/dist/namespaces/imports.d.ts.map +1 -0
- package/dist/namespaces/index.d.ts +119 -0
- package/dist/namespaces/index.d.ts.map +1 -0
- package/dist/namespaces/memory.d.ts +105 -0
- package/dist/namespaces/memory.d.ts.map +1 -0
- package/dist/namespaces/models.d.ts +75 -0
- package/dist/namespaces/models.d.ts.map +1 -0
- package/dist/namespaces/permissions.d.ts +75 -0
- package/dist/namespaces/permissions.d.ts.map +1 -0
- package/dist/namespaces/pipeline-executions.d.ts +130 -0
- package/dist/namespaces/pipeline-executions.d.ts.map +1 -0
- package/dist/namespaces/pipelines.d.ts +120 -0
- package/dist/namespaces/pipelines.d.ts.map +1 -0
- package/dist/namespaces/platform.d.ts +1430 -0
- package/dist/namespaces/platform.d.ts.map +1 -0
- package/dist/namespaces/portal.d.ts +198 -0
- package/dist/namespaces/portal.d.ts.map +1 -0
- package/dist/namespaces/projects.d.ts +553 -0
- package/dist/namespaces/projects.d.ts.map +1 -0
- package/dist/namespaces/roles.d.ts +65 -0
- package/dist/namespaces/roles.d.ts.map +1 -0
- package/dist/namespaces/scheduling.d.ts +944 -0
- package/dist/namespaces/scheduling.d.ts.map +1 -0
- package/dist/namespaces/search.d.ts +224 -0
- package/dist/namespaces/search.d.ts.map +1 -0
- package/dist/namespaces/session-notes.d.ts +67 -0
- package/dist/namespaces/session-notes.d.ts.map +1 -0
- package/dist/namespaces/social.d.ts +330 -0
- package/dist/namespaces/social.d.ts.map +1 -0
- package/dist/namespaces/storage.d.ts +378 -0
- package/dist/namespaces/storage.d.ts.map +1 -0
- package/dist/namespaces/support.d.ts +427 -0
- package/dist/namespaces/support.d.ts.map +1 -0
- package/dist/namespaces/threads.d.ts +596 -0
- package/dist/namespaces/threads.d.ts.map +1 -0
- package/dist/namespaces/training.d.ts +358 -0
- package/dist/namespaces/training.d.ts.map +1 -0
- package/dist/namespaces/voice.d.ts +752 -0
- package/dist/namespaces/voice.d.ts.map +1 -0
- package/dist/namespaces/watcher.d.ts +425 -0
- package/dist/namespaces/watcher.d.ts.map +1 -0
- package/dist/namespaces/webhooks-ns.d.ts +3 -0
- package/dist/namespaces/webhooks-ns.d.ts.map +1 -0
- package/dist/pagination.d.ts +57 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/request-builder.d.ts +95 -0
- package/dist/request-builder.d.ts.map +1 -0
- package/dist/security.d.ts +32 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/streaming.d.ts +135 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/utils/retry.d.ts +63 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/webhook-signature.d.ts +109 -0
- package/dist/webhook-signature.d.ts.map +1 -0
- package/llms.txt +7 -1
- package/package.json +286 -36
- package/dist/index.d.mts +0 -30734
|
@@ -0,0 +1,1368 @@
|
|
|
1
|
+
import type { ConnectorInstance, Credential } from "../_internal/types.gen";
|
|
2
|
+
/** Attributes accepted when creating a new connector instance. */
|
|
3
|
+
export type CreateConnectorInstanceAttributes = {
|
|
4
|
+
connector_type: string;
|
|
5
|
+
name: string;
|
|
6
|
+
workspace_id: string;
|
|
7
|
+
base_url?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
/** Attributes accepted when updating a connector instance (PATCH semantics). */
|
|
11
|
+
export type UpdateConnectorInstanceAttributes = {
|
|
12
|
+
name?: string;
|
|
13
|
+
base_url?: string;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
import type { RequestOptions } from "../base-client";
|
|
17
|
+
import { RequestBuilder } from "../request-builder";
|
|
18
|
+
/**
|
|
19
|
+
* Result returned by `oauth.connect()` — contains the URL to redirect the
|
|
20
|
+
* user to for provider authorization and the CSRF-protection state token.
|
|
21
|
+
*/
|
|
22
|
+
export interface OAuthInitiateResult {
|
|
23
|
+
auth_url: string;
|
|
24
|
+
state: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A patient record as represented in Fullscript.
|
|
28
|
+
* Returned by `fullscript.checkPatient` and `fullscript.createPatient`.
|
|
29
|
+
*/
|
|
30
|
+
export interface FullscriptPatient {
|
|
31
|
+
id: string;
|
|
32
|
+
email: string;
|
|
33
|
+
first_name: string;
|
|
34
|
+
last_name: string;
|
|
35
|
+
date_of_birth?: string;
|
|
36
|
+
fullscript_id?: string;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A recipe record as returned by the Edamam Recipe API.
|
|
41
|
+
* Returned by `edamam.recipes.search` (as `hits` items) and
|
|
42
|
+
* `edamam.recipes.get` (as `recipe`).
|
|
43
|
+
*/
|
|
44
|
+
export interface EdamamRecipe {
|
|
45
|
+
uri: string;
|
|
46
|
+
label: string;
|
|
47
|
+
image?: string;
|
|
48
|
+
source?: string;
|
|
49
|
+
url?: string;
|
|
50
|
+
yield?: number;
|
|
51
|
+
dietLabels?: string[];
|
|
52
|
+
healthLabels?: string[];
|
|
53
|
+
ingredientLines?: string[];
|
|
54
|
+
calories?: number;
|
|
55
|
+
totalTime?: number;
|
|
56
|
+
cuisineType?: string[];
|
|
57
|
+
mealType?: string[];
|
|
58
|
+
dishType?: string[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Parameters for `edamam.recipes.search()`.
|
|
62
|
+
*/
|
|
63
|
+
export interface EdamamSearchParams {
|
|
64
|
+
query: string;
|
|
65
|
+
health?: string[];
|
|
66
|
+
diet?: string[];
|
|
67
|
+
from?: number;
|
|
68
|
+
to?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Result shape returned by `edamam.recipes.search()`.
|
|
72
|
+
*/
|
|
73
|
+
export interface EdamamSearchResult {
|
|
74
|
+
hits: EdamamRecipe[];
|
|
75
|
+
count: number;
|
|
76
|
+
next_page?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A short-lived embed session grant for the Fullscript prescribing widget.
|
|
80
|
+
* Returned by `fullscript.sessionGrant()`.
|
|
81
|
+
*/
|
|
82
|
+
export interface FullscriptSessionGrant {
|
|
83
|
+
token: string;
|
|
84
|
+
expires_at: string;
|
|
85
|
+
patient_id: string;
|
|
86
|
+
}
|
|
87
|
+
export interface FullscriptTreatmentPlan {
|
|
88
|
+
id: string;
|
|
89
|
+
state: string;
|
|
90
|
+
patient_id?: string;
|
|
91
|
+
created_at?: string;
|
|
92
|
+
updated_at?: string;
|
|
93
|
+
invitation_url?: string;
|
|
94
|
+
message?: string;
|
|
95
|
+
recommendations?: Array<{
|
|
96
|
+
product_id?: string;
|
|
97
|
+
product_name?: string;
|
|
98
|
+
variant_id?: string;
|
|
99
|
+
dosage?: string;
|
|
100
|
+
frequency?: string;
|
|
101
|
+
units_to_purchase?: number;
|
|
102
|
+
}>;
|
|
103
|
+
[key: string]: unknown;
|
|
104
|
+
}
|
|
105
|
+
export interface FullscriptProduct {
|
|
106
|
+
id: string;
|
|
107
|
+
name?: string;
|
|
108
|
+
brand?: string;
|
|
109
|
+
description?: string;
|
|
110
|
+
image_url?: string;
|
|
111
|
+
product_url?: string;
|
|
112
|
+
variants?: Array<{
|
|
113
|
+
id?: string;
|
|
114
|
+
name?: string;
|
|
115
|
+
dosage_form?: string;
|
|
116
|
+
size?: string;
|
|
117
|
+
price?: string;
|
|
118
|
+
msrp?: string;
|
|
119
|
+
sku?: string;
|
|
120
|
+
}>;
|
|
121
|
+
categories?: string[];
|
|
122
|
+
allergens?: string[];
|
|
123
|
+
third_party_certifications?: string[];
|
|
124
|
+
[key: string]: unknown;
|
|
125
|
+
}
|
|
126
|
+
export interface FullscriptOrder {
|
|
127
|
+
id: string;
|
|
128
|
+
state?: string;
|
|
129
|
+
created_at?: string;
|
|
130
|
+
updated_at?: string;
|
|
131
|
+
line_items?: Array<{
|
|
132
|
+
product_id?: string;
|
|
133
|
+
product_name?: string;
|
|
134
|
+
variant_id?: string;
|
|
135
|
+
quantity?: number;
|
|
136
|
+
price?: string;
|
|
137
|
+
}>;
|
|
138
|
+
item_total?: string;
|
|
139
|
+
payment_total?: string;
|
|
140
|
+
msrp_total?: string;
|
|
141
|
+
shipping_total?: string;
|
|
142
|
+
patient_id?: string;
|
|
143
|
+
[key: string]: unknown;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* A patient record from Healthie EHR.
|
|
147
|
+
* Returned by `healthie.listPatients` and synced via `healthie.syncPatients`.
|
|
148
|
+
*/
|
|
149
|
+
export interface HealthiePatient {
|
|
150
|
+
id: string;
|
|
151
|
+
first_name: string;
|
|
152
|
+
last_name: string;
|
|
153
|
+
email: string;
|
|
154
|
+
phone_number?: string;
|
|
155
|
+
dob?: string;
|
|
156
|
+
gender?: string;
|
|
157
|
+
height?: number;
|
|
158
|
+
weight?: number;
|
|
159
|
+
diet_type?: string;
|
|
160
|
+
food_allergies?: string[];
|
|
161
|
+
metadata?: Record<string, unknown>;
|
|
162
|
+
[key: string]: unknown;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* An appointment record from Healthie EHR.
|
|
166
|
+
* Returned by `healthie.listAppointments` and synced via `healthie.syncAppointments`.
|
|
167
|
+
*/
|
|
168
|
+
export interface HealthieAppointment {
|
|
169
|
+
id: string;
|
|
170
|
+
date: string;
|
|
171
|
+
start: string;
|
|
172
|
+
end: string;
|
|
173
|
+
notes?: string;
|
|
174
|
+
location?: string;
|
|
175
|
+
status: string;
|
|
176
|
+
appointment_type: {
|
|
177
|
+
name: string;
|
|
178
|
+
};
|
|
179
|
+
user: {
|
|
180
|
+
id: string;
|
|
181
|
+
};
|
|
182
|
+
[key: string]: unknown;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Sync status for Healthie connector.
|
|
186
|
+
* Returned by `healthie.getSyncStatus`.
|
|
187
|
+
*/
|
|
188
|
+
export interface HealthieSyncStatus {
|
|
189
|
+
last_synced_at: string | null;
|
|
190
|
+
patient_count: number;
|
|
191
|
+
appointment_count: number;
|
|
192
|
+
errors: string[];
|
|
193
|
+
status: "completed" | "failed" | "in_progress" | "never_synced";
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Result returned by `healthie.syncPatients` and `healthie.syncAppointments`.
|
|
197
|
+
*/
|
|
198
|
+
export interface HealthieSyncResult {
|
|
199
|
+
synced: number;
|
|
200
|
+
errors: string[];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Result returned by `healthie.syncAll`.
|
|
204
|
+
*/
|
|
205
|
+
export interface HealthieSyncAllResult {
|
|
206
|
+
patients_synced: number;
|
|
207
|
+
appointments_synced: number;
|
|
208
|
+
errors: string[];
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Parameters for listing Healthie records with date filter.
|
|
212
|
+
*/
|
|
213
|
+
export interface HealthieListOptions {
|
|
214
|
+
since?: Date;
|
|
215
|
+
}
|
|
216
|
+
export interface CreateTreatmentPlanAttributes {
|
|
217
|
+
patient_id: string;
|
|
218
|
+
recommendations: Array<{
|
|
219
|
+
product_id: string;
|
|
220
|
+
variant_id?: string;
|
|
221
|
+
dosage?: string;
|
|
222
|
+
frequency?: string;
|
|
223
|
+
units_to_purchase?: number;
|
|
224
|
+
}>;
|
|
225
|
+
send_invitation?: boolean;
|
|
226
|
+
message?: string;
|
|
227
|
+
}
|
|
228
|
+
export interface ProductMatchQuery {
|
|
229
|
+
name: string;
|
|
230
|
+
form?: string;
|
|
231
|
+
dosage?: string;
|
|
232
|
+
}
|
|
233
|
+
export interface ProductMatchResult {
|
|
234
|
+
query: string;
|
|
235
|
+
matches: FullscriptProduct[];
|
|
236
|
+
}
|
|
237
|
+
/** Attributes for upserting connector credentials. */
|
|
238
|
+
export type UpsertCredentialAttributes = {
|
|
239
|
+
workspace_id: string;
|
|
240
|
+
connector_type: string;
|
|
241
|
+
auth_type: string;
|
|
242
|
+
auth_data: Record<string, unknown>;
|
|
243
|
+
scope_level: string;
|
|
244
|
+
};
|
|
245
|
+
/** @public Action-specific parameters passed to the sync engine (e.g., cursor, filter criteria). */
|
|
246
|
+
export interface SyncActionParams {
|
|
247
|
+
[key: string]: unknown;
|
|
248
|
+
}
|
|
249
|
+
/** Parameters for triggering a connector sync. */
|
|
250
|
+
export type TriggerSyncParams = {
|
|
251
|
+
workspace_id: string;
|
|
252
|
+
action_name: "full" | "incremental" | "webhook" | "manual";
|
|
253
|
+
params?: SyncActionParams;
|
|
254
|
+
};
|
|
255
|
+
/** Result returned by sync trigger. */
|
|
256
|
+
export interface SyncTriggerResult {
|
|
257
|
+
sync_log_id: string;
|
|
258
|
+
status: string;
|
|
259
|
+
}
|
|
260
|
+
/** A sync execution log record. */
|
|
261
|
+
export interface SyncLog {
|
|
262
|
+
id: string;
|
|
263
|
+
type: string;
|
|
264
|
+
attributes?: {
|
|
265
|
+
connector_instance_id?: string;
|
|
266
|
+
sync_type?: string;
|
|
267
|
+
status?: string;
|
|
268
|
+
started_at?: string;
|
|
269
|
+
completed_at?: string;
|
|
270
|
+
records_processed?: number;
|
|
271
|
+
records_created?: number;
|
|
272
|
+
records_updated?: number;
|
|
273
|
+
records_failed?: number;
|
|
274
|
+
error_message?: string;
|
|
275
|
+
metadata?: Record<string, unknown>;
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
/** Parameters for pushing a note to Practice Better. */
|
|
279
|
+
export type PBPushNoteParams = {
|
|
280
|
+
workspace_id: string;
|
|
281
|
+
contact_id: string;
|
|
282
|
+
note_content: string;
|
|
283
|
+
note_type?: string;
|
|
284
|
+
title?: string;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Healthie EHR connector namespace methods.
|
|
288
|
+
*
|
|
289
|
+
* All methods require valid `connectorId` and `workspaceId` from an active Healthie connector.
|
|
290
|
+
*/
|
|
291
|
+
export interface HealthieNamespace {
|
|
292
|
+
/**
|
|
293
|
+
* List all patients from Healthie.
|
|
294
|
+
*
|
|
295
|
+
* @param connectorId - The UUID of the Healthie connector instance.
|
|
296
|
+
* @param workspaceId - The workspace ID for scoping.
|
|
297
|
+
* @param options - Optional filters including `since` date for incremental sync.
|
|
298
|
+
* @returns Array of Healthie patient records.
|
|
299
|
+
*/
|
|
300
|
+
listPatients(connectorId: string, workspaceId: string, options?: HealthieListOptions & RequestOptions): Promise<HealthiePatient[]>;
|
|
301
|
+
/**
|
|
302
|
+
* Sync patients from Healthie to platform.
|
|
303
|
+
*
|
|
304
|
+
* Creates/updates: Contact, DietaryProfile, HealthMetric, Patient records.
|
|
305
|
+
* Returns sync summary with count and errors.
|
|
306
|
+
*
|
|
307
|
+
* @param connectorId - The UUID of the Healthie connector instance.
|
|
308
|
+
* @param workspaceId - The workspace ID for scoping.
|
|
309
|
+
* @param options - Optional request options.
|
|
310
|
+
* @returns Sync summary with `synced` count and `errors` array.
|
|
311
|
+
*/
|
|
312
|
+
syncPatients(connectorId: string, workspaceId: string, options?: RequestOptions): Promise<HealthieSyncResult>;
|
|
313
|
+
/**
|
|
314
|
+
* List all appointments from Healthie.
|
|
315
|
+
*
|
|
316
|
+
* @param connectorId - The UUID of the Healthie connector instance.
|
|
317
|
+
* @param workspaceId - The workspace ID for scoping.
|
|
318
|
+
* @param options - Optional filters including `since` date for incremental sync.
|
|
319
|
+
* @returns Array of Healthie appointment records.
|
|
320
|
+
*/
|
|
321
|
+
listAppointments(connectorId: string, workspaceId: string, options?: HealthieListOptions & RequestOptions): Promise<HealthieAppointment[]>;
|
|
322
|
+
/**
|
|
323
|
+
* Sync appointments from Healthie to platform.
|
|
324
|
+
*
|
|
325
|
+
* Creates ClinicalSession records linked to Patients.
|
|
326
|
+
* Returns sync summary with count and errors.
|
|
327
|
+
*
|
|
328
|
+
* @param connectorId - The UUID of the Healthie connector instance.
|
|
329
|
+
* @param workspaceId - The workspace ID for scoping.
|
|
330
|
+
* @param options - Optional request options.
|
|
331
|
+
* @returns Sync summary with `synced` count and `errors` array.
|
|
332
|
+
*/
|
|
333
|
+
syncAppointments(connectorId: string, workspaceId: string, options?: RequestOptions): Promise<HealthieSyncResult>;
|
|
334
|
+
/**
|
|
335
|
+
* Sync all Healthie data (patients + appointments).
|
|
336
|
+
*
|
|
337
|
+
* Combined sync operation that processes both patients and appointments.
|
|
338
|
+
* Returns combined sync summary.
|
|
339
|
+
*
|
|
340
|
+
* @param connectorId - The UUID of the Healthie connector instance.
|
|
341
|
+
* @param workspaceId - The workspace ID for scoping.
|
|
342
|
+
* @param options - Optional request options.
|
|
343
|
+
* @returns Combined sync summary with both patient and appointment counts.
|
|
344
|
+
*/
|
|
345
|
+
syncAll(connectorId: string, workspaceId: string, options?: RequestOptions): Promise<HealthieSyncAllResult>;
|
|
346
|
+
/**
|
|
347
|
+
* Get current sync status for Healthie connector.
|
|
348
|
+
*
|
|
349
|
+
* Returns status from most recent sync operation including timestamps,
|
|
350
|
+
* record counts, and any errors.
|
|
351
|
+
*
|
|
352
|
+
* @param connectorId - The UUID of the Healthie connector instance.
|
|
353
|
+
* @param workspaceId - The workspace ID for scoping.
|
|
354
|
+
* @param options - Optional request options.
|
|
355
|
+
* @returns Sync status with last sync time and record counts.
|
|
356
|
+
*/
|
|
357
|
+
getStatus(connectorId: string, workspaceId: string, options?: RequestOptions): Promise<HealthieSyncStatus>;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Connectors namespace for external system integrations (Salesforce, SharePoint,
|
|
361
|
+
* Slack, HubSpot, Edamam, Fullscript, and more).
|
|
362
|
+
*
|
|
363
|
+
* Access via `client.connectors`.
|
|
364
|
+
*
|
|
365
|
+
* The connectors system is organized into three layers:
|
|
366
|
+
* 1. **Instances** — configured connections to external systems.
|
|
367
|
+
* 2. **Credentials** — OAuth tokens and API keys that authenticate those connections.
|
|
368
|
+
* 3. **Provider sub-namespaces** — Edamam, Fullscript — typed wrappers for
|
|
369
|
+
* provider-specific operations that go beyond generic CRUD.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```typescript
|
|
373
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
374
|
+
*
|
|
375
|
+
* // Initiate OAuth for Salesforce
|
|
376
|
+
* const { auth_url } = await client.connectors.oauth.connect('salesforce', workspaceId);
|
|
377
|
+
* window.location.href = auth_url;
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
export declare function createConnectorsNamespace(rb: RequestBuilder): {
|
|
381
|
+
/**
|
|
382
|
+
* Connector Instances — configured external system connections in the workspace.
|
|
383
|
+
*
|
|
384
|
+
* A `ConnectorInstance` represents a live, configured connection to a specific
|
|
385
|
+
* external system (e.g., a Salesforce org, a specific SharePoint site). Instances
|
|
386
|
+
* hold configuration like display name, connector type, and status. Credentials
|
|
387
|
+
* (OAuth tokens, API keys) are stored separately in `credentials`.
|
|
388
|
+
*/
|
|
389
|
+
instances: {
|
|
390
|
+
/**
|
|
391
|
+
* List all connector instances for the current workspace.
|
|
392
|
+
*
|
|
393
|
+
* @param options - Optional request options.
|
|
394
|
+
* @returns An array of `ConnectorInstance` records.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```typescript
|
|
398
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
399
|
+
* const instances = await client.connectors.instances.list();
|
|
400
|
+
* instances.forEach(i => console.log(i.attributes?.connector_type));
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
403
|
+
list: (options?: RequestOptions) => Promise<ConnectorInstance[]>;
|
|
404
|
+
/**
|
|
405
|
+
* Retrieve a connector instance by its ID.
|
|
406
|
+
*
|
|
407
|
+
* @param id - The UUID of the connector instance.
|
|
408
|
+
* @param options - Optional request options.
|
|
409
|
+
* @returns The matching `ConnectorInstance`.
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* ```typescript
|
|
413
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
414
|
+
* const instance = await client.connectors.instances.get('ci_abc123');
|
|
415
|
+
* console.log(instance.attributes?.status);
|
|
416
|
+
* ```
|
|
417
|
+
*/
|
|
418
|
+
get: (id: string, options?: RequestOptions) => Promise<ConnectorInstance>;
|
|
419
|
+
/**
|
|
420
|
+
* Create a new connector instance.
|
|
421
|
+
*
|
|
422
|
+
* Typical attributes: `connector_type`, `name`, `workspace_id`, and any
|
|
423
|
+
* connector-specific configuration (e.g., `base_url` for custom connectors).
|
|
424
|
+
* For OAuth-based connectors, use `oauth.connect` to initiate the auth flow
|
|
425
|
+
* instead of creating an instance directly.
|
|
426
|
+
*
|
|
427
|
+
* @param attributes - Connector instance attributes.
|
|
428
|
+
* @param options - Optional request options.
|
|
429
|
+
* @returns The newly created `ConnectorInstance`.
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```typescript
|
|
433
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
434
|
+
* const instance = await client.connectors.instances.create({
|
|
435
|
+
* connector_type: 'custom',
|
|
436
|
+
* name: 'Internal CRM',
|
|
437
|
+
* workspace_id: 'ws_abc123',
|
|
438
|
+
* base_url: 'https://api.internal.example.com',
|
|
439
|
+
* });
|
|
440
|
+
* ```
|
|
441
|
+
*/
|
|
442
|
+
create: (attributes: CreateConnectorInstanceAttributes, options?: RequestOptions) => Promise<ConnectorInstance>;
|
|
443
|
+
/**
|
|
444
|
+
* Update a connector instance's configuration.
|
|
445
|
+
*
|
|
446
|
+
* Use to rename the connector, update its base URL, or change other
|
|
447
|
+
* non-credential configuration. Does not update OAuth tokens; use
|
|
448
|
+
* `credentials.refresh` for token renewal.
|
|
449
|
+
*
|
|
450
|
+
* @param id - The UUID of the connector instance to update.
|
|
451
|
+
* @param attributes - Attribute map of fields to change.
|
|
452
|
+
* @param options - Optional request options.
|
|
453
|
+
* @returns The updated `ConnectorInstance`.
|
|
454
|
+
*
|
|
455
|
+
* @example
|
|
456
|
+
* ```typescript
|
|
457
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
458
|
+
* const instance = await client.connectors.instances.update('ci_abc123', {
|
|
459
|
+
* name: 'Salesforce — Production',
|
|
460
|
+
* });
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
update: (id: string, attributes: UpdateConnectorInstanceAttributes, options?: RequestOptions) => Promise<ConnectorInstance>;
|
|
464
|
+
/**
|
|
465
|
+
* Delete a connector instance.
|
|
466
|
+
*
|
|
467
|
+
* Removes the instance and its associated credential records. The external
|
|
468
|
+
* provider's OAuth tokens are not revoked; if required, revoke them through
|
|
469
|
+
* the provider's admin console separately.
|
|
470
|
+
*
|
|
471
|
+
* @param id - The UUID of the connector instance to delete.
|
|
472
|
+
* @param options - Optional request options.
|
|
473
|
+
* @returns `true` on successful deletion.
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```typescript
|
|
477
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
478
|
+
* await client.connectors.instances.delete('ci_abc123');
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
482
|
+
};
|
|
483
|
+
/**
|
|
484
|
+
* Credentials — OAuth tokens and API keys for external connector systems.
|
|
485
|
+
*
|
|
486
|
+
* Credentials are stored encrypted server-side and are associated with a
|
|
487
|
+
* `ConnectorInstance`. They are never returned with secret values in list/get
|
|
488
|
+
* responses — only metadata (expiry, scope, provider) is exposed.
|
|
489
|
+
*/
|
|
490
|
+
credentials: {
|
|
491
|
+
/**
|
|
492
|
+
* List all credentials for the current workspace.
|
|
493
|
+
*
|
|
494
|
+
* Secret values (tokens, keys) are never included in the response.
|
|
495
|
+
* Only metadata such as `provider`, `expires_at`, and `scope` are returned.
|
|
496
|
+
*
|
|
497
|
+
* @param options - Optional request options.
|
|
498
|
+
* @returns An array of `Credential` records.
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
* ```typescript
|
|
502
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
503
|
+
* const creds = await client.connectors.credentials.list();
|
|
504
|
+
* creds.forEach(c => console.log(c.attributes?.provider, c.attributes?.expires_at));
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
list: (options?: RequestOptions) => Promise<Credential[]>;
|
|
508
|
+
/**
|
|
509
|
+
* Retrieve a single credential record by its ID.
|
|
510
|
+
*
|
|
511
|
+
* @param id - The UUID of the credential.
|
|
512
|
+
* @param options - Optional request options.
|
|
513
|
+
* @returns The matching `Credential` record (without secret values).
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* ```typescript
|
|
517
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
518
|
+
* const cred = await client.connectors.credentials.get('cred_abc123');
|
|
519
|
+
* console.log(cred.attributes?.expires_at);
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
get: (id: string, options?: RequestOptions) => Promise<Credential>;
|
|
523
|
+
/**
|
|
524
|
+
* Refresh an expired or expiring OAuth credential.
|
|
525
|
+
*
|
|
526
|
+
* Triggers the platform's OAuth token refresh flow using the stored
|
|
527
|
+
* refresh token. The credential record is updated with the new access
|
|
528
|
+
* token and expiry time. Returns the updated credential metadata.
|
|
529
|
+
*
|
|
530
|
+
* @param id - The UUID of the credential to refresh.
|
|
531
|
+
* @param workspaceId - The workspace that owns the credential.
|
|
532
|
+
* @param options - Optional request options.
|
|
533
|
+
* @returns The updated `Credential` record with refreshed expiry.
|
|
534
|
+
*
|
|
535
|
+
* @example
|
|
536
|
+
* ```typescript
|
|
537
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
538
|
+
* const refreshed = await client.connectors.credentials.refresh(
|
|
539
|
+
* 'cred_abc123',
|
|
540
|
+
* 'ws_abc123',
|
|
541
|
+
* );
|
|
542
|
+
* console.log(refreshed.attributes?.expires_at);
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
refresh: (id: string, workspaceId: string, options?: RequestOptions) => Promise<Credential>;
|
|
546
|
+
/**
|
|
547
|
+
* Create or update credentials for a connector at a specific scope level.
|
|
548
|
+
*
|
|
549
|
+
* If credentials already exist for the given connector_type + scope_level + workspace,
|
|
550
|
+
* they are updated. Otherwise, new credentials are created.
|
|
551
|
+
*
|
|
552
|
+
* @param attributes - Credential attributes including connector_type, auth_type, auth_data, scope_level, workspace_id.
|
|
553
|
+
* @param options - Optional request options.
|
|
554
|
+
* @returns The upserted `Credential` record.
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* ```typescript
|
|
558
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
559
|
+
* const cred = await client.connectors.credentials.upsert({
|
|
560
|
+
* workspace_id: 'ws_abc123',
|
|
561
|
+
* connector_type: 'practice_better',
|
|
562
|
+
* auth_type: 'client_credentials',
|
|
563
|
+
* auth_data: { client_id: 'pb_id', client_secret: 'pb_secret' },
|
|
564
|
+
* scope_level: 'workspace',
|
|
565
|
+
* });
|
|
566
|
+
* ```
|
|
567
|
+
*/
|
|
568
|
+
upsert: (attributes: UpsertCredentialAttributes, options?: RequestOptions) => Promise<Credential>;
|
|
569
|
+
/**
|
|
570
|
+
* Delete credentials for a connector by type and scope level.
|
|
571
|
+
*
|
|
572
|
+
* @param workspaceId - The workspace UUID.
|
|
573
|
+
* @param connectorType - The connector type (e.g., "practice_better").
|
|
574
|
+
* @param scopeLevel - The scope level ("workspace", "tenant", or "application").
|
|
575
|
+
* @param options - Optional request options.
|
|
576
|
+
* @returns `{ deleted: true }` on success.
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```typescript
|
|
580
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
581
|
+
* await client.connectors.credentials.deleteByType(
|
|
582
|
+
* 'ws_abc123',
|
|
583
|
+
* 'practice_better',
|
|
584
|
+
* 'workspace',
|
|
585
|
+
* );
|
|
586
|
+
* ```
|
|
587
|
+
*/
|
|
588
|
+
deleteByType: (workspaceId: string, connectorType: string, scopeLevel: string, options?: RequestOptions) => Promise<{
|
|
589
|
+
deleted: boolean;
|
|
590
|
+
}>;
|
|
591
|
+
};
|
|
592
|
+
/**
|
|
593
|
+
* OAuth — initiate and complete OAuth authorization flows for any connector type.
|
|
594
|
+
*
|
|
595
|
+
* Use `connect` to get the provider authorization URL, redirect the user,
|
|
596
|
+
* then call `callback` in your redirect handler to exchange the authorization
|
|
597
|
+
* code for a stored credential.
|
|
598
|
+
*/
|
|
599
|
+
oauth: {
|
|
600
|
+
/**
|
|
601
|
+
* Get the OAuth authorization URL for a connector type.
|
|
602
|
+
*
|
|
603
|
+
* Returns the provider's authorization URL that you must redirect the user
|
|
604
|
+
* to so they can grant access. Also returns a `state` token for CSRF protection
|
|
605
|
+
* — store it in the session and verify it matches when `callback` is called.
|
|
606
|
+
*
|
|
607
|
+
* @param connectorType - The connector type identifier (e.g., `"salesforce"`,
|
|
608
|
+
* `"slack"`, `"google_calendar"`). See `available.list()` for all supported types.
|
|
609
|
+
* @param workspaceId - The workspace UUID to associate the resulting credential with.
|
|
610
|
+
* @param options - Optional request options.
|
|
611
|
+
* @returns An `OAuthInitiateResult` with `auth_url` and `state`.
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* ```typescript
|
|
615
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
616
|
+
* const { auth_url, state } = await client.connectors.oauth.connect(
|
|
617
|
+
* 'slack',
|
|
618
|
+
* 'ws_abc123',
|
|
619
|
+
* );
|
|
620
|
+
* sessionStorage.setItem('oauth_state', state);
|
|
621
|
+
* window.location.href = auth_url;
|
|
622
|
+
* ```
|
|
623
|
+
*/
|
|
624
|
+
connect: (connectorType: string, workspaceId: string, options?: RequestOptions) => Promise<OAuthInitiateResult>;
|
|
625
|
+
/**
|
|
626
|
+
* Exchange an OAuth authorization code for a stored credential.
|
|
627
|
+
*
|
|
628
|
+
* Called from your OAuth redirect handler after the user has authorized
|
|
629
|
+
* access at the provider. Verifies the `state` token, exchanges the `code`
|
|
630
|
+
* for access/refresh tokens, and stores them as a `Credential` record linked
|
|
631
|
+
* to the workspace. Returns the resulting `ConnectorInstance`.
|
|
632
|
+
*
|
|
633
|
+
* Pass `redirectUri` if a custom redirect URI was used in `connect` — it must
|
|
634
|
+
* exactly match the URI registered with the provider and sent during authorization.
|
|
635
|
+
*
|
|
636
|
+
* @param connectorType - The connector type identifier (must match what was
|
|
637
|
+
* passed to `connect`).
|
|
638
|
+
* @param code - The authorization code from the provider redirect query string.
|
|
639
|
+
* @param state - The CSRF state token from the redirect query string.
|
|
640
|
+
* @param workspaceId - The workspace UUID (same as passed to `connect`).
|
|
641
|
+
* @param redirectUri - Optional. The redirect URI used during `connect`, if custom.
|
|
642
|
+
* @param options - Optional request options.
|
|
643
|
+
* @returns The `ConnectorInstance` created or updated with the new credential.
|
|
644
|
+
*
|
|
645
|
+
* @example
|
|
646
|
+
* ```typescript
|
|
647
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
648
|
+
* // In your OAuth redirect handler:
|
|
649
|
+
* const params = new URLSearchParams(window.location.search);
|
|
650
|
+
* const instance = await client.connectors.oauth.callback(
|
|
651
|
+
* 'slack',
|
|
652
|
+
* params.get('code')!,
|
|
653
|
+
* params.get('state')!,
|
|
654
|
+
* 'ws_abc123',
|
|
655
|
+
* );
|
|
656
|
+
* console.log('Connected:', instance.id);
|
|
657
|
+
* ```
|
|
658
|
+
*/
|
|
659
|
+
callback: (connectorType: string, code: string, state: string, workspaceId: string, redirectUri?: string, options?: RequestOptions) => Promise<ConnectorInstance>;
|
|
660
|
+
};
|
|
661
|
+
/**
|
|
662
|
+
* Supported Connectors — discover the catalog of available connector types.
|
|
663
|
+
*
|
|
664
|
+
* Returns the static list of integration types the platform supports.
|
|
665
|
+
* Use this to populate connector selection UIs.
|
|
666
|
+
*/
|
|
667
|
+
available: {
|
|
668
|
+
/**
|
|
669
|
+
* List all supported connector type identifiers.
|
|
670
|
+
*
|
|
671
|
+
* Returns a static array of strings — no network request is made.
|
|
672
|
+
* Each identifier can be passed to `oauth.connect` or used as the
|
|
673
|
+
* `connector_type` when creating a `ConnectorInstance`.
|
|
674
|
+
*
|
|
675
|
+
* @returns An array of connector type identifier strings.
|
|
676
|
+
*
|
|
677
|
+
* @example
|
|
678
|
+
* ```typescript
|
|
679
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
680
|
+
* const types = client.connectors.available.list();
|
|
681
|
+
* console.log(types);
|
|
682
|
+
* // ["salesforce", "sharepoint", "slack", "edamam", "fullscript", ...]
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
685
|
+
list: () => string[];
|
|
686
|
+
};
|
|
687
|
+
/**
|
|
688
|
+
* Sync — trigger and monitor sync operations for connector instances.
|
|
689
|
+
*/
|
|
690
|
+
sync: {
|
|
691
|
+
/**
|
|
692
|
+
* Trigger a sync operation for a connector instance.
|
|
693
|
+
*
|
|
694
|
+
* @param connectorInstanceId - UUID of the connector instance to sync.
|
|
695
|
+
* @param params - Sync parameters including workspace_id and action_name.
|
|
696
|
+
* @param options - Optional request options.
|
|
697
|
+
* @returns A `SyncTriggerResult` with `sync_log_id` and `status`.
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* ```typescript
|
|
701
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
702
|
+
* const result = await client.connectors.sync.trigger('ci_abc123', {
|
|
703
|
+
* workspace_id: 'ws_abc123',
|
|
704
|
+
* action_name: 'full',
|
|
705
|
+
* });
|
|
706
|
+
* console.log('Sync started:', result.sync_log_id);
|
|
707
|
+
* ```
|
|
708
|
+
*/
|
|
709
|
+
trigger: (connectorInstanceId: string, params: TriggerSyncParams, options?: RequestOptions) => Promise<SyncTriggerResult>;
|
|
710
|
+
/**
|
|
711
|
+
* List sync logs, optionally filtered by connector instance.
|
|
712
|
+
*
|
|
713
|
+
* @param options - Optional request options.
|
|
714
|
+
* @returns An array of sync log records.
|
|
715
|
+
*
|
|
716
|
+
* @example
|
|
717
|
+
* ```typescript
|
|
718
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
719
|
+
* const logs = await client.connectors.sync.logs();
|
|
720
|
+
* logs.forEach(l => console.log(l.attributes?.status));
|
|
721
|
+
* ```
|
|
722
|
+
*/
|
|
723
|
+
logs: (options?: RequestOptions) => Promise<SyncLog[]>;
|
|
724
|
+
/**
|
|
725
|
+
* Get a single sync log by ID.
|
|
726
|
+
*
|
|
727
|
+
* @param id - The UUID of the sync log.
|
|
728
|
+
* @param options - Optional request options.
|
|
729
|
+
* @returns The sync log record.
|
|
730
|
+
*
|
|
731
|
+
* @example
|
|
732
|
+
* ```typescript
|
|
733
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
734
|
+
* const log = await client.connectors.sync.log('sl_abc123');
|
|
735
|
+
* console.log(log.attributes?.records_processed);
|
|
736
|
+
* ```
|
|
737
|
+
*/
|
|
738
|
+
log: (id: string, options?: RequestOptions) => Promise<SyncLog>;
|
|
739
|
+
};
|
|
740
|
+
/**
|
|
741
|
+
* Edamam — recipe search and nutrition data via the Edamam Recipe API.
|
|
742
|
+
*
|
|
743
|
+
* Requires an active `ConnectorInstance` with `connector_type: "edamam"`.
|
|
744
|
+
* ISVs can supply their own Edamam App ID and App Key via a `Credential`
|
|
745
|
+
* record; the platform falls back to its own environment-variable keys
|
|
746
|
+
* when no ISV credential is present.
|
|
747
|
+
*/
|
|
748
|
+
edamam: {
|
|
749
|
+
/**
|
|
750
|
+
* Recipe operations — search and retrieve individual recipes from Edamam.
|
|
751
|
+
*/
|
|
752
|
+
recipes: {
|
|
753
|
+
/**
|
|
754
|
+
* Search for recipes matching a query string and optional dietary filters.
|
|
755
|
+
*
|
|
756
|
+
* Proxies the Edamam Recipe Search API. Results are returned as
|
|
757
|
+
* `EdamamRecipe` objects inside a `hits` array. Use `from`/`to` for
|
|
758
|
+
* pagination (Edamam uses numeric offset-based pagination, not cursors).
|
|
759
|
+
*
|
|
760
|
+
* @param connectorInstanceId - UUID of the Edamam `ConnectorInstance`.
|
|
761
|
+
* @param workspaceId - UUID of the current workspace.
|
|
762
|
+
* @param params - Search parameters: required `query`, optional `health`
|
|
763
|
+
* labels (e.g., `["vegan"]`), `diet` labels (e.g., `["balanced"]`),
|
|
764
|
+
* and pagination offsets `from` / `to`.
|
|
765
|
+
* @param options - Optional request options.
|
|
766
|
+
* @returns An `EdamamSearchResult` with `hits`, `count`, and optional `next_page`.
|
|
767
|
+
*
|
|
768
|
+
* @example
|
|
769
|
+
* ```typescript
|
|
770
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
771
|
+
* const results = await client.connectors.edamam.recipes.search(
|
|
772
|
+
* 'ci_edamam_123',
|
|
773
|
+
* 'ws_abc123',
|
|
774
|
+
* {
|
|
775
|
+
* query: 'chicken salad',
|
|
776
|
+
* health: ['gluten-free'],
|
|
777
|
+
* diet: ['balanced'],
|
|
778
|
+
* from: 0,
|
|
779
|
+
* to: 10,
|
|
780
|
+
* },
|
|
781
|
+
* );
|
|
782
|
+
* console.log(`${results.count} recipes found`);
|
|
783
|
+
* results.hits.forEach(r => console.log(r.label, r.calories));
|
|
784
|
+
* ```
|
|
785
|
+
*/
|
|
786
|
+
search: (connectorInstanceId: string, workspaceId: string, params: EdamamSearchParams, options?: RequestOptions) => Promise<EdamamSearchResult>;
|
|
787
|
+
/**
|
|
788
|
+
* Fetch full details for a single recipe by its Edamam recipe ID.
|
|
789
|
+
*
|
|
790
|
+
* The Edamam recipe ID is the URI returned in `EdamamRecipe.uri`
|
|
791
|
+
* (e.g., `"recipe_abc123"`). Returns the complete recipe object
|
|
792
|
+
* including full ingredient list and nutritional breakdown.
|
|
793
|
+
*
|
|
794
|
+
* @param connectorInstanceId - UUID of the Edamam `ConnectorInstance`.
|
|
795
|
+
* @param workspaceId - UUID of the current workspace.
|
|
796
|
+
* @param recipeId - The Edamam recipe identifier (from `EdamamRecipe.uri`).
|
|
797
|
+
* @param options - Optional request options.
|
|
798
|
+
* @returns An object with a `recipe` property containing the full `EdamamRecipe`.
|
|
799
|
+
*
|
|
800
|
+
* @example
|
|
801
|
+
* ```typescript
|
|
802
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
803
|
+
* const { recipe } = await client.connectors.edamam.recipes.get(
|
|
804
|
+
* 'ci_edamam_123',
|
|
805
|
+
* 'ws_abc123',
|
|
806
|
+
* 'recipe_abc123',
|
|
807
|
+
* );
|
|
808
|
+
* console.log(recipe.label, recipe.ingredientLines);
|
|
809
|
+
* ```
|
|
810
|
+
*/
|
|
811
|
+
get: (connectorInstanceId: string, workspaceId: string, recipeId: string, options?: RequestOptions) => Promise<{
|
|
812
|
+
recipe: EdamamRecipe;
|
|
813
|
+
}>;
|
|
814
|
+
};
|
|
815
|
+
};
|
|
816
|
+
/**
|
|
817
|
+
* Fullscript — supplement prescribing platform integration.
|
|
818
|
+
*
|
|
819
|
+
* Requires an active `ConnectorInstance` with `connector_type: "fullscript"`
|
|
820
|
+
* and a linked OAuth `Credential`. Use `fullscript.oauth.connect` to authorize.
|
|
821
|
+
*
|
|
822
|
+
* Typical flow:
|
|
823
|
+
* 1. `fullscript.oauth.connect(workspaceId)` — redirect user to Fullscript.
|
|
824
|
+
* 2. `fullscript.oauth.callback(code, state, workspaceId)` — store credential.
|
|
825
|
+
* 3. `fullscript.checkPatient(connectorId, workspaceId, email)` — look up patient.
|
|
826
|
+
* 4. `fullscript.sessionGrant(connectorId, workspaceId, patientId)` — get embed token.
|
|
827
|
+
*/
|
|
828
|
+
fullscript: {
|
|
829
|
+
/**
|
|
830
|
+
* Check whether a patient record exists in Fullscript by email address.
|
|
831
|
+
*
|
|
832
|
+
* Returns the patient object if found in the Fullscript account linked
|
|
833
|
+
* to the connector, or `null` if no patient with that email exists.
|
|
834
|
+
*
|
|
835
|
+
* @param connectorId - UUID of the Fullscript `ConnectorInstance`.
|
|
836
|
+
* @param workspaceId - UUID of the current workspace.
|
|
837
|
+
* @param email - The patient's email address to look up.
|
|
838
|
+
* @param options - Optional request options.
|
|
839
|
+
* @returns A `FullscriptPatient` if found, or `null` if not found.
|
|
840
|
+
*
|
|
841
|
+
* @example
|
|
842
|
+
* ```typescript
|
|
843
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
844
|
+
* const patient = await client.connectors.fullscript.checkPatient(
|
|
845
|
+
* 'ci_fs_123',
|
|
846
|
+
* 'ws_abc123',
|
|
847
|
+
* 'jane@example.com',
|
|
848
|
+
* );
|
|
849
|
+
* if (patient) {
|
|
850
|
+
* console.log('Found:', patient.fullscript_id);
|
|
851
|
+
* } else {
|
|
852
|
+
* console.log('Patient not in Fullscript yet');
|
|
853
|
+
* }
|
|
854
|
+
* ```
|
|
855
|
+
*/
|
|
856
|
+
checkPatient: (connectorId: string, workspaceId: string, email: string, options?: RequestOptions) => Promise<FullscriptPatient | null>;
|
|
857
|
+
/**
|
|
858
|
+
* Create a new patient record in Fullscript.
|
|
859
|
+
*
|
|
860
|
+
* Creates the patient in the Fullscript account linked to the connector
|
|
861
|
+
* and returns the resulting patient object including the assigned
|
|
862
|
+
* `fullscript_id`. Use this when a patient does not yet have a Fullscript
|
|
863
|
+
* account (confirmed via `checkPatient`).
|
|
864
|
+
*
|
|
865
|
+
* @param connectorId - UUID of the Fullscript `ConnectorInstance`.
|
|
866
|
+
* @param workspaceId - UUID of the current workspace.
|
|
867
|
+
* @param attrs - Patient attributes: `first_name`, `last_name`, `email`
|
|
868
|
+
* (all required), and optional `date_of_birth` (ISO 8601 date string).
|
|
869
|
+
* @param options - Optional request options.
|
|
870
|
+
* @returns The newly created `FullscriptPatient`.
|
|
871
|
+
*
|
|
872
|
+
* @example
|
|
873
|
+
* ```typescript
|
|
874
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
875
|
+
* const patient = await client.connectors.fullscript.createPatient(
|
|
876
|
+
* 'ci_fs_123',
|
|
877
|
+
* 'ws_abc123',
|
|
878
|
+
* {
|
|
879
|
+
* first_name: 'Jane',
|
|
880
|
+
* last_name: 'Smith',
|
|
881
|
+
* email: 'jane@example.com',
|
|
882
|
+
* date_of_birth: '1985-04-12',
|
|
883
|
+
* },
|
|
884
|
+
* );
|
|
885
|
+
* console.log('Created Fullscript patient:', patient.fullscript_id);
|
|
886
|
+
* ```
|
|
887
|
+
*/
|
|
888
|
+
createPatient: (connectorId: string, workspaceId: string, attrs: {
|
|
889
|
+
first_name: string;
|
|
890
|
+
last_name: string;
|
|
891
|
+
email: string;
|
|
892
|
+
date_of_birth?: string;
|
|
893
|
+
}, options?: RequestOptions) => Promise<FullscriptPatient>;
|
|
894
|
+
/**
|
|
895
|
+
* Obtain a short-lived embed session grant for the Fullscript prescribing widget.
|
|
896
|
+
*
|
|
897
|
+
* The returned `token` is used to embed the Fullscript prescribing UI for a
|
|
898
|
+
* specific patient within your application. Tokens are valid for 5–15 minutes
|
|
899
|
+
* and are cached server-side for up to 2 minutes to avoid token proliferation
|
|
900
|
+
* on repeated calls.
|
|
901
|
+
*
|
|
902
|
+
* @param connectorId - UUID of the Fullscript `ConnectorInstance`.
|
|
903
|
+
* @param workspaceId - UUID of the current workspace.
|
|
904
|
+
* @param patientId - The Fullscript patient ID (from `FullscriptPatient.fullscript_id`).
|
|
905
|
+
* @param options - Optional request options.
|
|
906
|
+
* @returns A `FullscriptSessionGrant` with `token`, `expires_at`, and `patient_id`.
|
|
907
|
+
*
|
|
908
|
+
* @example
|
|
909
|
+
* ```typescript
|
|
910
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
911
|
+
* const grant = await client.connectors.fullscript.sessionGrant(
|
|
912
|
+
* 'ci_fs_123',
|
|
913
|
+
* 'ws_abc123',
|
|
914
|
+
* 'fs_patient_456',
|
|
915
|
+
* );
|
|
916
|
+
* // Embed: `https://app.fullscript.com/embed?token=${grant.token}`
|
|
917
|
+
* console.log('Token expires:', grant.expires_at);
|
|
918
|
+
* ```
|
|
919
|
+
*/
|
|
920
|
+
sessionGrant: (connectorId: string, workspaceId: string, patientId: string, options?: RequestOptions) => Promise<FullscriptSessionGrant>;
|
|
921
|
+
/**
|
|
922
|
+
* List treatment plans for a patient.
|
|
923
|
+
* @param connectorId - The Fullscript connector instance ID
|
|
924
|
+
* @param workspaceId - The workspace ID
|
|
925
|
+
* @param patientId - The Fullscript patient ID
|
|
926
|
+
* @returns Array of treatment plans
|
|
927
|
+
*/
|
|
928
|
+
listTreatmentPlans: (connectorId: string, workspaceId: string, patientId: string, options?: RequestOptions) => Promise<FullscriptTreatmentPlan[]>;
|
|
929
|
+
/**
|
|
930
|
+
* Get treatment plan details including recommendations.
|
|
931
|
+
*
|
|
932
|
+
* @param connectorId - UUID of the Fullscript `ConnectorInstance`.
|
|
933
|
+
* @param workspaceId - UUID of the current workspace.
|
|
934
|
+
* @param treatmentPlanId - The Fullscript treatment plan ID.
|
|
935
|
+
* @param options - Optional request options.
|
|
936
|
+
* @returns The `FullscriptTreatmentPlan` with recommendation details.
|
|
937
|
+
*
|
|
938
|
+
* @example
|
|
939
|
+
* ```typescript
|
|
940
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
941
|
+
* const plan = await client.connectors.fullscript.getTreatmentPlan(
|
|
942
|
+
* 'ci_fs_123',
|
|
943
|
+
* 'ws_abc123',
|
|
944
|
+
* 'tp_456',
|
|
945
|
+
* );
|
|
946
|
+
* console.log(plan.state, plan.recommendations);
|
|
947
|
+
* ```
|
|
948
|
+
*/
|
|
949
|
+
getTreatmentPlan: (connectorId: string, workspaceId: string, treatmentPlanId: string, options?: RequestOptions) => Promise<FullscriptTreatmentPlan>;
|
|
950
|
+
/**
|
|
951
|
+
* Cancel an active treatment plan.
|
|
952
|
+
*
|
|
953
|
+
* @param connectorId - UUID of the Fullscript `ConnectorInstance`.
|
|
954
|
+
* @param workspaceId - UUID of the current workspace.
|
|
955
|
+
* @param treatmentPlanId - The Fullscript treatment plan ID to cancel.
|
|
956
|
+
* @param options - Optional request options.
|
|
957
|
+
* @returns The cancelled `FullscriptTreatmentPlan` with updated state.
|
|
958
|
+
*
|
|
959
|
+
* @example
|
|
960
|
+
* ```typescript
|
|
961
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
962
|
+
* const cancelled = await client.connectors.fullscript.cancelTreatmentPlan(
|
|
963
|
+
* 'ci_fs_123',
|
|
964
|
+
* 'ws_abc123',
|
|
965
|
+
* 'tp_456',
|
|
966
|
+
* );
|
|
967
|
+
* console.log(cancelled.state); // "cancelled"
|
|
968
|
+
* ```
|
|
969
|
+
*/
|
|
970
|
+
cancelTreatmentPlan: (connectorId: string, workspaceId: string, treatmentPlanId: string, options?: RequestOptions) => Promise<FullscriptTreatmentPlan>;
|
|
971
|
+
/**
|
|
972
|
+
* Create a treatment plan in Fullscript with product recommendations.
|
|
973
|
+
*
|
|
974
|
+
* @param connectorId - The Fullscript connector instance ID
|
|
975
|
+
* @param workspaceId - The workspace ID
|
|
976
|
+
* @param attrs - Treatment plan creation attributes
|
|
977
|
+
* @param options - Optional request options.
|
|
978
|
+
* @returns The created {@link FullscriptTreatmentPlan}.
|
|
979
|
+
*
|
|
980
|
+
* @example
|
|
981
|
+
* ```typescript
|
|
982
|
+
* const plan = await client.connectors.fullscript.createTreatmentPlan(
|
|
983
|
+
* 'ci_fs_123',
|
|
984
|
+
* 'ws_abc123',
|
|
985
|
+
* {
|
|
986
|
+
* patient_id: 'fs_pat_456',
|
|
987
|
+
* recommendations: [{ product_id: 'prod_1', dosage: '1 cap daily' }],
|
|
988
|
+
* send_invitation: true,
|
|
989
|
+
* message: 'Please take as directed',
|
|
990
|
+
* },
|
|
991
|
+
* );
|
|
992
|
+
* ```
|
|
993
|
+
*/
|
|
994
|
+
createTreatmentPlan: (connectorId: string, workspaceId: string, attrs: CreateTreatmentPlanAttributes, options?: RequestOptions) => Promise<FullscriptTreatmentPlan>;
|
|
995
|
+
/**
|
|
996
|
+
* Match AI-generated supplement names to Fullscript products.
|
|
997
|
+
*
|
|
998
|
+
* @param connectorId - The Fullscript connector instance ID
|
|
999
|
+
* @param workspaceId - The workspace ID
|
|
1000
|
+
* @param queries - Array of product match queries
|
|
1001
|
+
* @param options - Optional request options.
|
|
1002
|
+
* @returns Array of {@link ProductMatchResult} with matched products per query.
|
|
1003
|
+
*
|
|
1004
|
+
* @example
|
|
1005
|
+
* ```typescript
|
|
1006
|
+
* const results = await client.connectors.fullscript.matchProducts(
|
|
1007
|
+
* 'ci_fs_123',
|
|
1008
|
+
* 'ws_abc123',
|
|
1009
|
+
* [{ name: 'Vitamin D3 2000 IU', form: 'capsule' }],
|
|
1010
|
+
* );
|
|
1011
|
+
* ```
|
|
1012
|
+
*/
|
|
1013
|
+
matchProducts: (connectorId: string, workspaceId: string, queries: ProductMatchQuery[], options?: RequestOptions) => Promise<ProductMatchResult[]>;
|
|
1014
|
+
/**
|
|
1015
|
+
* Search the Fullscript product catalog by keyword query.
|
|
1016
|
+
*
|
|
1017
|
+
* @param connectorId - UUID of the Fullscript `ConnectorInstance`.
|
|
1018
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1019
|
+
* @param query - Search keyword (e.g., `"vitamin D"`, `"omega 3"`).
|
|
1020
|
+
* @param options - Optional request options.
|
|
1021
|
+
* @returns An array of matching `FullscriptProduct` records.
|
|
1022
|
+
*
|
|
1023
|
+
* @example
|
|
1024
|
+
* ```typescript
|
|
1025
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1026
|
+
* const products = await client.connectors.fullscript.searchProducts(
|
|
1027
|
+
* 'ci_fs_123',
|
|
1028
|
+
* 'ws_abc123',
|
|
1029
|
+
* 'vitamin D',
|
|
1030
|
+
* );
|
|
1031
|
+
* products.forEach(p => console.log(p.name, p.brand));
|
|
1032
|
+
* ```
|
|
1033
|
+
*/
|
|
1034
|
+
searchProducts: (connectorId: string, workspaceId: string, query: string, options?: RequestOptions) => Promise<FullscriptProduct[]>;
|
|
1035
|
+
/**
|
|
1036
|
+
* Get full product details from the Fullscript catalog by product ID.
|
|
1037
|
+
*
|
|
1038
|
+
* @param connectorId - UUID of the Fullscript `ConnectorInstance`.
|
|
1039
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1040
|
+
* @param productId - The Fullscript product ID.
|
|
1041
|
+
* @param options - Optional request options.
|
|
1042
|
+
* @returns The `FullscriptProduct` with full details.
|
|
1043
|
+
*
|
|
1044
|
+
* @example
|
|
1045
|
+
* ```typescript
|
|
1046
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1047
|
+
* const product = await client.connectors.fullscript.getProduct(
|
|
1048
|
+
* 'ci_fs_123',
|
|
1049
|
+
* 'ws_abc123',
|
|
1050
|
+
* 'prod_789',
|
|
1051
|
+
* );
|
|
1052
|
+
* console.log(product.name, product.brand);
|
|
1053
|
+
* ```
|
|
1054
|
+
*/
|
|
1055
|
+
getProduct: (connectorId: string, workspaceId: string, productId: string, options?: RequestOptions) => Promise<FullscriptProduct>;
|
|
1056
|
+
/**
|
|
1057
|
+
* List similar products curated by Fullscript's health professionals.
|
|
1058
|
+
*
|
|
1059
|
+
* @param connectorId - UUID of the Fullscript `ConnectorInstance`.
|
|
1060
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1061
|
+
* @param productId - The Fullscript product ID to find similar products for.
|
|
1062
|
+
* @param options - Optional request options.
|
|
1063
|
+
* @returns An array of similar `FullscriptProduct` records.
|
|
1064
|
+
*
|
|
1065
|
+
* @example
|
|
1066
|
+
* ```typescript
|
|
1067
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1068
|
+
* const similar = await client.connectors.fullscript.listSimilarProducts(
|
|
1069
|
+
* 'ci_fs_123',
|
|
1070
|
+
* 'ws_abc123',
|
|
1071
|
+
* 'prod_789',
|
|
1072
|
+
* );
|
|
1073
|
+
* similar.forEach(p => console.log(p.name));
|
|
1074
|
+
* ```
|
|
1075
|
+
*/
|
|
1076
|
+
listSimilarProducts: (connectorId: string, workspaceId: string, productId: string, options?: RequestOptions) => Promise<FullscriptProduct[]>;
|
|
1077
|
+
/**
|
|
1078
|
+
* List all orders for a patient in Fullscript.
|
|
1079
|
+
*
|
|
1080
|
+
* @param connectorId - UUID of the Fullscript `ConnectorInstance`.
|
|
1081
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1082
|
+
* @param patientId - The Fullscript patient ID.
|
|
1083
|
+
* @param options - Optional request options.
|
|
1084
|
+
* @returns An array of `FullscriptOrder` records for the patient.
|
|
1085
|
+
*
|
|
1086
|
+
* @example
|
|
1087
|
+
* ```typescript
|
|
1088
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1089
|
+
* const orders = await client.connectors.fullscript.listPatientOrders(
|
|
1090
|
+
* 'ci_fs_123',
|
|
1091
|
+
* 'ws_abc123',
|
|
1092
|
+
* 'fs_patient_456',
|
|
1093
|
+
* );
|
|
1094
|
+
* orders.forEach(o => console.log(o.id, o.payment_total));
|
|
1095
|
+
* ```
|
|
1096
|
+
*/
|
|
1097
|
+
listPatientOrders: (connectorId: string, workspaceId: string, patientId: string, options?: RequestOptions) => Promise<FullscriptOrder[]>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Get order details from Fullscript by order ID.
|
|
1100
|
+
*
|
|
1101
|
+
* @param connectorId - UUID of the Fullscript `ConnectorInstance`.
|
|
1102
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1103
|
+
* @param orderId - The Fullscript order ID.
|
|
1104
|
+
* @param options - Optional request options.
|
|
1105
|
+
* @returns The `FullscriptOrder` with line items and totals.
|
|
1106
|
+
*
|
|
1107
|
+
* @example
|
|
1108
|
+
* ```typescript
|
|
1109
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1110
|
+
* const order = await client.connectors.fullscript.getOrder(
|
|
1111
|
+
* 'ci_fs_123',
|
|
1112
|
+
* 'ws_abc123',
|
|
1113
|
+
* 'ord_789',
|
|
1114
|
+
* );
|
|
1115
|
+
* console.log(order.payment_total, order.line_items);
|
|
1116
|
+
* ```
|
|
1117
|
+
*/
|
|
1118
|
+
getOrder: (connectorId: string, workspaceId: string, orderId: string, options?: RequestOptions) => Promise<FullscriptOrder>;
|
|
1119
|
+
/**
|
|
1120
|
+
* Fullscript-specific OAuth helpers.
|
|
1121
|
+
*
|
|
1122
|
+
* Convenience wrappers around the generic `oauth.connect` / `oauth.callback`
|
|
1123
|
+
* flow, pre-configured for `connector_type: "fullscript"`.
|
|
1124
|
+
*/
|
|
1125
|
+
oauth: {
|
|
1126
|
+
/**
|
|
1127
|
+
* Get the Fullscript OAuth authorization URL.
|
|
1128
|
+
*
|
|
1129
|
+
* Redirects the user to Fullscript's authorization page where they
|
|
1130
|
+
* grant access to their practitioner account. Store the returned
|
|
1131
|
+
* `state` in the session for CSRF verification.
|
|
1132
|
+
*
|
|
1133
|
+
* @param workspaceId - UUID of the workspace to associate the credential with.
|
|
1134
|
+
* @param options - Optional request options.
|
|
1135
|
+
* @returns An `OAuthInitiateResult` with `auth_url` and `state`.
|
|
1136
|
+
*
|
|
1137
|
+
* @example
|
|
1138
|
+
* ```typescript
|
|
1139
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1140
|
+
* const { auth_url, state } = await client.connectors.fullscript.oauth.connect(
|
|
1141
|
+
* 'ws_abc123',
|
|
1142
|
+
* );
|
|
1143
|
+
* sessionStorage.setItem('oauth_state', state);
|
|
1144
|
+
* window.location.href = auth_url;
|
|
1145
|
+
* ```
|
|
1146
|
+
*/
|
|
1147
|
+
connect: (workspaceId: string, options?: RequestOptions) => Promise<OAuthInitiateResult>;
|
|
1148
|
+
/**
|
|
1149
|
+
* Exchange a Fullscript OAuth authorization code for a stored credential.
|
|
1150
|
+
*
|
|
1151
|
+
* Called from your OAuth redirect handler. Verifies `state`, exchanges
|
|
1152
|
+
* `code` for Fullscript tokens, and creates or updates the `Credential`
|
|
1153
|
+
* record. Returns the resulting `ConnectorInstance`.
|
|
1154
|
+
*
|
|
1155
|
+
* Pass `redirectUri` if a custom redirect URI was used in `connect` — it
|
|
1156
|
+
* must exactly match the URI registered with Fullscript and sent during
|
|
1157
|
+
* authorization.
|
|
1158
|
+
*
|
|
1159
|
+
* @param code - The authorization code from the Fullscript redirect.
|
|
1160
|
+
* @param state - The CSRF state token from the redirect query string.
|
|
1161
|
+
* @param workspaceId - UUID of the workspace (same as passed to `connect`).
|
|
1162
|
+
* @param redirectUri - Optional custom redirect URI, if used during `connect`.
|
|
1163
|
+
* @param options - Optional request options.
|
|
1164
|
+
* @returns The `ConnectorInstance` linked to the new Fullscript credential.
|
|
1165
|
+
*
|
|
1166
|
+
* @example
|
|
1167
|
+
* ```typescript
|
|
1168
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1169
|
+
* const params = new URLSearchParams(window.location.search);
|
|
1170
|
+
* const instance = await client.connectors.fullscript.oauth.callback(
|
|
1171
|
+
* params.get('code')!,
|
|
1172
|
+
* params.get('state')!,
|
|
1173
|
+
* 'ws_abc123',
|
|
1174
|
+
* );
|
|
1175
|
+
* console.log('Fullscript connected:', instance.id);
|
|
1176
|
+
* ```
|
|
1177
|
+
*/
|
|
1178
|
+
callback: (code: string, state: string, workspaceId: string, redirectUri?: string, options?: RequestOptions) => Promise<ConnectorInstance>;
|
|
1179
|
+
};
|
|
1180
|
+
};
|
|
1181
|
+
/**
|
|
1182
|
+
* Practice Better — clinical note push for linked PB contacts.
|
|
1183
|
+
*
|
|
1184
|
+
* Requires an active `ConnectorInstance` with `connector_type: "practice-better"`
|
|
1185
|
+
* and stored credentials. The contact must have an `integration_link` custom entity
|
|
1186
|
+
* linking them to a PB client record.
|
|
1187
|
+
*/
|
|
1188
|
+
practiceBetter: {
|
|
1189
|
+
/**
|
|
1190
|
+
* Push an AI-generated clinical note to Practice Better for a linked contact.
|
|
1191
|
+
*
|
|
1192
|
+
* @param connectorInstanceId - UUID of the PB `ConnectorInstance`.
|
|
1193
|
+
* @param params - Note parameters including workspace_id, contact_id, note_content.
|
|
1194
|
+
* @param options - Optional request options.
|
|
1195
|
+
* @returns The PB API response map.
|
|
1196
|
+
*
|
|
1197
|
+
* @example
|
|
1198
|
+
* ```typescript
|
|
1199
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1200
|
+
* const result = await client.connectors.practiceBetter.pushNote(
|
|
1201
|
+
* 'ci_pb_123',
|
|
1202
|
+
* {
|
|
1203
|
+
* workspace_id: 'ws_abc123',
|
|
1204
|
+
* contact_id: 'contact_456',
|
|
1205
|
+
* note_content: 'Session notes: Patient reported improved energy...',
|
|
1206
|
+
* note_type: 'clinical',
|
|
1207
|
+
* },
|
|
1208
|
+
* );
|
|
1209
|
+
* ```
|
|
1210
|
+
*/
|
|
1211
|
+
pushNote: (connectorInstanceId: string, params: PBPushNoteParams, options?: RequestOptions) => Promise<Record<string, unknown>>;
|
|
1212
|
+
};
|
|
1213
|
+
/**
|
|
1214
|
+
* Healthie EHR connector — patient and appointment sync.
|
|
1215
|
+
*
|
|
1216
|
+
* Provides typed methods for listing and syncing patient records and appointments
|
|
1217
|
+
* from Healthie EHR. Requires an active `ConnectorInstance` with `connector_type:
|
|
1218
|
+
* "healthie"` and a linked OAuth `Credential`.
|
|
1219
|
+
*
|
|
1220
|
+
* Typical flow:
|
|
1221
|
+
* 1. Authorize via OAuth using `oauth.connect('healthie', workspaceId)`.
|
|
1222
|
+
* 2. Check sync status with `healthie.getStatus(connectorId, workspaceId)`.
|
|
1223
|
+
* 3. List patients or appointments, optionally filtering by date.
|
|
1224
|
+
* 4. Trigger incremental or full syncs as needed.
|
|
1225
|
+
*/
|
|
1226
|
+
healthie: {
|
|
1227
|
+
/**
|
|
1228
|
+
* List patient records from Healthie EHR.
|
|
1229
|
+
*
|
|
1230
|
+
* Returns all patients from the Healthie account linked to the connector.
|
|
1231
|
+
* Optionally filter by `since` date to only get patients modified since
|
|
1232
|
+
* a given timestamp.
|
|
1233
|
+
*
|
|
1234
|
+
* @param connectorId - UUID of the Healthie `ConnectorInstance`.
|
|
1235
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1236
|
+
* @param options - Optional list parameters including `since` (Date) filter.
|
|
1237
|
+
* @param requestOptions - Optional request options.
|
|
1238
|
+
* @returns An array of `HealthiePatient` records.
|
|
1239
|
+
*
|
|
1240
|
+
* @example
|
|
1241
|
+
* ```typescript
|
|
1242
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1243
|
+
* const patients = await client.connectors.healthie.listPatients(
|
|
1244
|
+
* 'ci_healthie_123',
|
|
1245
|
+
* 'ws_abc123',
|
|
1246
|
+
* { since: new Date('2025-01-01') },
|
|
1247
|
+
* );
|
|
1248
|
+
* patients.forEach(p => console.log(p.first_name, p.last_name));
|
|
1249
|
+
* ```
|
|
1250
|
+
*/
|
|
1251
|
+
listPatients: (connectorId: string, workspaceId: string, options?: HealthieListOptions & RequestOptions) => Promise<HealthiePatient[]>;
|
|
1252
|
+
/**
|
|
1253
|
+
* Trigger a patient sync from Healthie EHR.
|
|
1254
|
+
*
|
|
1255
|
+
* Fetches patient records from Healthie and updates the local cache.
|
|
1256
|
+
* Returns a summary of sync statistics.
|
|
1257
|
+
*
|
|
1258
|
+
* @param connectorId - UUID of the Healthie `ConnectorInstance`.
|
|
1259
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1260
|
+
* @param requestOptions - Optional request options.
|
|
1261
|
+
* @returns A `HealthieSyncResult` with sync count and any errors.
|
|
1262
|
+
*
|
|
1263
|
+
* @example
|
|
1264
|
+
* ```typescript
|
|
1265
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1266
|
+
* const result = await client.connectors.healthie.syncPatients(
|
|
1267
|
+
* 'ci_healthie_123',
|
|
1268
|
+
* 'ws_abc123',
|
|
1269
|
+
* );
|
|
1270
|
+
* console.log(`Synced ${result.synced} patients`);
|
|
1271
|
+
* ```
|
|
1272
|
+
*/
|
|
1273
|
+
syncPatients: (connectorId: string, workspaceId: string, requestOptions?: RequestOptions) => Promise<HealthieSyncResult>;
|
|
1274
|
+
/**
|
|
1275
|
+
* List appointment records from Healthie EHR.
|
|
1276
|
+
*
|
|
1277
|
+
* Returns all appointments from the Healthie account linked to the connector.
|
|
1278
|
+
* Optionally filter by `since` date to only get appointments modified since
|
|
1279
|
+
* a given timestamp.
|
|
1280
|
+
*
|
|
1281
|
+
* @param connectorId - UUID of the Healthie `ConnectorInstance`.
|
|
1282
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1283
|
+
* @param options - Optional list parameters including `since` (Date) filter.
|
|
1284
|
+
* @param requestOptions - Optional request options.
|
|
1285
|
+
* @returns An array of `HealthieAppointment` records.
|
|
1286
|
+
*
|
|
1287
|
+
* @example
|
|
1288
|
+
* ```typescript
|
|
1289
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1290
|
+
* const appointments = await client.connectors.healthie.listAppointments(
|
|
1291
|
+
* 'ci_healthie_123',
|
|
1292
|
+
* 'ws_abc123',
|
|
1293
|
+
* { since: new Date('2025-01-01') },
|
|
1294
|
+
* );
|
|
1295
|
+
* appointments.forEach(a => console.log(a.date, a.status));
|
|
1296
|
+
* ```
|
|
1297
|
+
*/
|
|
1298
|
+
listAppointments: (connectorId: string, workspaceId: string, options?: HealthieListOptions & RequestOptions) => Promise<HealthieAppointment[]>;
|
|
1299
|
+
/**
|
|
1300
|
+
* Trigger an appointment sync from Healthie EHR.
|
|
1301
|
+
*
|
|
1302
|
+
* Fetches appointment records from Healthie and updates the local cache.
|
|
1303
|
+
* Returns a summary of sync statistics.
|
|
1304
|
+
*
|
|
1305
|
+
* @param connectorId - UUID of the Healthie `ConnectorInstance`.
|
|
1306
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1307
|
+
* @param requestOptions - Optional request options.
|
|
1308
|
+
* @returns A `HealthieSyncResult` with sync count and any errors.
|
|
1309
|
+
*
|
|
1310
|
+
* @example
|
|
1311
|
+
* ```typescript
|
|
1312
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1313
|
+
* const result = await client.connectors.healthie.syncAppointments(
|
|
1314
|
+
* 'ci_healthie_123',
|
|
1315
|
+
* 'ws_abc123',
|
|
1316
|
+
* );
|
|
1317
|
+
* console.log(`Synced ${result.synced} appointments`);
|
|
1318
|
+
* ```
|
|
1319
|
+
*/
|
|
1320
|
+
syncAppointments: (connectorId: string, workspaceId: string, requestOptions?: RequestOptions) => Promise<HealthieSyncResult>;
|
|
1321
|
+
/**
|
|
1322
|
+
* Trigger a full sync of both patients and appointments from Healthie EHR.
|
|
1323
|
+
*
|
|
1324
|
+
* Fetches all patient and appointment records from Healthie and updates
|
|
1325
|
+
* the local cache. Returns a summary of sync statistics for both types.
|
|
1326
|
+
*
|
|
1327
|
+
* @param connectorId - UUID of the Healthie `ConnectorInstance`.
|
|
1328
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1329
|
+
* @param requestOptions - Optional request options.
|
|
1330
|
+
* @returns A `HealthieSyncAllResult` with patient and appointment sync counts.
|
|
1331
|
+
*
|
|
1332
|
+
* @example
|
|
1333
|
+
* ```typescript
|
|
1334
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1335
|
+
* const result = await client.connectors.healthie.syncAll(
|
|
1336
|
+
* 'ci_healthie_123',
|
|
1337
|
+
* 'ws_abc123',
|
|
1338
|
+
* );
|
|
1339
|
+
* console.log(`Synced ${result.patients_synced} patients, ${result.appointments_synced} appointments`);
|
|
1340
|
+
* ```
|
|
1341
|
+
*/
|
|
1342
|
+
syncAll: (connectorId: string, workspaceId: string, requestOptions?: RequestOptions) => Promise<HealthieSyncAllResult>;
|
|
1343
|
+
/**
|
|
1344
|
+
* Get the current sync status for the Healthie connector.
|
|
1345
|
+
*
|
|
1346
|
+
* Returns summary statistics about the last sync, including patient
|
|
1347
|
+
* and appointment counts, last sync timestamp, and any errors.
|
|
1348
|
+
*
|
|
1349
|
+
* @param connectorId - UUID of the Healthie `ConnectorInstance`.
|
|
1350
|
+
* @param workspaceId - UUID of the current workspace.
|
|
1351
|
+
* @param requestOptions - Optional request options.
|
|
1352
|
+
* @returns A `HealthieSyncStatus` object with sync statistics.
|
|
1353
|
+
*
|
|
1354
|
+
* @example
|
|
1355
|
+
* ```typescript
|
|
1356
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1357
|
+
* const status = await client.connectors.healthie.getStatus(
|
|
1358
|
+
* 'ci_healthie_123',
|
|
1359
|
+
* 'ws_abc123',
|
|
1360
|
+
* );
|
|
1361
|
+
* console.log(`Last synced: ${status.last_synced_at}`);
|
|
1362
|
+
* console.log(`Patients: ${status.patient_count}, Appointments: ${status.appointment_count}`);
|
|
1363
|
+
* ```
|
|
1364
|
+
*/
|
|
1365
|
+
getStatus: (connectorId: string, workspaceId: string, requestOptions?: RequestOptions) => Promise<HealthieSyncStatus>;
|
|
1366
|
+
};
|
|
1367
|
+
};
|
|
1368
|
+
//# sourceMappingURL=connectors.d.ts.map
|