import { FetchRepositoryBase } from "../../../shared/index.js"; import type { CreateMenuItemParams, CreateNavigationMenuParams, ListNavigationMenusResponse, MenuItem, NavigationMenu, UpdateNavigationMenuParams } from "./NavigationTypes.js"; /** * Repository for managing site navigation menus * * Handles hierarchical navigation menu structures with support for nested items, * external links, page links, and visibility controls. */ export declare class NavigationRepository extends FetchRepositoryBase { /** * Retrieves all navigation menus for a site * * Returns both published and unpublished menus with full item hierarchy. * Pagination fixed at 30 items per page (sufficient for most sites). * * @param siteId - The ID of the site * @param query - Optional search query to filter menus by name * @returns Promise resolving to list of menus with items and metadata * @throws Error if API request fails or authentication is invalid */ getMenus(siteId: number, query?: string, uuid?: string): Promise; /** * Finds a menu by UUID using API-side filtering. */ findMenuByUuid(siteId: number, uuid: string): Promise; /** * Retrieves a specific navigation menu with full item hierarchy * * Returns complete menu structure including all items, nested items, * and their configuration (URLs, targets, visibility, segments). * * @param siteId - The ID of the site * @param menuId - The ID of the menu to retrieve * @returns Promise resolving to menu data with complete item tree * @throws Error if menu not found, API request fails, or authentication is invalid */ getMenu(siteId: number, menuId: number): Promise; /** * Creates a new navigation menu * * Creates an empty menu that can be populated with items via addMenuItem. * Menu is created in draft state and must be published separately. * * @param siteId - The ID of the site * @param data - Menu creation data * @param data.name - Menu name (e.g., "Main Navigation", "Footer") * @param data.slug - Menu slug (lowercase, used in Liquid templates) * @returns Promise resolving to created menu data * @throws Error if validation fails, slug already exists, API request fails, or authentication is invalid */ createMenu(siteId: number, data: CreateNavigationMenuParams): Promise; /** * Updates a navigation menu's properties * * Updates menu metadata (name, slug). Use addMenuItem/updateMenuItem/deleteMenuItem * to modify menu items. * * @param siteId - The ID of the site * @param menuId - The ID of the menu to update * @param data - Menu update data * @param data.name - Updated menu name * @param data.slug - Updated menu slug * @returns Promise resolving to updated menu data * @throws Error if validation fails, menu not found, API request fails, or authentication is invalid */ updateMenu(siteId: number, menuId: number, data: UpdateNavigationMenuParams): Promise; /** * Permanently deletes a navigation menu and all its items * * Important: * - Deletion is permanent and cannot be undone * - All menu items are deleted recursively * - Menu must be unpublished before deletion * * @param siteId - The ID of the site * @param menuId - The ID of the menu to delete * @returns Promise resolving when deletion completes * @throws Error if menu is published, not found, API request fails, or authentication is invalid */ deleteMenu(siteId: number, menuId: number): Promise; /** * Adds a new item to a navigation menu * * Workflow: * 1. Retrieves current menu structure * 2. Creates new item with proper defaults * 3. Appends to menu items array * 4. Updates entire menu * * Menu items support: * - External URLs (https://example.com) * - Internal page links (layout_page_uuid) * - Nested hierarchy (parent_id) * - Target window control (_blank, _self) * - Visibility and permissions * * Important notes: * - Position auto-calculated if not provided (appends to end) * - New items default to visible (private: false) * - Nested items require valid parent_id * * @param siteId - The ID of the site * @param menuId - The ID of the menu to add item to * @param data - Menu item creation data * @param data.label - Display text for menu item * @param data.url - URL for menu item (external or internal path) * @param data.target - Link target ('_blank' for new window, '_self' for same window) * @param data.position - Item position in menu (auto-calculated if omitted) * @param data.parent_id - Parent item ID for nested items (null for top-level) * @returns Promise resolving to updated menu with new item * @throws Error if validation fails, menu not found, API request fails, or authentication is invalid */ addMenuItem(siteId: number, menuId: number, data: CreateMenuItemParams): Promise; /** * Updates an existing menu item * * Workflow: * 1. Retrieves current menu structure * 2. Finds and updates the specific item * 3. Updates entire menu with modified items * * Partial updates supported - only include fields to change. * Commonly updated fields: label, url, target, position, visibility, description, classes. * * Important notes: * - Changing parent_id moves item in hierarchy * - Changing position reorders items * - Updates affect menu structure immediately * * @param siteId - The ID of the site * @param menuId - The ID of the menu containing the item * @param itemId - The ID of the item to update * @param data - Menu item update data (partial) * @param data.label - Updated display text * @param data.url - Updated URL * @param data.target - Updated link target * @param data.position - Updated position * @param data.parent_id - Updated parent (move in hierarchy) * @param data.description - Updated description/tooltip * @param data.classes - Updated CSS classes * @returns Promise resolving to updated menu with modified item * @throws Error if validation fails, item not found, API request fails, or authentication is invalid */ updateMenuItem(siteId: number, menuId: number, itemId: number, data: Partial): Promise; /** * Deletes a menu item from a navigation menu * * Important: * - Deletion is permanent * - Child items (if any) are also deleted recursively * - Item positions are automatically recalculated * * @param siteId - The ID of the site * @param menuId - The ID of the menu containing the item * @param itemId - The ID of the item to delete * @returns Promise resolving when deletion completes * @throws Error if item not found, API request fails, or authentication is invalid */ /** * Replaces all items in a menu with a new set * * Sends PUT to /sites/{siteId}/menus/{menuId} with { menus: items } * This is the native way Modyo handles menu item replacement. */ replaceMenuItems(siteId: number, menuId: number, items: Array>): Promise; deleteMenuItem(siteId: number, menuId: number, itemId: number): Promise; } //# sourceMappingURL=NavigationRepository.d.ts.map