/** * Telegraph API Client * Wrapper for all Telegraph API endpoints */ import type { Account, Page, PageList, PageViews, Node, AccountField } from './types.js'; /** * Custom error class for Telegraph API errors */ export declare class TelegraphError extends Error { constructor(message: string); } /** * Create a new Telegraph account * @param short_name Account name (1-32 characters) * @param author_name Default author name (0-128 characters) * @param author_url Default profile link (0-512 characters) * @returns Account object with access_token */ export declare function createAccount(short_name: string, author_name?: string, author_url?: string): Promise; /** * Update information about a Telegraph account * @param access_token Access token of the Telegraph account * @param short_name New account name (1-32 characters) * @param author_name New default author name (0-128 characters) * @param author_url New default profile link (0-512 characters) * @returns Updated Account object */ export declare function editAccountInfo(access_token: string, short_name?: string, author_name?: string, author_url?: string): Promise; /** * Get information about a Telegraph account * @param access_token Access token of the Telegraph account * @param fields List of account fields to return * @returns Account object with requested fields */ export declare function getAccountInfo(access_token: string, fields?: AccountField[]): Promise; /** * Revoke access_token and generate a new one * @param access_token Access token of the Telegraph account * @returns Account object with new access_token and auth_url */ export declare function revokeAccessToken(access_token: string): Promise; /** * Create a new Telegraph page * @param access_token Access token of the Telegraph account * @param title Page title (1-256 characters) * @param content Content of the page (Array of Node objects) * @param author_name Author name (0-128 characters) * @param author_url Profile link (0-512 characters) * @param return_content If true, content field will be returned * @returns Page object */ export declare function createPage(access_token: string, title: string, content: Node[], author_name?: string, author_url?: string, return_content?: boolean): Promise; /** * Edit an existing Telegraph page * @param access_token Access token of the Telegraph account * @param path Path to the page * @param title Page title (1-256 characters) * @param content Content of the page (Array of Node objects) * @param author_name Author name (0-128 characters) * @param author_url Profile link (0-512 characters) * @param return_content If true, content field will be returned * @returns Updated Page object */ export declare function editPage(access_token: string, path: string, title: string, content: Node[], author_name?: string, author_url?: string, return_content?: boolean): Promise; /** * Get a Telegraph page * @param path Path to the Telegraph page * @param return_content If true, content field will be returned * @returns Page object */ export declare function getPage(path: string, return_content?: boolean): Promise; /** * Get a list of pages belonging to a Telegraph account * @param access_token Access token of the Telegraph account * @param offset Sequential number of the first page (default: 0) * @param limit Number of pages to be returned (0-200, default: 50) * @returns PageList object */ export declare function getPageList(access_token: string, offset?: number, limit?: number): Promise; /** * Get the number of views for a Telegraph page * @param path Path to the Telegraph page * @param year Required if month is passed (2000-2100) * @param month Required if day is passed (1-12) * @param day Required if hour is passed (1-31) * @param hour Pass to get views for a specific hour (0-24) * @returns PageViews object */ export declare function getViews(path: string, year?: number, month?: number, day?: number, hour?: number): Promise; /** * Simple HTML to Node converter * Converts basic HTML string to Telegraph Node array * Supports: p, b, i, strong, em, a, br, h3, h4, blockquote, code, pre, ul, ol, li, figure, figcaption, img, video, iframe */ export declare function htmlToNodes(html: string): Node[]; /** * Convert Markdown to HTML * Supports basic Markdown syntax and converts it to Telegraph-compatible HTML */ export declare function markdownToHtml(markdown: string): string; /** * Parse content input - accepts either HTML string, Markdown string, or Node array */ export declare function parseContent(content: string | Node[], format?: 'html' | 'markdown'): Node[]; //# sourceMappingURL=telegraph-client.d.ts.map