From 476b923f888e7d785629c63d38ed287d957ad105 Mon Sep 17 00:00:00 2001 From: Kyle Burkett Date: Tue, 22 Nov 2022 10:47:38 -0500 Subject: [PATCH] add types --- package.json | 1 + types/Gruntfile.d.ts | 2 + types/clinics.d.ts | 419 ++++++++++++++++++++++++++++++ types/confirm.d.ts | 124 +++++++++ types/devices.d.ts | 17 ++ types/index.d.ts | 552 ++++++++++++++++++++++++++++++++++++++++ types/lib/common.d.ts | 36 +++ types/lib/id.d.ts | 1 + types/prescription.d.ts | 39 +++ types/tidepool.d.ts | 217 ++++++++++++++++ types/user.d.ts | 20 ++ 11 files changed, 1428 insertions(+) create mode 100644 types/Gruntfile.d.ts create mode 100644 types/clinics.d.ts create mode 100644 types/confirm.d.ts create mode 100644 types/devices.d.ts create mode 100644 types/index.d.ts create mode 100644 types/lib/common.d.ts create mode 100644 types/lib/id.d.ts create mode 100644 types/prescription.d.ts create mode 100644 types/tidepool.d.ts create mode 100644 types/user.d.ts diff --git a/package.json b/package.json index 5dd8d33..f26c788 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.50.0", "description": "Client-side library to interact with the Tidepool platform", "main": "tidepool.js", + "types": "types/index.d.ts", "scripts": { "test": "grunt test" }, diff --git a/types/Gruntfile.d.ts b/types/Gruntfile.d.ts new file mode 100644 index 0000000..cb50cca --- /dev/null +++ b/types/Gruntfile.d.ts @@ -0,0 +1,2 @@ +declare function _exports(grunt: any): void; +export = _exports; diff --git a/types/clinics.d.ts b/types/clinics.d.ts new file mode 100644 index 0000000..b072e74 --- /dev/null +++ b/types/clinics.d.ts @@ -0,0 +1,419 @@ +declare function _exports(common: any): { + /** + * Retrieve list of clinics. Requires admin app authorization + * + * @param {Object} [options] + * @param {Number} [options.limit] - Query result limit + * @param {Number} [options.offset] - Query offset + * @param {String} [options.email] - Email address + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getClinics: (options?: { + limit?: number; + offset?: number; + email?: string; + }, cb: Function) => Function; + /** + * Add a new clinic + * + * @param {Object} clinic - New clinic + * @param {String} [clinic.name] - Clinic name + * @param {String} [clinic.address] - Clinic address + * @param {String} [clinic.city] - Clinic city + * @param {String} [clinic.postalCode] - Clinic zip/postal code + * @param {String} [clinic.state] - Clinic state + * @param {String} [clinic.country] - Clinic country + * @param {Object[]} [clinic.phoneNumbers] - Array of phone number objects for the clinic + * @param {String} [clinic.phoneNumbers[].type] - Phone number description + * @param {String} [clinic.phoneNumbers[].number] - Phone number + * @param {String} [clinic.clinicType] - Type of clinic + * @param {Number} [clinic.clinicSize] - Patient population size + * @param {String} clinic.email - Primary email address for clinic + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + createClinic: (clinic: { + name?: string; + address?: string; + city?: string; + postalCode?: string; + state?: string; + country?: string; + phoneNumbers?: { + type?: string; + number?: string; + }; + clinicType?: string; + clinicSize?: number; + email: string; + }, cb: Function) => Function; + /** + * Retrieve a clinic + * + * @param {String} clinicId - Id of the clinic + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getClinic: (clinicId: string, cb: Function) => Function; + /** + * Retrieve a clinic by share code + * + * @param {String} shareCode - Share code of the clinic + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getClinicByShareCode: (shareCode: string, cb: Function) => Function; + /** + * Update a clinic + * + * @param {String} clinicId - Id of the clinic + * @param {Object} clinic + * @param {String} clinic.id - Clinic ID + * @param {String} [clinic.name] - Clinic name + * @param {String} [clinic.address] - Clinic address + * @param {String} [clinic.city] - Clinic city + * @param {String} [clinic.postalCode] - Clinic zip/postal code + * @param {String} [clinic.state] - Clinic state + * @param {String} [clinic.country] - Clinic country + * @param {Object[]} [clinic.phoneNumbers] - Array of phone number objects for the clinic + * @param {String} [clinic.phoneNumbers[].type] - Phone number description + * @param {String} [clinic.phoneNumbers[].number] - Phone number + * @param {String} [clinic.clinicType] - Type of clinic + * @param {Number} [clinic.clinicSize] - Patient population size + * @param {String} clinic.email - Primary email address for clinic + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + updateClinic: (clinicId: string, clinic: { + id: string; + name?: string; + address?: string; + city?: string; + postalCode?: string; + state?: string; + country?: string; + phoneNumbers?: { + type?: string; + number?: string; + }; + clinicType?: string; + clinicSize?: number; + email: string; + }, cb: Function) => Function; + /** + * Retrieve a list of clinicians for a clinic + * + * @param {String} clinicId - Id of the clinic + * @param {Object} [options] - Search options + * @param {String} [options.search] - Query + * @param {Number} [options.offset] - Page offset + * @param {Number} [options.limit] - Results per page + * @param {String} [options.email] - Email to search + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getCliniciansFromClinic: (clinicId: string, options?: { + search?: string; + offset?: number; + limit?: number; + email?: string; + }, cb: Function) => Function; + /** + * Get a clinician for a clinic + * + * @param {String} clinicId - Id of the clinic + * @param {String} clinicianId - Id of the clinician + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getClinician: (clinicId: string, clinicianId: string, cb: Function) => Function; + /** + * Update a clinician + * + * @param {String} clinicId - Id of the clinic + * @param {String} clinicianId - Id of the clinician + * @param {Object} clinician + * @param {String} clinician.id - String representation of a Tidepool User ID + * @param {String} [clinician.inviteId] - The id of the invite if it hasn't been accepted + * @param {String} clinician.email - The email of the clinician + * @param {String} clinician.name - The name of the clinician + * @param {String[]} clinician.roles - Array of string roles + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + updateClinician: (clinicId: string, clinicianId: string, clinician: { + id: string; + inviteId?: string; + email: string; + name: string; + roles: string[]; + }, cb: Function) => Function; + /** + * Remove association of clinic to clinician + * + * @param {String} clinicId - Id of the clinic + * @param {String} clinicianId - Id of the clinician + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + deleteClinicianFromClinic: (clinicId: string, clinicianId: string, cb: Function) => Function; + /** + * Remove association of clinic to patient + * + * @param {String} clinicId - Id of the clinic + * @param {String} patientId - Id of the patient + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + deletePatientFromClinic: (clinicId: string, patientId: string, cb: Function) => Function; + /** + * Get list of patients associated with clinic + * + * @param {String} clinicId - Id of the clinic + * @param {Object} [options] - search options + * @param {String} [options.search] - search query string + * @param {Number} [options.offset] - search page offset + * @param {Number} [options.limit] - results per page + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getPatientsForClinic: (clinicId: string, options?: { + search?: string; + offset?: number; + limit?: number; + }, cb: Function) => Function; + /** + * Create a new custodial patient account + * + * @param {String} clinicId - ID of the clinic + * @param {Object} patient - new patient + * @param {String} patient.email - The email address of the patient + * @param {String} patient.fullName - The full name of the patient + * @param {String} patient.birthDate - YYYY-MM-DD + * @param {String} [patient.mrn] - The medical record number of the patient + * @param {String[]} [patient.targetDevices] - Array of string target devices + * @param {Function} cb + */ + createClinicCustodialAccount: (clinicId: string, patient: { + email: string; + fullName: string; + birthDate: string; + mrn?: string; + targetDevices?: string[]; + }, cb: Function) => void; + /** + * Get a patient from clinic + * + * @param {String} clinicId - Id of the clinic + * @param {String} patientId - Id of the patient + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getPatientFromClinic: (clinicId: string, patientId: string, cb: Function) => Function; + /** + * Modify a patient from clinic + * + * @param {String} clinicId - Id of the clinic + * @param {String} patientId - Id of the patient + * @param {Object} patient - new patient + * @param {String} patient.email - The email address of the patient + * @param {String} patient.fullName - The full name of the patient + * @param {String} patient.birthDate - YYYY-MM-DD + * @param {String} [patient.mrn] - The medical record number of the patient + * @param {String[]} [patient.targetDevices] - Array of string target devices + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + updateClinicPatient: (clinicId: string, patientId: string, patient: { + email: string; + fullName: string; + birthDate: string; + mrn?: string; + targetDevices?: string[]; + }, cb: Function) => Function; + /** + * Send an invite to a clinician to join a clinic + * + * @param {String} clinicId - clinic ID + * @param {Object} clinician - clinician Invite object + * @param {String} clinician.email - clinician's email address + * @param {String[]} clinician.roles - array of clinician's roles + * @param {Function} cb + */ + inviteClinician: (clinicId: string, clinician: { + email: string; + roles: string[]; + }, cb: Function) => void; + /** + * Retrieve an invitation sent to clinician to join the clinic + * + * @param {String} clinicId - Id of the clinic + * @param {String} inviteId - Id of the invite + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getClinicianInvite: (clinicId: string, inviteId: string, cb: Function) => Function; + /** + * Resend the clinician invite + * + * @param {String} clinicId - clinic Id + * @param {String} inviteId - invite Id + * @param {Function} cb + */ + resendClinicianInvite: (clinicId: string, inviteId: string, cb: Function) => void; + /** + * Delete the outgoing clinician invite + * + * @param {String} clinicId - clinic Id + * @param {String} inviteId - invite Id + * @param {Function} cb + */ + deleteClinicianInvite: (clinicId: string, inviteId: string, cb: Function) => void; + /** + * Retrieve list of patient invitations for clinic + * + * @param {String} clinicId - Id of the clinic + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getPatientInvites: (clinicId: string, cb: Function) => Function; + /** + * Accept a pending invite from patient user + * + * @param {String} clinicId - Id of the clinic + * @param {String} inviteId - Id of the invite + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + acceptPatientInvitation: (clinicId: string, inviteId: string, cb: Function) => Function; + /** + * Revoke (as a patient) or decline (as a clinic) a pending invite from patient user + * + * @param {String} clinicId - Id of the clinic + * @param {String} inviteId - Id of the invite + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + deletePatientInvitation: (clinicId: string, inviteId: string, cb: Function) => Function; + /** + * Update permissions that a clinic has for patient + * + * @param {String} clinicId - Id of the clinic + * @param {String} patientId - Id of the patient + * @param {Object} permissions - New permissions + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + updatePatientPermissions: (clinicId: string, patientId: string, permissions: any, cb: Function) => Function; + /** + * Get list of clinics associated with patient + * + * @param {String} userId - Patient user id + * @param {Object} [options] - search options + * @param {Number} [options.offset] - search page offset + * @param {Number} [options.limit] - results per page + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getClinicsForPatient: (userId: string, options?: { + offset?: number; + limit?: number; + }, cb: Function) => Function; + /** + * Retrieve list of invitations to join a clinic + * + * @param {String} userId - User Id of the clinician + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getClinicianInvites: (userId: string, cb: Function) => Function; + /** + * Accept an invite to join a clinic as a clinician + * + * @param {String} userId - User Id of the clinician + * @param {String} inviteId - Id of the invite + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + acceptClinicianInvite: (userId: string, inviteId: string, cb: Function) => Function; + /** + * Dismisses an invite sent from a clinic to clinician + * + * @param {String} userId - User Id of invited clinician + * @param {String} inviteId - invite Id + * @param {Function} cb + */ + dismissClinicianInvite: (userId: string, inviteId: string, cb: Function) => void; + /** + * + * @param {String} clinicianId - Id of the clinician + * @param {Object} [options] + * @param {Number} [options.offset] - Page of results + * @param {Number} [options.limit] - Results per page + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + getClinicsForClinician: (clinicianId: string, options?: { + offset?: number; + limit?: number; + }, cb: Function) => Function; + /** + * Invite a clinic + * + * @param {String} shareCode - share code of the clinic to invite + * @param {Object} permissions - permissions to be given + * @param {String} patientId - id of the patient that sent the invite + * @param cb + * @returns {cb} cb(err, response) + */ + inviteClinic: (shareCode: string, permissions: any, patientId: string, cb: any, ...args: any[]) => any; + /** + * Invite a clinic + * + * @param {String} clinicId - Id of the clinic + * @param {Function} cb + * @returns {cb} cb(err, response) + */ + triggerInitialClinicMigration: (clinicId: string, cb: Function, ...args: any[]) => Function; + /** + * sendPatientUploadReminder + * + * @param {String} clinicId - clinic Id + * @param {String} patientId - id of the patient to send the reminder to + * @param {Function} cb + */ + sendPatientUploadReminder: (clinicId: string, patientId: string, cb: Function) => void; + /** + * createClinicPatientTag + * + * @param {String} clinicId - clinic Id + * @param {Object} patientTag - the patient tag to create + * @param {String} patientTag.name - the tag name + * @param {Function} cb + */ + createClinicPatientTag: (clinicId: string, patientTag: { + name: string; + }, cb: Function) => void; + /** + * updateClinicPatientTag + * + * @param {String} clinicId - clinic Id + * @param {String} patientTagId - id of patient tag to update + * @param {Object} patientTag - the updated patient tag + * @param {String} patientTag.name - the updated tag name + * @param {Function} cb + */ + updateClinicPatientTag: (clinicId: string, patientTagId: string, patientTag: { + name: string; + }, cb: Function) => void; + /** + * deleteClinicPatientTag + * + * @param {String} clinicId - clinic Id + * @param {String} patientTagId - id of patient tag to delete + * @param {Function} cb + */ + deleteClinicPatientTag: (clinicId: string, patientTagId: string, cb: Function) => void; +}; +export = _exports; diff --git a/types/confirm.d.ts b/types/confirm.d.ts new file mode 100644 index 0000000..7951848 --- /dev/null +++ b/types/confirm.d.ts @@ -0,0 +1,124 @@ +declare function _exports(common: any, deps: any): { + /** + * Start signup + * + * @param {String} invitedId - id of the user that signup if for + * @param cb + * @returns {cb} cb(err, response) + */ + signupStart: (invitedId: string, cb: any, ...args: any[]) => any; + /** + * Confirm a signup + * + * @param {String} signupId - id of the signup confirmation + * @param cb + * @returns {cb} cb(err, response) + */ + signupConfirm: (signupId: string, cb: any, ...args: any[]) => any; + /** + * Verify a custodial signup with birthday and password + * + * @param {String} signupId - id of the signup confirmation + * @param {String} birthday - birthday of the signup + * @param {String} password - password of the signup + * @param cb + * @returns {cb} cb(err, response) + */ + custodialSignupConfirm: (signupId: string, birthday: string, password: string, cb: any, ...args: any[]) => any; + /** + * Resend an existing invite + * + * @param {String} email - email of the user that send the invite + * @param cb + * @returns {cb} cb(err) + */ + signupResend: (email: string, cb: any, ...args: any[]) => any; + /** + * Cancel an existing invite + * + * @param {String} inviterId - id of the user that send the invite + * @param cb + * @returns {cb} cb(err, response) + */ + signupCancel: (invitedId: any, cb: any, ...args: any[]) => any; + /** + * Get the invites sent + * + * @param {String} inviterId - id of the user that send the invite + * @param cb + * @returns {cb} cb(err, response) + */ + invitesSent: (inviterId: string, cb: any, ...args: any[]) => any; + /** + * Get the invites received + * + * @param {String} inviteeId - id of the user who was invited + * @param cb + * @returns {cb} cb(err, response) + */ + invitesReceived: (inviteeId: string, cb: any, ...args: any[]) => any; + /** + * Invite a user + * + * @param {String} email - email of the user to invite + * @param {Object} permissions - permissions to be given + * @param {String} inviterId - id of the user that send the invite + * @param cb + * @returns {cb} cb(err, response) + */ + inviteUser: (email: string, permissions: any, inviterId: string, cb: any, ...args: any[]) => any; + /** + * Resend an invite + * + * @param {String} inviteId + * @param cb + * @returns {cb} cb(err, response) + */ + resendInvite: (inviteId: string, cb: any, ...args: any[]) => any; + /** + * Accept the invite + * + * @param {String} inviteId + * @param {String} inviteeId - id of the user who was invited + * @param {String} inviterId - id of the user that send the invite + * @param cb + * @returns {cb} cb(err, response) + */ + acceptInvite: (inviteId: string, inviteeId: string, inviterId: string, cb: any, ...args: any[]) => any; + /** + * Dismiss the invite + * + * @param {String} inviteId + * @param {String} inviteeId - id of the user who was invited + * @param {String} inviterId - id of the user that send the invite + * @param cb + * @returns {cb} cb(err, response) + */ + dismissInvite: (inviteId: string, inviteeId: string, inviterId: string, cb: any, ...args: any[]) => any; + /** + * Remove the invite + * + * @param {String} email - email of the user to remove + * @param {String} inviterId - id of the user that send the invite + * @param cb + * @returns {cb} cb(err, response) + */ + removeInvite: (email: string, inviterId: string, cb: any, ...args: any[]) => any; + /** + * Request a password reset + * + * @param {String} email - email of the user requesting the password reset + * @param cb + * @returns {cb} cb(err) + */ + requestPasswordReset: (email: string, cb: any, ...args: any[]) => any; + /** + * Confirm a password reset request with a new password + * + * @param {Object} payload - object with `key`, `email`, `password` + * @param cb + * @returns {cb} cb(err) + */ + confirmPasswordReset: (payload: any, cb: any, ...args: any[]) => any; +}; +export = _exports; diff --git a/types/devices.d.ts b/types/devices.d.ts new file mode 100644 index 0000000..04dada7 --- /dev/null +++ b/types/devices.d.ts @@ -0,0 +1,17 @@ +declare function _exports(common: any): { + /** + * Get all CGM devices + * + * @param cb + * @returns {cb} cb(err, response) + */ + getCGMDevices: (cb: any, ...args: any[]) => any; + /** + * Get all Pump devices + * + * @param cb + * @returns {cb} cb(err, response) + */ + getPumpDevices: (cb: any, ...args: any[]) => any; +}; +export = _exports; diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 0000000..61e188d --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,552 @@ +declare function _exports(config: any, deps: any): { + /** + * Do any requied initialization + */ + initialize: (cb: any) => any; + /** + * Url used for uploads to the platform + * + * @returns {String} url for uploads + */ + getUploadUrl: () => any; + hasDataHost: () => boolean; + setApiHost: (newhost: any) => void; + setUploadHost: (newhost: any) => void; + setDataHost: (newhost: any) => void; + setBlipHost: (newhost: any) => void; + makeBlipUrl: (path: any, extra: any) => any; + /** + * Post something to metrics. + * This call never errors, so the callback is optional; it will be called if supplied. + * This call also doesn't wait for the metrics call to return but returns immediately, + * so if the metrics site is down you won't know it. + * This call automatically adds a property client: true to the property list. + * + * @param eventname String name of event to post to kissmetrics + * @param properties Object list of key/value pairs to post as properties. + * @param cb If provided, is called without arguments after posting; this call never errors, so callback is optional. + * @returns {cb} cb() + */ + trackMetric: (eventname: any, properties: any, cb: any) => any; + /** + * Post an application error so that it can be logged + * + * This call never errors, so the callback is optional; it will be called if supplied. + * This call also doesn't wait for the call to return but returns immediately. + * + * This call automatically adds a property client: true to the property list. + * + * @param error Object the error that will be logged + * @param message String an optional message + * @param properties Object list of key/value pairs to post as properties. + * @param cb If provided, is called without arguments after posting; this call never errors, so callback is optional. + * @returns {cb} cb() + */ + logAppError: (error: any, message: any, properties: any, cb: any) => any; + /** + * Add a new or update an existing preferences for a user + * + * @param {String} userId id of the user you are updating the preferences of + * @param {Object} preferences object + * @param cb + * @returns {cb} cb(err, response) + */ + addOrUpdatePreferences: (userId: string, preferences: any, cb: any) => any; + /** + * Add a new or update an existing profile for a user + * + * @param {String} userId id of the user you are updating the profile of + * @param {Object} profile object + * @param cb + * @returns {cb} cb(err, response) + */ + addOrUpdateProfile: (userId: string, profile: any, cb: any) => any; + /** + * Add a new or update an existing settings for a user + * + * @param {String} userId id of the user you are updating the settings of + * @param {Object} settings object + * @param cb + * @returns {cb} cb(err, response) + */ + addOrUpdateSettings: (userId: string, settings: any, cb: any) => any; + /** + * Find a user's preferences + * + * @param {String} userId id of the user you are finding the preferences of + * @param cb + * @returns {cb} cb(err, response) + */ + findPreferences: (userId: string, cb: any) => any; + /** + * Find a user's profile + * + * @param {String} userId id of the user you are finding the profile of + * @param cb + * @returns {cb} cb(err, response) + */ + findProfile: (userId: string, cb: any) => any; + /** + * Find a user's settings + * + * @param {String} userId id of the user you are finding the settings of + * @param cb + * @returns {cb} cb(err, response) + */ + findSettings: (userId: string, cb: any) => any; + /** + * Get the users 'team' + * + * @param {String} userId id of the user + * @param cb + * @returns {cb} cb(err, response) + */ + getTeamMembers: (userId: string, cb: any, ...args: any[]) => any; + /** + * Get the users 'patients' + * + * @param {String} userId id of the user + * @param cb + * @returns {cb} cb(err, response) + */ + getViewableUsers: (userId: string, cb: any, ...args: any[]) => any; + /** + * Get the users 'patients' and their associated data + * includes profile, permissions and metadata + * + * @param {String} userId id of the user + * @param cb + * @returns {cb} cb(err, response) + */ + getAssociatedUsersDetails: (userId: string, cb: any, ...args: any[]) => any; + /** + * Get the users 'patients' to whom they can upload for. + * + * @param {String} userId of the user + * @param cb + * @returns {cb} cb(err, response) + */ + getUploadGroups: (userId: string, cb: any, ...args: any[]) => any; + /** + * Sets the access permissions for a specific user on the group for the currently logged in user + * + * @param userId - userId to have access permissions set for + * @param permissions - permissions to set + * @param cb - function(err, perms), called with error if exists and permissions as updated + */ + setAccessPermissions: (userId: any, permissions: any, cb: any) => any; + /** + * Sets the access permissions for a specific user on the given group + * + * @param groupId - the groupId we are setting user permissions on + * @param userId - userId to have access permissions set for + * @param permissions - permissions to set + * @param cb - function(err, perms), called with error if exists and permissions as updated + */ + setAccessPermissionsOnGroup: (groupId: any, userId: any, permissions: any, cb: any, ...args: any[]) => void; + /** + * Get the access permissions for a specific user on the given group + * + * @param groupId - the groupId we want permissions for + * @param userId - userId that has those permissions + * @param cb - function(err, perms), called with error if exists and permissions object + */ + getAccessPermissionsForGroup: (groupId: any, userId: any, cb: any, ...args: any[]) => void; + /** + * Get the listed users public info + * + * @param {Array} patientIds array of id's that we want the public info for + * @param cb + * @returns {cb} cb(err, response) + */ + getPatientsInfo: (patientIds: any[], cb: any, ...args: any[]) => any; + /** + * Get raw device data for the user + * + * @param {String} userId of the user to get the device data for + * @param {Object} options for the query + * @param cb + * @returns {cb} cb(err, response) + */ + getDeviceDataForUser: (userId: string, options: any, cb: any, ...args: any[]) => any; + /** + * Check the expected minimum versions for uploading + * + * @param cb + * @returns {cb} cb(err, response) + * e.g. {versions: {schema: 3, uploaderMinimum: '0.333.0'}} + */ + checkUploadVersions: (cb: any, ...args: any[]) => any; + /** + * Get server time + * + * @param cb + * @returns {cb} cb(err, response) + */ + getTime: (cb: any) => any; + /** + * Get the data sources for a given user + * + * @param {String} userId of the user to get the data sources for + * @param cb + * @returns {cb} cb(err, response) + */ + getDataSourcesForUser: (userId: string, cb: any, ...args: any[]) => any; + /** + * Create a dataset for the given user + * + * @param {String} userId of the user to create the dataset for + * @param {Object} info for the dataset + * @param cb + * @returns {cb} cb(err, response) + */ + createDatasetForUser: (userId: string, info: any, cb: any, ...args: any[]) => any; + /** + * Finalize the given dataset (close and post-process) + * + * @param {String} datasetId of the dataset to finalize + * @param cb + * @returns {cb} cb(err, response) + */ + finalizeDataset: (datasetId: string, cb: any, ...args: any[]) => any; + /** + * Add data to the given dataset + * + * @param {String} datasetId of the dataset to add data + * @param {Object} data to be added + * @param cb + * @returns {cb} cb(err, response) + */ + addDataToDataset: (datasetId: string, data: any, cb: any, ...args: any[]) => any; + /** + * Upload device data for the given user + * + * @param {String} userId of the user to get the device data for + * @param {Object} data to be uploaded + * @param cb + * @returns {cb} cb(err, response) + */ + uploadDeviceDataForUser: (userId: string, data: any, cb: any, ...args: any[]) => any; + /** + * Upload blob data for the given user + * + * @param {String} userId of the user to get the device data for + * @param {Object} blob to be uploaded + * @param {String} contentType of blob, e.g. 'application/json' + * @param cb + * @returns {cb} cb(err, response) + */ + uploadBlobForUser: (userId: string, blob: any, contentType: string, digest: any, cb: any, ...args: any[]) => any; + /** + * Start an device upload session by generating an uploadMeta record + * + * @param {Object} sessionInfo to initialise the upload session + * @param cb + * @returns {cb} cb(err, uploadMeta) + */ + startUploadSession: (sessionInfo: any, cb: any, ...args: any[]) => any; + /** + * Upload carelink data for the logged in user + * + * @param {Object} formData for the carelink upload + * @param cb + * @returns {cb} cb(err, response) + */ + uploadCarelinkDataForUser: (formData: any, cb: any, ...args: any[]) => any; + /** + * Upload carelink data for the logged in user + * + * @param {string} dataId for the carelink upload + * @param cb + * @returns {cb} cb(err, response) + */ + getCarelinkData: (dataId: string, cb: any, ...args: any[]) => any; + /** + * Get upload records for the given user and device + * + * @param {String} userId of the user + * @param {String} deviceId of the device + * @param {String} size of the array to return + * @param cb + * @returns {cb} cb(err, response) + */ + getUploadRecordsForDevice: (userId: string, deviceId: string, size: string, cb: any, ...args: any[]) => any; + /** + * Get messages for a team between the given dates + * + * @param {String} userId of the user to get the messages for + * @param {Object} options + * @param {String} options.start [start=''] the start date is optional + * @param {String} options.end [end=''] the end date is optional + * @param cb + * @returns {cb} cb(err, response) + */ + getAllMessagesForUser: (userId: string, options: { + start: string; + end: string; + }, cb: any, ...args: any[]) => any; + /** + * Get all notes within a specified date range + * + * @param {String} userId of the user to get the notes for + * @param {Object} options + * @param {String} options.start [start=''] the start date is optional + * @param {String} options.end [end=''] the end date is optional + * @param cb + * @returns {cb} cb(err, response) + */ + getNotesForUser: (userId: string, options: { + start: string; + end: string; + }, cb: any, ...args: any[]) => any; + /** + * Reply to a specfic message thread + * + * @param {Object} comment on the message thread + * @param {String} comment.timestamp + * @param {String} comment.messagetext + * @param {String} comment.groupid + * @param {String} comment.userid + * @param {String} comment.parentmessage + * @param cb + * @returns {cb} cb(err, response) + */ + replyToMessageThread: (comment: { + timestamp: string; + messagetext: string; + groupid: string; + userid: string; + parentmessage: string; + }, cb: any, ...args: any[]) => any; + /** + * Start a new message thread + * + * @param {Object} message that is the start of a new thread + * @param {String} message.messagetext + * @param {String} message.timestamp + * @param {String} message.groupid + * @param {String} message.userid + * @param cb + * @returns {cb} cb(err, response) + */ + startMessageThread: (message: { + messagetext: string; + timestamp: string; + groupid: string; + userid: string; + }, cb: any, ...args: any[]) => any; + /** + * Get a specific message thread + * + * @param {String} messageId of the root message + * @param cb + * @returns {cb} cb(err, response) + */ + getMessageThread: (messageId: string, cb: any, ...args: any[]) => any; + /** + * Edit an existing message + * + * @param {Object} edits for an existing message + * @param {String} edits.id of the message to edit + * @param {String} edits.messagetext [messagetext=''] updated text + * @param {String} edits.timestamp [timestamp=''] updated timestamp + * @param cb + * @returns {cb} cb(err, response) + */ + editMessage: (edits: { + id: string; + messagetext: string; + timestamp: string; + }, cb: any, ...args: any[]) => any; + /** + * Get URL for data export for a given user + * + * @param {String} userId of the user to get data for + * @param {String} loggedInUserId the userId of the logged in user + * @param {Object} options + * @param {String} options.format 'json'|'excel' + * @param {String} options.startDate + * @param {String} options.endDate + * @param cb + * @returns {cb} cb(err, response) + */ + getExportDataURL: (userId: string, loggedInUserId: string, options: { + format: string; + startDate: string; + endDate: string; + }, cb: any, ...args: any[]) => any; + /** + * User + */ + acceptTerms: (user: any, cb: any, ...args: any[]) => any; + createCustodialAccount: (profile: any, cb: any) => any; + destroySession: () => void; + getCurrentUser: (cb: any, ...args: any[]) => any; + getUserId: () => string; + isLoggedIn: () => boolean; + login: (user: any, options: any, cb: any) => any; + oauthLogin: (oauthToken: any, cb: any) => any; + logout: (cb: any, ...args: any[]) => any; + signup: (user: any, options: any, cb: any) => any; + updateCurrentUser: (user: any, cb: any, ...args: any[]) => any; + updateCustodialUser: (user: any, id: any, cb: any, ...args: any[]) => any; + createRestrictedTokenForUser: (userId: string, restrictedTokenRequest: string, cb: any, ...args: any[]) => any; + createOAuthProviderAuthorization: (provider: string, restrictedToken: string, cb: any, ...args: any[]) => any; + deleteOAuthProviderAuthorization: (provider: string, cb: any, ...args: any[]) => any; + /** + * Signup + */ + signupStart: (invitedId: string, cb: any, ...args: any[]) => any; + signupConfirm: (signupId: string, cb: any, ...args: any[]) => any; + custodialSignupConfirm: (signupId: string, birthday: string, password: string, cb: any, ...args: any[]) => any; + signupResend: (email: string, cb: any, ...args: any[]) => any; + signupCancel: (invitedId: any, cb: any, ...args: any[]) => any; + /** + * Invites + */ + invitesSent: (inviterId: string, cb: any, ...args: any[]) => any; + invitesReceived: (inviteeId: string, cb: any, ...args: any[]) => any; + inviteUser: (email: string, permissions: any, inviterId: string, cb: any, ...args: any[]) => any; + resendInvite: (inviteId: string, cb: any, ...args: any[]) => any; + acceptInvite: (inviteId: string, inviteeId: string, inviterId: string, cb: any, ...args: any[]) => any; + dismissInvite: (inviteId: string, inviteeId: string, inviterId: string, cb: any, ...args: any[]) => any; + removeInvite: (email: string, inviterId: string, cb: any, ...args: any[]) => any; + /** + * Password reset + */ + requestPasswordReset: (email: string, cb: any, ...args: any[]) => any; + confirmPasswordReset: (payload: any, cb: any, ...args: any[]) => any; + /** + * Prescriptions + */ + createPrescription: (clinicId: string, prescription: any, cb: any, ...args: any[]) => any; + createPrescriptionRevision: (clinicId: string, revision: any, prescriptionId: string, cb: any, ...args: any[]) => any; + deletePrescription: (clinicId: string, prescriptionId: string, cb: any, ...args: any[]) => any; + getPrescriptionsForClinic: (clinicId: string, cb: any, ...args: any[]) => any; + /** + * Devices + */ + getCGMDevices: (cb: any, ...args: any[]) => any; + getPumpDevices: (cb: any, ...args: any[]) => any; + /** + * Clinics + */ + getClinics: (options?: { + limit?: number; + offset?: number; + email?: string; + }, cb: Function) => Function; + createClinic: (clinic: { + name?: string; + address?: string; + city?: string; + postalCode?: string; + state?: string; + country?: string; + phoneNumbers?: { + type?: string; + number?: string; + }[]; + clinicType?: string; + clinicSize?: number; + email: string; + }, cb: Function) => Function; + getClinic: (clinicId: string, cb: Function) => Function; + getClinicByShareCode: (shareCode: string, cb: Function) => Function; + updateClinic: (clinicId: string, clinic: { + id: string; + name?: string; + address?: string; + city?: string; + postalCode?: string; + state?: string; + country?: string; + phoneNumbers?: { + type?: string; + number?: string; + }[]; + clinicType?: string; /** + * format error with response body and session token + * + * @param {Error} err with the response body + * @returns {Error} + */ + clinicSize?: number; + email: string; + }, cb: Function) => Function; + getCliniciansFromClinic: (clinicId: string, options?: { + search?: string; + offset?: number; + limit?: number; + email?: string; + }, cb: Function) => Function; + getClinician: (clinicId: string, clinicianId: string, cb: Function) => Function; + updateClinician: (clinicId: string, clinicianId: string, clinician: { + id: string; + inviteId?: string; + email: string; + name: string; + roles: string[]; + }, cb: Function) => Function; + deleteClinicianFromClinic: (clinicId: string, clinicianId: string, cb: Function) => Function; + deletePatientFromClinic: (clinicId: string, patientId: string, cb: Function) => Function; + getPatientsForClinic: (clinicId: string, options?: { + search?: string; + offset?: number; + limit?: number; + }, cb: Function) => Function; + createClinicCustodialAccount: (clinicId: string, patient: { + email: string; + fullName: string; /** + * Find a user's preferences + * + * @param {String} userId id of the user you are finding the preferences of + * @param cb + * @returns {cb} cb(err, response) + */ + birthDate: string; + mrn?: string; + targetDevices?: string[]; + }, cb: Function) => void; + getPatientFromClinic: (clinicId: string, patientId: string, cb: Function) => Function; + updateClinicPatient: (clinicId: string, patientId: string, patient: { + email: string; + fullName: string; + birthDate: string; + mrn?: string; + targetDevices?: string[]; + }, cb: Function) => Function; + inviteClinician: (clinicId: string, clinician: { + email: string; + roles: string[]; + }, cb: Function) => void; + getClinicianInvite: (clinicId: string, inviteId: string, cb: Function) => Function; + resendClinicianInvite: (clinicId: string, inviteId: string, cb: Function) => void; + deleteClinicianInvite: (clinicId: string, inviteId: string, cb: Function) => void; + getPatientInvites: (clinicId: string, cb: Function) => Function; + acceptPatientInvitation: (clinicId: string, inviteId: string, cb: Function) => Function; + deletePatientInvitation: (clinicId: string, inviteId: string, cb: Function) => Function; + updatePatientPermissions: (clinicId: string, patientId: string, permissions: any, cb: Function) => Function; + getClinicsForPatient: (userId: string, options?: { + offset?: number; + limit?: number; + }, cb: Function) => Function; + getClinicianInvites: (userId: string, cb: Function) => Function; + acceptClinicianInvite: (userId: string, inviteId: string, cb: Function) => Function; + dismissClinicianInvite: (userId: string, inviteId: string, cb: Function) => void; + getClinicsForClinician: (clinicianId: string, options?: { + offset?: number; + limit?: number; + }, cb: Function) => Function; + inviteClinic: (shareCode: string, permissions: any, patientId: string, cb: any, ...args: any[]) => any; + triggerInitialClinicMigration: (clinicId: string, cb: Function, ...args: any[]) => Function; + sendPatientUploadReminder: (clinicId: string, patientId: string, cb: Function) => void; + createClinicPatientTag: (clinicId: string, patientTag: { + name: string; + }, cb: Function) => void; + updateClinicPatientTag: (clinicId: string, patientTagId: string, patientTag: { + name: string; + }, cb: Function) => void; + deleteClinicPatientTag: (clinicId: string, patientTagId: string, cb: Function) => void; +}; +export = _exports; diff --git a/types/lib/common.d.ts b/types/lib/common.d.ts new file mode 100644 index 0000000..4ccd740 --- /dev/null +++ b/types/lib/common.d.ts @@ -0,0 +1,36 @@ +declare function _exports(cfg: any, deps: any): { + SESSION_TOKEN_HEADER: string; + TRACE_SESSION_HEADER: string; + DIGEST_HEADER: string; + STATUS_BAD_REQUEST: number; + STATUS_UNAUTHORIZED: number; + STATUS_UNAUTHORIZED_MSG: string; + STATUS_OFFLINE: number; + STATUS_OFFLINE_MSG: string; + syncToken: (newToken: any) => void; + getToken: () => any; + setSessionTrace: (newTrace: any) => void; + getSessionTrace: () => any; + makeAPIUrl: (path: any, extra: any) => any; + makeUploadUrl: (path: any, query: any) => any; + makeDataUrl: (path: any, query: any) => any; + makeExportUrl: (userId: any, query: any) => any; + makeBlipUrl: (path: any, extra: any) => any; + setBlipHost: (newhost: any) => void; + setUploadHost: (newhost: any) => void; + setDataHost: (newhost: any) => void; + setApiHost: (newhost: any) => void; + getUploadUrl: () => any; + hasDataHost: () => boolean; + handleHttpError: (res: any, cb: any) => any; + assertArgumentsSize: (argumentsObj: any, length: any) => void; + serviceCallChecks: (sadCb: any, happyCb: any) => any; + appendUrlParamsFromOptions: (url: string, options: any, allowedParams: any) => string; + serialize: (obj: any) => string; + doGetWithToken: (path: any, codes: any, cb: any) => any; + doPostWithToken: (path: any, data: any, codes: any, cb: any) => any; + doPutWithToken: (path: any, data: any, codes: any, cb: any) => any; + doPatchWithToken: (path: any, data: any, codes: any, cb: any) => any; + doDeleteWithToken: (path: any, codes: any, cb: any) => any; +}; +export = _exports; diff --git a/types/lib/id.d.ts b/types/lib/id.d.ts new file mode 100644 index 0000000..c1dd4d7 --- /dev/null +++ b/types/lib/id.d.ts @@ -0,0 +1 @@ +export function generateId(fields: any): string; diff --git a/types/prescription.d.ts b/types/prescription.d.ts new file mode 100644 index 0000000..bee6df6 --- /dev/null +++ b/types/prescription.d.ts @@ -0,0 +1,39 @@ +declare function _exports(common: any): { + /** + * Create a prescription + * + * @param {String} clinicId - id of the clinic + * @param {Object} prescription - prescription to create + * @param cb + * @returns {cb} cb(err, response) + */ + createPrescription: (clinicId: string, prescription: any, cb: any, ...args: any[]) => any; + /** + * Create a prescription revision + * + * @param {String} clinicId - id of the clinic + * @param {Object} revision - prescription revision to create + * @param {String} prescriptionId - prescription id to attach revision to + * @param cb + * @returns {cb} cb(err, response) + */ + createPrescriptionRevision: (clinicId: string, revision: any, prescriptionId: string, cb: any, ...args: any[]) => any; + /** + * Delete a prescription + * + * @param {String} clinicId - id of the clinic + * @param {String} prescriptionId - id of prescription to delete + * @param cb + * @returns {cb} cb(err, response) + */ + deletePrescription: (clinicId: string, prescriptionId: string, cb: any, ...args: any[]) => any; + /** + * Get all prescriptions for a clinic + * + * @param {String} clinicId - id of the clinic + * @param cb + * @returns {cb} cb(err, response) + */ + getPrescriptionsForClinic: (clinicId: string, cb: any, ...args: any[]) => any; +}; +export = _exports; diff --git a/types/tidepool.d.ts b/types/tidepool.d.ts new file mode 100644 index 0000000..f57afad --- /dev/null +++ b/types/tidepool.d.ts @@ -0,0 +1,217 @@ +declare function _exports(options: any): { + initialize: (cb: any) => any; + getUploadUrl: () => any; + hasDataHost: () => boolean; + setApiHost: (newhost: any) => void; + setUploadHost: (newhost: any) => void; + setDataHost: (newhost: any) => void; + setBlipHost: (newhost: any) => void; + makeBlipUrl: (path: any, extra: any) => any; + trackMetric: (eventname: any, properties: any, cb: any) => any; + logAppError: (error: any, message: any, properties: any, cb: any) => any; + addOrUpdatePreferences: (userId: string, preferences: any, cb: any) => any; + addOrUpdateProfile: (userId: string, profile: any, cb: any) => any; + addOrUpdateSettings: (userId: string, settings: any, cb: any) => any; + findPreferences: (userId: string, cb: any) => any; + findProfile: (userId: string, cb: any) => any; + findSettings: (userId: string, cb: any) => any; + getTeamMembers: (userId: string, cb: any, ...args: any[]) => any; + getViewableUsers: (userId: string, cb: any, ...args: any[]) => any; + getAssociatedUsersDetails: (userId: string, cb: any, ...args: any[]) => any; + getUploadGroups: (userId: string, cb: any, ...args: any[]) => any; + setAccessPermissions: (userId: any, permissions: any, cb: any) => any; + setAccessPermissionsOnGroup: (groupId: any, userId: any, permissions: any, cb: any, ...args: any[]) => void; + getAccessPermissionsForGroup: (groupId: any, userId: any, cb: any, ...args: any[]) => void; + getPatientsInfo: (patientIds: any[], cb: any, ...args: any[]) => any; + getDeviceDataForUser: (userId: string, options: any, cb: any, ...args: any[]) => any; + checkUploadVersions: (cb: any, ...args: any[]) => any; + getTime: (cb: any) => any; + getDataSourcesForUser: (userId: string, cb: any, ...args: any[]) => any; + createDatasetForUser: (userId: string, info: any, cb: any, ...args: any[]) => any; + finalizeDataset: (datasetId: string, cb: any, ...args: any[]) => any; + addDataToDataset: (datasetId: string, data: any, cb: any, ...args: any[]) => any; + uploadDeviceDataForUser: (userId: string, data: any, cb: any, ...args: any[]) => any; + uploadBlobForUser: (userId: string, blob: any, contentType: string, digest: any, cb: any, ...args: any[]) => any; + startUploadSession: (sessionInfo: any, cb: any, ...args: any[]) => any; + uploadCarelinkDataForUser: (formData: any, cb: any, ...args: any[]) => any; + getCarelinkData: (dataId: string, cb: any, ...args: any[]) => any; + getUploadRecordsForDevice: (userId: string, deviceId: string, size: string, cb: any, ...args: any[]) => any; + getAllMessagesForUser: (userId: string, options: { + start: string; + end: string; + }, cb: any, ...args: any[]) => any; + getNotesForUser: (userId: string, options: { + start: string; + end: string; + }, cb: any, ...args: any[]) => any; + replyToMessageThread: (comment: { + timestamp: string; + messagetext: string; + groupid: string; + userid: string; + parentmessage: string; + }, cb: any, ...args: any[]) => any; + startMessageThread: (message: { + messagetext: string; + timestamp: string; + groupid: string; + userid: string; + }, cb: any, ...args: any[]) => any; + getMessageThread: (messageId: string, cb: any, ...args: any[]) => any; + editMessage: (edits: { + id: string; + messagetext: string; + timestamp: string; + }, cb: any, ...args: any[]) => any; + getExportDataURL: (userId: string, loggedInUserId: string, options: { + format: string; + startDate: string; + endDate: string; + }, cb: any, ...args: any[]) => any; + acceptTerms: (user: any, cb: any, ...args: any[]) => any; + createCustodialAccount: (profile: any, cb: any) => any; + destroySession: () => void; + getCurrentUser: (cb: any, ...args: any[]) => any; + getUserId: () => string; + isLoggedIn: () => boolean; + login: (user: any, options: any, cb: any) => any; + oauthLogin: (oauthToken: any, cb: any) => any; + logout: (cb: any, ...args: any[]) => any; + signup: (user: any, options: any, cb: any) => any; + updateCurrentUser: (user: any, cb: any, ...args: any[]) => any; + updateCustodialUser: (user: any, id: any, cb: any, ...args: any[]) => any; + createRestrictedTokenForUser: (userId: string, restrictedTokenRequest: string, cb: any, ...args: any[]) => any; + createOAuthProviderAuthorization: (provider: string, restrictedToken: string, cb: any, ...args: any[]) => any; + deleteOAuthProviderAuthorization: (provider: string, cb: any, ...args: any[]) => any; + signupStart: (invitedId: string, cb: any, ...args: any[]) => any; + signupConfirm: (signupId: string, cb: any, ...args: any[]) => any; + custodialSignupConfirm: (signupId: string, birthday: string, password: string, cb: any, ...args: any[]) => any; + signupResend: (email: string, cb: any, ...args: any[]) => any; + signupCancel: (invitedId: any, cb: any, ...args: any[]) => any; + invitesSent: (inviterId: string, cb: any, ...args: any[]) => any; + invitesReceived: (inviteeId: string, cb: any, ...args: any[]) => any; + inviteUser: (email: string, permissions: any, inviterId: string, cb: any, ...args: any[]) => any; + resendInvite: (inviteId: string, cb: any, ...args: any[]) => any; + acceptInvite: (inviteId: string, inviteeId: string, inviterId: string, cb: any, ...args: any[]) => any; + dismissInvite: (inviteId: string, inviteeId: string, inviterId: string, cb: any, ...args: any[]) => any; + removeInvite: (email: string, inviterId: string, cb: any, ...args: any[]) => any; + requestPasswordReset: (email: string, cb: any, ...args: any[]) => any; + confirmPasswordReset: (payload: any, cb: any, ...args: any[]) => any; + createPrescription: (clinicId: string, prescription: any, cb: any, ...args: any[]) => any; + createPrescriptionRevision: (clinicId: string, revision: any, prescriptionId: string, cb: any, ...args: any[]) => any; + deletePrescription: (clinicId: string, prescriptionId: string, cb: any, ...args: any[]) => any; + getPrescriptionsForClinic: (clinicId: string, cb: any, ...args: any[]) => any; + getCGMDevices: (cb: any, ...args: any[]) => any; + getPumpDevices: (cb: any, ...args: any[]) => any; + getClinics: (options?: { + limit?: number; + offset?: number; + email?: string; + }, cb: Function) => Function; + createClinic: (clinic: { + name?: string; + address?: string; + city?: string; + postalCode?: string; + state?: string; + country?: string; + phoneNumbers?: { + type?: string; + number?: string; + }[]; + clinicType?: string; + clinicSize?: number; + email: string; + }, cb: Function) => Function; + getClinic: (clinicId: string, cb: Function) => Function; + getClinicByShareCode: (shareCode: string, cb: Function) => Function; + updateClinic: (clinicId: string, clinic: { + id: string; + name?: string; + address?: string; + city?: string; + postalCode?: string; + state?: string; + country?: string; + phoneNumbers?: { + type?: string; + number?: string; + }[]; + clinicType?: string; + clinicSize?: number; + email: string; + }, cb: Function) => Function; + getCliniciansFromClinic: (clinicId: string, options?: { + search?: string; + offset?: number; + limit?: number; + email?: string; + }, cb: Function) => Function; + getClinician: (clinicId: string, clinicianId: string, cb: Function) => Function; + updateClinician: (clinicId: string, clinicianId: string, clinician: { + id: string; + inviteId?: string; + email: string; + name: string; + roles: string[]; + }, cb: Function) => Function; + deleteClinicianFromClinic: (clinicId: string, clinicianId: string, cb: Function) => Function; + deletePatientFromClinic: (clinicId: string, patientId: string, cb: Function) => Function; + getPatientsForClinic: (clinicId: string, options?: { + search?: string; + offset?: number; + limit?: number; + }, cb: Function) => Function; + createClinicCustodialAccount: (clinicId: string, patient: { + email: string; + fullName: string; + birthDate: string; + mrn?: string; + targetDevices?: string[]; + }, cb: Function) => void; + getPatientFromClinic: (clinicId: string, patientId: string, cb: Function) => Function; + updateClinicPatient: (clinicId: string, patientId: string, patient: { + email: string; + fullName: string; + birthDate: string; + mrn?: string; + targetDevices?: string[]; + }, cb: Function) => Function; + inviteClinician: (clinicId: string, clinician: { + email: string; + roles: string[]; + }, cb: Function) => void; + getClinicianInvite: (clinicId: string, inviteId: string, cb: Function) => Function; + resendClinicianInvite: (clinicId: string, inviteId: string, cb: Function) => void; + deleteClinicianInvite: (clinicId: string, inviteId: string, cb: Function) => void; + getPatientInvites: (clinicId: string, cb: Function) => Function; + acceptPatientInvitation: (clinicId: string, inviteId: string, cb: Function) => Function; + deletePatientInvitation: (clinicId: string, inviteId: string, cb: Function) => Function; + updatePatientPermissions: (clinicId: string, patientId: string, permissions: any, cb: Function) => Function; + getClinicsForPatient: (userId: string, options?: { + offset?: number; + limit?: number; + }, cb: Function) => Function; + getClinicianInvites: (userId: string, cb: Function) => Function; + acceptClinicianInvite: (userId: string, inviteId: string, cb: Function) => Function; + dismissClinicianInvite: (userId: string, inviteId: string, cb: Function) => void; + getClinicsForClinician: (clinicianId: string, options?: { + offset?: number; + limit?: number; + }, cb: Function) => Function; + inviteClinic: (shareCode: string, permissions: any, patientId: string, cb: any, ...args: any[]) => any; + triggerInitialClinicMigration: (clinicId: string, cb: Function, ...args: any[]) => Function; + sendPatientUploadReminder: (clinicId: string, patientId: string, cb: Function) => void; + createClinicPatientTag: (clinicId: string, patientTag: { + name: string; + }, cb: Function) => void; + updateClinicPatientTag: (clinicId: string, patientTagId: string, patientTag: { + name: string; + }, cb: Function) => void; + deleteClinicPatientTag: (clinicId: string, patientTagId: string, cb: Function) => void; +}; +declare namespace _exports { + export { makeClient as client }; +} +export = _exports; +import makeClient = require("./index"); diff --git a/types/user.d.ts b/types/user.d.ts new file mode 100644 index 0000000..39724fa --- /dev/null +++ b/types/user.d.ts @@ -0,0 +1,20 @@ +declare function _exports(common: any, config: any, deps: any): { + acceptTerms: (user: any, cb: any, ...args: any[]) => any; + createCustodialAccount: (profile: any, cb: any) => any; + destroySession: () => void; + getCurrentUser: (cb: any, ...args: any[]) => any; + getUserId: () => string; + getUserToken: () => string; + isLoggedIn: () => boolean; + login: (user: any, options: any, cb: any) => any; + oauthLogin: (oauthToken: any, cb: any) => any; + logout: (cb: any, ...args: any[]) => any; + signup: (user: any, options: any, cb: any) => any; + initialize: (cb: any) => any; + updateCurrentUser: (user: any, cb: any, ...args: any[]) => any; + updateCustodialUser: (user: any, id: any, cb: any, ...args: any[]) => any; + createRestrictedTokenForUser: (userId: string, restrictedTokenRequest: string, cb: any, ...args: any[]) => any; + createOAuthProviderAuthorization: (provider: string, restrictedToken: string, cb: any, ...args: any[]) => any; + deleteOAuthProviderAuthorization: (provider: string, cb: any, ...args: any[]) => any; +}; +export = _exports;