@openinc/parse-server-opendash
Version:
Parse Server Cloud Code for open.INC Stack.
56 lines (55 loc) • 1.63 kB
TypeScript
import { GitHubTreeResponse, GitHubBranch, GitHubRepository, ImportOptions } from "../types";
/**
* GitHub API Client for fetching repository data
*/
export declare class GitHubClient {
private readonly baseUrl;
private readonly headers;
private readonly importConfig;
private branch;
private repository;
private tree;
private sha;
constructor(token: string, importConfig?: Partial<ImportOptions>);
/**
* Validate the GitHub token
*/
validateToken(): Promise<{
login: string;
}>;
/**
* Get repository information
*/
getRepository(): Promise<GitHubRepository>;
/**
* Get all branches for a repository
*/
getBranches(): Promise<GitHubBranch[]>;
/**
* Get a specific branch
*/
getBranch(): Promise<GitHubBranch>;
/**
* Get repository tree (file structure)
*/
getTree(sha: string, recursive?: boolean): Promise<GitHubTreeResponse>;
/**
* Get file content
*/
getFileContent(path: string): Promise<any>;
/**
* Get the last commit information for a specific file
*/
getFileLastCommit(path: string, ref?: string): Promise<any>;
/**
* Get commit information for multiple files in batch
*/
getMultipleFileCommits(paths: string[]): Promise<Map<string, any>>;
/**
* Fetches the content of each linked file from GitHub.
* @param ref Branch or commit SHA
* @param paths Array of relative file paths (from repo root)
* @returns Map of path to file content (decoded as string if possible)
*/
private fetchLinkedFiles;
}