@nicodoggie/node-kiwi-tcms-api
Version:
Vibe-coded Node.js wrapper for Kiwi TCMS XML-RPC API. Use at your own risk.
135 lines (134 loc) • 4.3 kB
TypeScript
import { KiwiClient } from '../client';
/**
* Attachment API module
*/
export declare class AttachmentAPI {
private client;
constructor(client: KiwiClient);
/**
* Remove an attachment
*/
remove(attachmentId: number): Promise<void>;
}
/**
* Markdown API module
*/
export declare class MarkdownAPI {
private client;
constructor(client: KiwiClient);
/**
* Render markdown to HTML
*/
render(markdownText: string): Promise<string>;
}
/**
* Kiwi TCMS system utilities
*/
export declare class KiwiUtilsAPI {
private client;
constructor(client: KiwiClient);
/**
* Get Kiwi TCMS version
*/
version(): Promise<string>;
/**
* Extract tracker information from URL
*/
trackerFromUrl(url: string): Promise<any>;
}
/**
* URL generation utilities for creating permalinks and slugs
*/
export declare class UrlAPI {
private client;
constructor(client: KiwiClient);
/**
* Generate a permalink URL for a test case
* @param testCaseId - The ID of the test case
* @returns The full URL to the test case
*/
generateTestCaseUrl(testCaseId: number): string;
/**
* Generate a permalink URL for a test plan
* @param testPlanId - The ID of the test plan
* @returns The full URL to the test plan
*/
generateTestPlanUrl(testPlanId: number): string;
/**
* Generate a permalink URL for a test run
* @param testRunId - The ID of the test run
* @returns The full URL to the test run
*/
generateTestRunUrl(testRunId: number): string;
/**
* Generate a permalink URL for a test execution
* @param testRunId - The ID of the test run
* @param testCaseId - The ID of the test case
* @returns The full URL to the test execution
*/
generateTestExecutionUrl(testRunId: number, testCaseId: number): string;
/**
* Generate a permalink URL for a bug report
* @param bugId - The ID of the bug
* @returns The full URL to the bug report
*/
generateBugUrl(bugId: number): string;
/**
* Create a URL-friendly slug from a string
* @param text - The text to convert to a slug
* @param maxLength - Maximum length of the slug (default: 50)
* @returns A URL-friendly slug
*/
createSlug(text: string, maxLength?: number): string;
/**
* Generate a short link for sharing
* @param entityType - Type of entity ('case', 'plan', 'run', 'bug')
* @param entityId - ID of the entity
* @param slug - Optional slug for readability
* @returns A shareable short URL format
*/
generateShortLink(entityType: 'case' | 'plan' | 'run' | 'bug', entityId: number, slug?: string): string;
/**
* Parse a Kiwi TCMS URL to extract entity information
* @param url - The Kiwi TCMS URL to parse
* @returns Object with entity type and ID, or null if not a valid URL
*/
parseKiwiUrl(url: string): {
type: string;
id: number;
slug?: string;
} | null;
/**
* Get the base web URL from the XML-RPC URL
* @private
*/
private getBaseWebUrl;
/**
* Inject permalink properties into an entity object
* @param entityType - Type of entity ('case', 'plan', 'run', 'bug')
* @param entity - The entity object to enhance
* @param nameField - Field name to use for slug generation (e.g., 'summary', 'name')
* @returns The entity with permalink properties added
*/
injectPermalinks<T extends {
id: number;
}>(entityType: 'case' | 'plan' | 'run' | 'bug', entity: T, nameField: keyof T): T & {
permalink: string;
shortLink: string;
slug: string;
};
/**
* Inject permalinks into an array of entities
* @param entityType - Type of entity ('case', 'plan', 'run', 'bug')
* @param entities - Array of entities to enhance
* @param nameField - Field name to use for slug generation
* @returns Array of entities with permalink properties added
*/
injectPermalinksArray<T extends {
id: number;
}>(entityType: 'case' | 'plan' | 'run' | 'bug', entities: T[], nameField: keyof T): Array<T & {
permalink: string;
shortLink: string;
slug: string;
}>;
}