UNPKG

@makingchatbots/genesys-cloud-mcp-server

Version:

A Model Context Protocol (MCP) server exposing Genesys Cloud tools for LLMs, including sentiment analysis, conversation search, topic detection and more.

23 lines (22 loc) 734 B
const calculateTotalPages = (totalHits, pageSize) => { if (!pageSize || pageSize <= 0) return 0; if (totalHits === undefined) return 1; return Math.ceil(totalHits / pageSize); }; export function paginationSection(totalSectionName, { pageSize, pageNumber, totalHits, pageCount }) { let formattedTotalPages = "N/A"; if (pageCount !== undefined) { formattedTotalPages = pageCount; } else if (pageSize !== undefined) { formattedTotalPages = calculateTotalPages(totalHits, pageSize); } return { pageNumber: pageNumber ?? "N/A", pageSize: pageSize ?? "N/A", totalPages: formattedTotalPages, [totalSectionName]: totalHits ?? "N/A", }; }