import { FetchRepositoryBase } from "../../../shared/index.js"; export interface Lock { id: number; /** Locked resource summary. Null when the lockable no longer exists. */ element: { title: string; type: string; } | null; /** Lock owner. */ user: { id: number; name: string; }; /** Whether the lock is still valid (not expired). */ valid: boolean; account_id: number; created_at: string; updated_at: string; } export interface LocksList { locks: Lock[]; meta: { total_entries: number; per_page: number; current_page: number; total_pages: number; }; } export interface AcquireLockParams { lockable_type: string; lockable_id: number; } /** * Repository for managing locks in Modyo Channels. * Locks are used to prevent concurrent editing of resources like pages, templates, widgets, and entries. */ export declare class LocksRepository extends FetchRepositoryBase { /** * Gets a specific lock by ID. * @param lockId - The ID of the lock to retrieve * @returns Promise resolving to the lock details */ getLock(lockId: number): Promise; /** * Lists all active locks with optional pagination. * @param page - Page number (default: 1) * @param perPage - Items per page (default: 100) * @returns Promise resolving to the list of locks */ listLocks(page?: number, perPage?: number): Promise; /** * Acquires a lock on a resource. * @param params - The lock parameters (lockable_type and lockable_id) * @returns Promise resolving to the created lock */ acquireLock(params: AcquireLockParams): Promise; /** * Takes over a lock on a resource, forcibly stealing it from its current * owner. Atomic equivalent of release + acquire. Backed by * POST /locks/take_over which calls create_lock!(user, force: true). * @param params - The lock parameters (lockable_type and lockable_id) * @returns Promise resolving to the lock now owned by the current user */ takeOverLock(params: AcquireLockParams): Promise; /** * Releases a lock on a resource by lock ID. * @param lockId - The ID of the lock to release * @returns Promise that resolves when the lock is released */ releaseLock(lockId: number): Promise; /** * Releases a lock on a resource by lockable type and ID. * @param lockable_type - The type of the locked resource (e.g., 'Templates::SiteTemplate') * @param lockable_id - The ID of the locked resource * @returns Promise that resolves when the lock is released */ releaseLockByLockable(lockable_type: string, lockable_id: number): Promise; } //# sourceMappingURL=LocksRepository.d.ts.map