UNPKG

circleci-api

Version:

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

38 lines (37 loc) 1.45 kB
import { AxiosRequestConfig } from "axios"; import { Options, FullRequest, GitType } from "./types"; /** * Validate a Request object for endpoints that require * certain information * @param token - CircleCI API token * @param type - Git type * @param owner - Repository owner * @param repo - Target repository * @throws If options passed in are not valid */ export declare function validateVCSRequest({ token, vcs: { type, owner, repo }, }: FullRequest): void; /** * Take a Options object and map it to query parameters * @example { limit: 5, branch: "develop" } => /builds?branch=develop&limit=5 * @param opts - Query param object, branch is defaulted to master * @param ignoreBranch - Ignore the 'branch' option * @returns A string containing url encoded query params */ export declare function queryParams(opts?: Options): string; /** * Takes a string and will return the matching type, or * default to GitType.GITHUB * @default GitType.GITHUB * @see GitType * @param type - Raw string type */ export declare function getGitType(type: string): GitType; /** * Create JSON headers for Axios */ export declare function createJsonHeader(): AxiosRequestConfig; /** * Modify an existing AxiosRequestConfig object with the user-agent set to * the current version of the library */ export declare function addUserAgentHeader({ headers, ...config }?: AxiosRequestConfig): AxiosRequestConfig;