import { InvokeCustomMethodFpOptions, RequestError } from '@tma.js/bridge'; import { Computed } from '@tma.js/signals'; import { BetterPromise } from 'better-promises'; import { taskEither as TE } from 'fp-ts'; import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js'; import { WithInvokeCustomMethod } from '../../fn-options/withInvokeCustomMethod.js'; import { WithVersion } from '../../fn-options/withVersion.js'; import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js'; type CloudStorageTask = TE.TaskEither; export interface CloudStorageOptions extends WithVersion, WithInvokeCustomMethod, SharedFeatureOptions { } /** * @since Mini Apps v6.9 */ export declare class CloudStorage { constructor({ version, isTma, invokeCustomMethod }: CloudStorageOptions); /** * Signal indicating if the component is supported. */ readonly isSupported: Computed; /** * Deletes specified key or keys from the cloud storage. * @param keyOrKeys - key or keys to delete. * @param options - request execution options. * @since Mini Apps v6.9 */ readonly deleteItemFp: WithChecksFp<(keyOrKeys: string | string[], options?: InvokeCustomMethodFpOptions) => CloudStorageTask, true>; readonly deleteItem: WithChecks<(keyOrKeys: string | string[], options?: InvokeCustomMethodFpOptions) => BetterPromise, true>; /** * Gets a single key value from the cloud storage. * @param key - a key to get. * @param options - request execution options. * @returns A key value as a string. * @since Mini Apps v6.9 */ readonly getItemFp: WithChecksFp<(key: string, options?: InvokeCustomMethodFpOptions) => CloudStorageTask, true>; /** * @see getItemFp */ readonly getItem: WithChecks<{ (keys: K[], options?: InvokeCustomMethodFpOptions): BetterPromise>; (key: string, options?: InvokeCustomMethodFpOptions): BetterPromise; }, true>; /** * Gets multiple keys' values from the cloud storage. * @param keys - keys list. * @param options - request execution options. * @returns A map, where a key is one of the specified in the `keys` argument, * and a value is a corresponding storage value if an array of keys was passed. * @since Mini Apps v6.9 */ readonly getItemsFp: WithChecksFp<((keys: K[], options?: InvokeCustomMethodFpOptions) => CloudStorageTask>), true>; /** * @see getItemsFp */ readonly getItems: WithChecks<((keys: K[], options?: InvokeCustomMethodFpOptions) => BetterPromise>), true>; /** * Returns a list of all keys presented in the cloud storage. * @param options - request execution options. * @since Mini Apps v6.9 */ readonly getKeysFp: WithChecksFp<(options?: InvokeCustomMethodFpOptions) => CloudStorageTask, true>; /** * @see getKeysFp */ readonly getKeys: WithChecks<(options?: InvokeCustomMethodFpOptions) => BetterPromise, true>; /** * Saves the specified value by a key. * @param key - storage key. * @param value - storage value. * @param options - request execution options. * @since Mini Apps v6.9 */ readonly setItemFp: WithChecksFp<(key: string, value: string, options?: InvokeCustomMethodFpOptions) => CloudStorageTask, true>; /** * @see setItemFp */ readonly setItem: WithChecks<(key: string, value: string, options?: InvokeCustomMethodFpOptions) => BetterPromise, true>; /** * Clears the cloud storage. * @param options - additional options. * @since Mini Apps v6.9 */ readonly clearFp: WithChecksFp<(options?: InvokeCustomMethodFpOptions) => CloudStorageTask, true>; /** * @see clearFp */ readonly clear: WithChecks<(options?: InvokeCustomMethodFpOptions) => BetterPromise, true>; } export {};