/** * Error thrown for non-successful Travis API responses, carrying the HTTP * status code of the response */ export declare class TravisApiError extends Error { readonly status: number; constructor(message: string, status: number); } export interface TravisClientOptions { /** * Use the pro endpoint (api.travis-ci.com) instead of the open-source * one (api.travis-ci.org) */ pro?: boolean; } /** * Minimal Travis CI API client over native fetch, covering the few * endpoints this cli uses (replaces the @imqueue/travis package) */ export declare class TravisClient { private readonly baseUrl; private accessToken?; constructor(options?: TravisClientOptions); /** * Performs a Travis API request and returns the parsed JSON body. * Throws TravisApiError with the response status on non-2xx replies. * * @param {string} method - HTTP method to use * @param {string} path - API path, e.g. '/repos/{owner}/{repo}/key' * @param {object} [body] - JSON-serializable request payload * @return {Promise} */ request(method: string, path: string, body?: object): Promise; /** * Exchanges a github token for a travis access token and uses it for * all subsequent requests * * @param {{ github_token: string }} params * @return {Promise} */ authenticate(params: { github_token: string; }): Promise; /** * Returns the repository public key used for encrypting secure values * * @param {string} owner * @param {string} repo * @return {Promise<{ key: string }>} */ getRepositoryKey(owner: string, repo: string): Promise<{ key: string; }>; /** * Triggers synchronization of the authenticated user's repositories * * @return {Promise} */ syncUsers(): Promise; /** * Returns the authenticated user's repository hooks * * @return {Promise<{ hooks: any[] }>} */ getHooks(): Promise<{ hooks: any[]; }>; /** * Updates the given hook's active state * * @param {number} id - hook identifier * @param {boolean} active - desired state * @return {Promise} */ updateHook(id: number, active: boolean): Promise; } /** * Returns encrypted secure key for travis sensitive data. * * @see https://docs.travis-ci.com/user/encryption-keys/ * @param {string} repository - git repository owner/name * @param {string} data - sensitive data to encrypt * @param {string} github_token - token if auth required (pro mode) * @return {Promise} */ export declare function travisEncrypt(repository: string, data: string, github_token?: string): Promise; /** * Tries perform travis sync * * @param {TravisClient} travis - authenticated client * @param {number} [retry] - current retry * @param {number} maxRetries - max number of retries * @param {number} delay - delay in milliseconds before result return */ export declare function trySyncBuilds(travis: TravisClient, retry?: number, maxRetries?: number, delay?: number): Promise; /** * Enables builds for a given repository * * @param {string} owner * @param {string} repo * @param {string} github_token * @return {Promise} */ export declare function enableBuilds(owner: string, repo: string, github_token: string, isPrivate: boolean): Promise;