UNPKG

@simpleapps-com/augur-api

Version:

TypeScript client library for Augur microservices API endpoints

87 lines 4.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createDocumentsResource = createDocumentsResource; exports.createDocumentsDataResource = createDocumentsDataResource; const documents_1 = require("../schemas/documents"); /** * Creates the documents resource methods * OpenAPI Path: /documents → documents.* * @description Document management and knowledge base access functionality */ function createDocumentsResource(executeRequest) { return { /** * List available documents in the AI knowledge base * * @fullPath api.gregorovich.documents.list * @service gregorovich * @domain document-management * @dataMethod documentsData.list * @discoverable true * @searchTerms ["documents", "files", "knowledge", "library", "content", "resources", "papers", "manuals"] * @relatedEndpoints ["api.gregorovich.chatGpt.ask.get", "api.joomla.content.list", "api.agrSite.content.search", "api.items.faq.list"] * @commonPatterns ["List documents", "Browse knowledge base", "Find resources", "Document library", "Content discovery", "Knowledge management"] * @workflow ["document-discovery", "knowledge-management", "research", "content-organization", "ai-training-data"] * @prerequisites ["Public bearer token", "x-site-id header", "Document access permissions"] * @nextSteps ["Select document for AI processing", "Use document content for AI questions", "Organize document library", "Analyze document metadata"] * @businessRules ["Returns accessible documents only", "Supports document filtering", "Includes metadata and status", "Permissions-based access", "Searchable content"] * @functionalArea "content-and-knowledge-management" * @crossSite "Multi-site document library support" * @caching "Cache for 15 minutes, document lists change infrequently" * @performance "Optimize with pagination for large document sets, supports filtering and search" * * @returns Promise<DocumentsResponse> Complete list of available documents with metadata and organization information * * @example * ```typescript * // List all available documents * const docsResponse = await client.documents.list(); * console.log(docsResponse.data); // Array of document objects * console.log(docsResponse.total); // Total document count * * // Get just the documents array * const documents = await client.documentsData.list(); * console.log(documents); // Direct access to document array * * // Process document library * const docs = await client.documentsData.list(); * const publishedDocs = docs.filter(doc => doc.status === 'published'); * const categories = [...new Set(docs.map(doc => doc.category))]; * * console.log(`Found ${publishedDocs.length} published documents`); * console.log(`Available categories: ${categories.join(', ')}`); * * // Find specific document types * const manuals = docs.filter(doc => * doc.type === 'manual' || doc.tags?.includes('manual') * ); * const recentDocs = docs.filter(doc => * new Date(doc.updatedAt || 0) > new Date(Date.now() - 30 * 24 * 60 * 60 * 1000) * ); * ``` */ list: async () => { return executeRequest({ method: 'GET', path: '/documents', responseSchema: documents_1.DocumentsResponseSchema, }); }, }; } /** * Creates the documentsData resource methods (data-only versions) */ function createDocumentsDataResource(documents) { return { /** * List documents and return documents array data only * @returns Promise<DocumentsResult[]> Array of document objects */ list: async () => { const response = await documents.list(); return response.data; }, }; } //# sourceMappingURL=documents.js.map