import { type ChannelUpdateCallback, type ErrorCallback, type Subscription, type SubscriptionOptions } from "./subscribe.js"; import { type Account, type AccountInvite, type ActionResult, type AlarmSetOptions, type Archive, type ArchiveListOptions, type BillingPlan, type CalibrationRecord, type DataUsage, type Device, type DeviceChannel, type DeviceDataUsage, type DeviceEvent, type DeviceFilter, type DeviceGroup, type DeviceHistory, type EventFilter, type FanSettings, type FirmwareInfo, type NotificationSettings, type SearchOptions, type SearchResult, type ShareResult, type TemperatureGuide, type ThermoworksConfig, type User } from "./types.js"; /** * Client for the ThermoWorks Cloud service. * * @example * ```ts * const client = new ThermoworksCloud({ * email: process.env.THERMOWORKS_EMAIL!, * password: process.env.THERMOWORKS_PASSWORD!, * }); * * const devices = await client.getDevices(); * for (const device of devices) { * const channel = await client.getDeviceChannel(device.serial, 1); * console.log(`${device.label}: ${channel.value}°${channel.units}`); * } * * client.close(); * ``` */ export declare class ThermoworksCloud { private readonly config; private session; private sessionPromise; private cachedAccountId; private closed; private readonly activeSubscriptions; constructor(config: ThermoworksConfig); /** Get the authenticated user's information. */ getUser(): Promise; /** Get the authenticated user's notification preferences. */ getNotificationSettings(): Promise; /** * Update the authenticated user's notification preferences. * * Performs a read-merge-write to ensure unspecified fields retain * their current values (Firestore updateMask replaces the entire map). */ updateNotificationSettings(settings: Partial): Promise; /** Get all devices for the authenticated user, with optional filtering. */ getDevices(filter?: DeviceFilter): Promise; /** Get a single device by serial number. */ getDevice(serial: string): Promise; /** Get a channel reading for a device. Channels are 1-indexed. */ getDeviceChannel(serial: string, channel: number): Promise; /** * Get all channels for a device. Probes all channels 1-9, skipping any gaps. */ getAllDeviceChannels(serial: string): Promise; /** * Compute the average temperature across all temperature channels for a device. * Excludes humidity channels (units "H") and channels with no reading. * Returns null if no temperature channels have readings. */ getAverageTemperature(serial: string): Promise<{ value: number; units: string; } | null>; /** * Set alarm thresholds on a device channel. * * Performs a partial update - only the provided fields are modified. * At least one of `high` or `low` must be specified. * * @example * ```ts * // Set a high alarm at 275°F * await client.setAlarm("ABC123", 1, { * high: { value: 275, units: "F", enabled: true }, * }); * * // Set both high and low alarms * await client.setAlarm("ABC123", 1, { * high: { value: 275, units: "F", enabled: true }, * low: { value: 32, units: "F", enabled: true }, * }); * ``` */ setAlarm(serial: string, channel: number, config: AlarmSetOptions): Promise; /** Get account metadata. */ getAccount(): Promise; /** Get total data storage usage for the authenticated user's account. */ getDataUsage(): Promise; /** Get per-device data storage usage for the authenticated user's account. */ getDataUsageByDevice(): Promise; /** Get the billing plan for the authenticated user's account. */ getBillingPlan(): Promise; /** Get pending invitations for the authenticated user's account. */ getInvites(): Promise; /** Remove a user from the authenticated user's account. */ removeUser(userId: string): Promise; /** Get events for the authenticated user's account. */ getEvents(filter?: EventFilter): Promise; /** Get events for a specific device. */ getDeviceEvents(serial: string, limit?: number): Promise; /** Get archived sessions for a device. */ getArchives(serial: string, options?: ArchiveListOptions): Promise; /** Get a specific archive by ID. */ getArchive(serial: string, archiveId: string): Promise; /** Get calibration records for a device. */ getCalibration(serial: string): Promise; /** Get firmware info for a device type. */ getFirmwareInfo(deviceType: string): Promise; /** Get the cooking temperature guide. */ getTemperatureGuide(): Promise; /** Search across devices, accounts, or users via Typesense. */ search(query: string, options: SearchOptions): Promise; /** Start a monitoring session for the given device. */ startSession(serial: string, label?: string): Promise; /** End an active monitoring session for the given device. */ endSession(serial: string): Promise; /** Clear session data for the given device. */ clearSession(serial: string): Promise; /** Reset the min/max readings for a specific device channel. */ resetMinMax(serial: string, channel: number): Promise; /** Clear all events for the given device. */ clearEvents(serial: string): Promise; /** Update device state/settings via a Cloud Function. */ updateDeviceState(serial: string, state: Record): Promise; /** Rename a device. */ renameDevice(serial: string, name: string): Promise; /** Factory reset a device. */ factoryReset(serial: string): Promise; /** Share a device's live state publicly via a shareable link. */ shareDevice(serial: string): Promise; /** Share an archive publicly via a shareable link. */ shareArchive(serial: string, archiveId: string): Promise; /** Retrieve full historical temperature time-series data from BigQuery. */ getHistory(serial: string): Promise; /** * Get device groups for the authenticated user. * * Reads the user profile's `deviceGroupOrDeviceOrder` field to identify * group references, then fetches each group's details from the account's * `deviceGroups` subcollection. */ getDeviceGroups(): Promise; /** * Create a new device group in the account's deviceGroups subcollection. */ createDeviceGroup(name: string, devices: string[]): Promise; /** * Delete a device group. * * @throws Error - This method is not yet supported as the full device group * API is not documented. */ deleteDeviceGroup(_groupId: string): Promise; /** * Add a device to an existing group by updating the group's devices array. */ addDeviceToGroup(groupId: string, serial: string): Promise; /** * Remove a device from a group by updating the group's devices array. */ removeDeviceFromGroup(groupId: string, serial: string): Promise; /** Get the current fan/blower controller state for a device. Returns `null` if the device has no fan. */ getFanState(serial: string): Promise; /** Set the fan controller target temperature. */ setFanTarget(serial: string, targetTemp: number): Promise; /** Enable or disable the fan controller connection. */ setFanEnabled(serial: string, enabled: boolean): Promise; /** * @deprecated Use the top-level methods `startSession`, `endSession`, * `clearSession`, `resetMinMax`, and `clearEvents` instead. */ readonly actions: { startSession: (serial: string, label?: string) => Promise; endSession: (serial: string) => Promise; clearSession: (serial: string) => Promise; resetMinMax: (serial: string, channel: number) => Promise; clearEvents: (serial: string) => Promise; }; /** * Subscribe to real-time channel updates for a device via polling. * * Immediately fetches the current state, then polls at the configured * interval. The callback is only invoked when a channel's value, units, * or status actually changes (deduplication). * * @example * ```ts * const sub = client.subscribe("ABC123", (update) => { * console.log(`Ch${update.channel}: ${update.value}°${update.units}`); * }, { intervalMs: 5000, onError: console.error }); * * // Later: stop polling * sub.unsubscribe(); * ``` */ subscribe(serial: string, callback: ChannelUpdateCallback, options?: SubscriptionOptions & { onError?: ErrorCallback; }): Subscription; /** Close the client and release resources. Stops all active subscriptions. */ close(): void; private ensureSession; private resolveAccountId; /** Fetch a Firestore document and return its fields, or throw NotFoundError. */ private fetchDocFields; /** Call a Cloud Function and return the result as an ActionResult. */ private callAction; } //# sourceMappingURL=client.d.ts.map