evergreen.js
Version:
JavaScript/TypeScript library for the Evergreen REST API
135 lines (134 loc) • 5.39 kB
TypeScript
import { AxiosPromise } from "axios";
import * as models from "./models";
export declare class client {
username: string;
key: string;
apiURL: string;
uiURL: string;
constructor(serverURL: string, webURL: string, username?: string, key?: string);
/**
* General function to send a HTTP GET to the Evergreen API
*
* @param resource - resource to GET, can be a path
* @param params - query params to append to the request URL, in the format {"param": "value"}
* @returns a promise for the caller to handle responses
*/
getAPIResource(resource: string, params?: object): AxiosPromise;
/**
* General function to send a HTTP GET to the Evergreen UI
*
* @param resource - resource to GET, can be a path
* @param params - query params to append to the request URL, in the format {"param": "value"}
* @returns a promise for the caller to handle responses
*/
getUIResource(resource: string, params?: object): AxiosPromise;
/**
* General function to send a HTTP POST to Evergreen
*
* @param resource - resource to POST to, can be a path
* @param body - body of the request, usually as an object
* @returns a promise for the caller to handle responses
*/
postAPIResource(resource: string, body: any): AxiosPromise;
/**
* General function to send a HTTP POST to the Evergreen UI
*
* @param resource - resource to POST to, can be a path
* @param body - body of the request, usually as an object
* @returns a promise for the caller to handle responses
*/
postUIResource(resource: string, body: any): AxiosPromise;
/**
* Gets all distros
*
* @returns a promise for the caller to handle responses
*/
getDistros(): AxiosPromise<any>;
/**
* Gets aggregated or detailed stats for tasks that have finished recently
*
* @param verbose - returns task details rather than aggregated stats
* @param lookbackMins - look for tasks that ended at most this many minutes before now
* @param status - task statuses (can be comma-separated list) to filter on
* @returns a promise for the caller to handle responses
*/
getRecentTasks(verbose?: boolean, lookbackMins?: number, status?: string): AxiosPromise<any>;
/**
* Updates header cookies when given login credentials
*
* @param username - Evergreen user's username
* @param password - Evergreen user's password
* @returns a promise for the caller to handle responses
*/
getToken(username?: string, password?: string): AxiosPromise<any>;
/**
* Gets patches for a particular user
* @param username - Evergreen user's username
* @returns a promise for the caller to handle responses
*/
getPatches(username?: string, page?: number): AxiosPromise<models.Patches>;
/**
* Gets patches for a particular project
* @param projectName - Evergreen project name
* @returns a promise for the caller to handle responses
*/
getProjectPatches(projectName?: string, page?: number): AxiosPromise<models.Patches>;
/**
* Gets logs of a particular type for a particular task/
* @param taskId - identifier for the task whose logs we want
* @param type - type of log to return
* @returns a promise for the caller to handle responses
*/
getLogs(taskId: string, type: string, executionNumber: number): AxiosPromise<string>;
/**
* Gets build for a given build ID
* @param id - build ID whose tasks we want
* @returns a promise for the caller to handle responses
*/
getBuild(id: string): AxiosPromise<models.Build>;
/**
* Gets tasks for a given build ID
* @param buildId - build ID whose tasks we want
* @returns a promise for the caller to handle responses
*/
getTasksForBuild(buildId: string): AxiosPromise<models.APITask[]>;
/**
* Gets tests for a given task ID
* @param taskId - task ID whose tests we want
* @returns a promise for the caller to handle responses
*/
getTestsForTask(taskId: string): AxiosPromise<models.APITest[]>;
/**
* Gets the admin settings
*
* @param callback - function to process the response
* @returns a promise for the caller to handle responses
*/
getAdminConfig(): AxiosPromise<models.AdminSettings>;
/**
* Sets the admin settings
*
* @param callback - function to process the response
* @param settings - settings object to set in the db
* @returns a promise for the caller to handle responses
*/
setAdminConfig(settings: models.AdminSettings): AxiosPromise<models.AdminSettings>;
/**
* Gets the Evergreen banner message
*
* @param callback - function to process the response
* @returns a promise for the caller to handle responses
*/
getBanner(): AxiosPromise<any>;
/**
* Sets the Evergreen banner message
*
* @param message - text to set in the banner
* @param theme - color theme to use
* @returns a promise for the caller to handle responses
*/
setBanner(message: string, theme: string): AxiosPromise<any>;
private formRequest;
}
export declare function apiV2Resource(resource: string): string;
export declare function queryString(params?: object): string;