UNPKG

circleci-api

Version:

A Node and Browser client for the CircleCI API, written in TypeScript.

56 lines (55 loc) 2.71 kB
import { GitInfo, ListEnvVariablesResponse, EnvVariable, EnvVariableResponse, DeleteEnvVarResponse, CircleOptions } from "../types"; /** * List all of a projects environment variables, part of the * value will be masked with *'s * * @see getEnv for retrieving the hidden value of an env variable * * @see https://circleci.com/docs/api/v1-reference/#list-environment-variables * @example GET : https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/envvar * * @param token CircleCI API token * @param circleHost Provide custom url for CircleCI * @param vcs Git information for project * @returns list of env variables for a specific project */ export declare function listEnv(token: string, { circleHost, ...vcs }: GitInfo & CircleOptions): Promise<ListEnvVariablesResponse>; /** * Add environment variable to project * * @see https://circleci.com/docs/api/v1-reference/#add-environment-variable * @example POST : https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/envvar * * @param token CircleCI API token * @param payload Environment variable object to add to project * @param vcs Git information for project * @param circleHost Provide custom url for CircleCI * @returns newly created environment variable */ export declare function addEnv(token: string, payload: EnvVariable, { circleHost, ...vcs }: GitInfo & CircleOptions): Promise<EnvVariableResponse>; /** * Gets the hidden value of environment variable :name * * @example GET : https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/envvar/:name * @see https://circleci.com/docs/api/v1-reference/#get-environment-variable * * @param token CircleCI API token * @param envName Name of variable to fetch value * @param circleHost Provide custom url for CircleCI * @param vcs Git information for project * @returns Full hidden value of environment variable */ export declare function getEnv(token: string, envName: string, { circleHost, ...vcs }: GitInfo & CircleOptions): Promise<EnvVariableResponse>; /** * Deletes the environment variable named ':name' * * @example DELETE : https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/envvar/:name * @see https://circleci.com/docs/api/v1-reference/#delete-environment-variable * * @param token CircleCI API token * @param envName Name of variable to fetch value * @param circleHost Provide custom url for CircleCI * @param vcs Git information for project * @returns Status message result of operation */ export declare function deleteEnv(token: string, envName: string, { circleHost, ...vcs }: GitInfo & CircleOptions): Promise<DeleteEnvVarResponse>;