@codechecks/client
Version:
Open source platform for code review automation
56 lines (55 loc) • 2.12 kB
TypeScript
/// <reference types="node" />
import { CodeChecksReport } from "./types";
import { Stream } from "stream";
export interface ApiOptions {
token?: string;
host?: string;
}
export declare class Api {
private readonly requestPromise;
private readonly requestRaw;
private readonly sharedCtx;
constructor(options: ApiOptions);
saveFileFromStream(fullKey: string, getContents: () => Stream, projectSlug?: string, contentType?: string): Promise<void>;
getFileAsString(fullKey: string, projectSlug?: string): Promise<string | undefined>;
makeCommitCheck(sha: string, baseSha: string | undefined, checks: CodeChecksReport[], projectSlug?: string): Promise<void>;
prInfo(prId: number): Promise<PrInfo>;
prInfoPublic(prId: number, projectSlug: string): Promise<PrInfo>;
projectInfo(): Promise<ProjectInfo>;
projectInfoPublic(projectSlug: string): Promise<ProjectInfo>;
getValue<T>(name: string, key: string, projectSlug?: string): Promise<T | undefined>;
saveValue(name: string, value: any, key: string, projectSlug?: string): Promise<void>;
getFile(fullKey: string, destinationPath: string, projectSlug?: string): Promise<void>;
saveFile(fullKey: string, sourcePath: string, projectSlug?: string): Promise<void>;
getDirectory(name: string, destinationPath: string, key: string, projectSlug?: string): Promise<void>;
private getCollectionList;
saveDirectory(name: string, directoryPath: string, key: string, projectSlug?: string): Promise<void>;
private getFileWithRetry;
private saveFileWithRetry;
}
export declare function getApiOptions(requiresSecret: boolean): ApiOptions;
export interface PrInfo {
id: number;
meta: {
title: string;
body: string;
};
head: {
sha: string;
};
base: {
sha: string;
};
files: FileStatuses;
}
export interface FileStatuses {
changed: string[];
added: string[];
removed: string[];
}
export interface ProjectInfo {
projectSlug: string;
artifactsProxyUrl: string;
artifactsProxySupportsPages: boolean;
isPrivate: boolean;
}