import { UserInterface } from '../models/userModel'; import { Device } from '../devices/device'; import { RequestOutput } from '../providers/httpProvider'; import { TopicData } from './mqttService'; /** * Skill Service. */ declare class SkillService { /** * Temporary User Devices. * * @protected */ protected tempUserDevices: TempUserDevices; /** * Temporary User State Callbacks. * * @protected */ protected tempUserStateCallbacks: TempUserStateCallbacks; /** * Yandex Callbacks initialization. * * @param topic * @param oldMessage * @param newMessage * @returns Promise */ initYandexCallbacks(topic: string, oldMessage: string | undefined, newMessage: string): Promise; /** * Execute temporary user state callback. * * @param user * @param devices * @returns Promise */ execTempUserStateCallback(user: UserInterface, devices: Device[]): Promise; /** * Notification about device state change. * https://yandex.ru/dev/dialogs/smart-home/doc/en/reference-alerts/post-skill_id-callback-state * * @param userId * @param devices * @returns Promise */ callbackState(userId: string | number, devices: Device[]): Promise; /** * Notification about device parameter change. * https://yandex.ru/dev/dialogs/smart-home/doc/en/reference-alerts/post-skill_id-callback-discovery * * @param userId * @returns Promise */ callbackDiscovery(userId: string | number): Promise; /** * Get UNIX Timestamp. * * @returns number */ getUnixTimestamp(): number; /** * Log the latest Skill Update for the User. * * @param email * @param devices * @returns Promise */ logLatestSkillUpdate(email: string, devices: Device[]): Promise; /** * Get the latest logged Skill Update for the User. * * @param email * @returns Promise */ getLatestSkillUpdate(email: string): Promise; /** * Is Callback State Available? * * @param topicData * @param oldMessage * @param newMessage * @returns Promise */ isCallbackStateAvailable(topicData: TopicData, oldMessage: string | undefined, newMessage: string): Promise; /** * Check if the State Topic has been changed. * * @param oldMessage * @param newMessage * @param deviceType * @returns Promise */ isStateTopicChanged(oldMessage: string | undefined, newMessage: string, deviceType?: string): Promise; /** * Check if the device has the wrong property with the "event" type. * * @param user * @param updatedDevice * @returns Promise * @protected */ protected isDeviceParameterChanged(user: UserInterface, updatedDevice: Device): Promise; /** * Add Temporary User Device. * * @param user * @param updatedDevice * @returns Promise * @protected */ protected addTempUserDevice(user: UserInterface, updatedDevice: Device): Promise; /** * Get Payload Device. * * @param device * @returns Device * @protected */ protected getPayloadDevice(device: Device): Device; /** * Delete Temporary User Devices. * * @param user * @returns void * @protected */ protected deleteTempUserDevices(user: UserInterface): void; } /** * Temp Payload Devices Type. */ export type TempPayloadDevices = { /** * Device ID => Payload Device. */ [key: string]: Device; }; /** * Temp Timeout Devices Type. */ export type TempTimeoutDevices = { timeoutId: any; payloadDevices: TempPayloadDevices; isDeviceParameterChanged: boolean; }; /** * Log User Skill Update Type. */ export type LogUserSkillUpdate = { devices: Device[]; updatedAt: number; }; /** * Temporary User Devices Type. */ export type TempUserDevices = { /** * User ID => Timeout Devices. */ [key: string | number]: TempTimeoutDevices; }; /** * Temporary User State Callbacks Type. */ export type TempUserStateCallbacks = { /** * User ID => True/False. */ [key: string | number]: boolean; }; declare const _default: SkillService; export default _default;