valor-interview
Version:
CLI tool for downloading Valor interview challenges
39 lines • 1.66 kB
TypeScript
import type { Challenge, GitHubRepoInfo } from '../types';
/**
* Custom error class for GitHub API related errors
*/
export declare class GitHubApiError extends Error {
readonly statusCode?: number | undefined;
readonly response?: Response | undefined;
constructor(message: string, statusCode?: number | undefined, response?: Response | undefined);
}
/**
* Parses a GitHub repository URL to extract owner, repo, and branch information
* @param repoUrl - The GitHub repository URL
* @returns Repository information
* @throws {Error} If the URL is not a valid GitHub repository URL
*/
export declare const parseGitHubUrl: (repoUrl: string) => GitHubRepoInfo;
/**
* Fetches challenges from GitHub API
* @param repoUrl - The GitHub repository URL
* @param challengesDir - Directory containing challenges (default: from config)
* @returns Array of available challenges
* @throws {GitHubApiError} If the API request fails
*/
export declare const fetchChallengesFromAPI: (repoUrl: string, challengesDir?: string) => Promise<Challenge[]>;
/**
* Checks if a repository URL is a GitHub repository
* @param repoUrl - The repository URL to check
* @returns True if the URL is a GitHub repository
*/
export declare const isGitHubRepository: (repoUrl: string) => boolean;
/**
* Generates a raw file URL for a GitHub repository
* @param repoUrl - The GitHub repository URL
* @param filePath - Path to the file within the repository
* @param branch - Git branch (default: from config)
* @returns Raw file URL
*/
export declare const getRawFileUrl: (repoUrl: string, filePath: string, branch?: string) => string;
//# sourceMappingURL=api.d.ts.map