import type { KvStoreDeleteRequest, KvStorePostRequest, MaterialKvstoreGetRequest } from './apis'; import type { EliceCDK } from './EliceCDK'; import type { AnyObject, Primitive } from './typings'; /** * Material-level key-value storage interface. * * Unlike `kvstore`, data here is not user-scoped—it's shared across all users viewing the material. * Useful for storing shared configuration or content state. */ export declare class EliceCDKMaterialKvstore { private readonly ctx; constructor(ctx: EliceCDK); /** * Retrieves a value from the material-level key-value store. * * Data is shared across all users for this material (not user-scoped). * * @param params - Object containing the `key` to retrieve. * @param init - Optional fetch request configuration. * @returns The stored value, or `null` if not found. * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * await sdk.init(); * * const config = await sdk.materialKvstore.get({ key: 'sharedConfig' }); * // { maxAttempts: 3 } * ``` */ get: (params: MaterialKvstoreGetRequest, init?: RequestInit) => Promise; /** * Saves a value to the material-level key-value store. * * Data is shared across all users for this material (not user-scoped). * * @param params - Object containing `key` (camelCase, alphanumeric) and `value`. * @param init - Optional fetch request configuration. * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * await sdk.init(); * * await sdk.materialKvstore.post({ * key: 'sharedConfig', * value: { maxAttempts: 3 }, * }); * ``` */ post: (params: { key: KvStorePostRequest["key"]; value: Primitive | AnyObject; }, init?: RequestInit) => Promise; /** * Deletes a value from the material-level key-value store. * * @param key - The key to delete (camelCase, alphanumeric). * @param init - Optional fetch request configuration. * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * await sdk.init(); * * await sdk.materialKvstore.delete('sharedConfig'); * ``` */ delete: (key: KvStoreDeleteRequest["key"], init?: RequestInit) => Promise; }