UNPKG

scriptable-testlab

Version:

A lightweight, efficient tool designed to manage and update scripts for Scriptable.

91 lines (88 loc) 1.97 kB
import { MockImage } from './image.js'; import { AbsPhotos } from 'scriptable-abstract'; /** * State interface for Photos mock */ interface PhotosState { library: { photos: MockImage[]; screenshots: MockImage[]; }; } /** * Mock implementation of Scriptable's Photos global variable. * Provides functionality for accessing and managing photos and screenshots in the device's library. * * @example * ```typescript * // Get latest photo from library * const photo = await Photos.latestPhoto(); * * // Take a photo with camera * const newPhoto = await Photos.fromCamera(); * * // Get latest screenshots * const screenshots = await Photos.latestScreenshots(5); * ``` * * @implements Photos */ declare class MockPhotos extends AbsPhotos<PhotosState> { constructor(); /** * @inheritdoc */ fromLibrary(): Promise<MockImage>; /** * @inheritdoc */ fromCamera(): Promise<MockImage>; /** * @inheritdoc */ latestPhoto(): Promise<MockImage>; /** * @inheritdoc */ latestPhotos(count: number): Promise<MockImage[]>; /** * @inheritdoc */ latestScreenshot(): Promise<MockImage>; /** * @inheritdoc */ latestScreenshots(count: number): Promise<MockImage[]>; /** * @inheritdoc */ removeLatestPhoto(): void; /** * @inheritdoc */ removeLatestPhotos(count: number): void; /** * @inheritdoc */ removeLatestScreenshot(): void; /** * @inheritdoc */ removeLatestScreenshots(count: number): void; /** * @inheritdoc */ save(image: MockImage): void; /** * @additional * Add a screenshot to the library * @param image The screenshot image to add */ addScreenshot(image: MockImage): void; /** * @additional * Clear all photos and screenshots from the library */ clear(): void; } export { MockPhotos };