builds.js

/**
 * @module gitlab-api.builds
 */

import { wrap }  from '../wrapper';
import * as defs from '../definitions/builds';


/**
 * @function getProjectBuilds
 * @static
 * 
 * @summary List project builds
 * @description
 *
 * `GET /projects/:id/builds`
 *
 * ```bash
 * curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/builds"
 * ```
 *
 * @see {@link http://doc.gitlab.com/ce/api/builds.html#list-project-builds|website doc} -
 *      {@link https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api/builds.md#list-project-builds|repo doc}
 * 
 * @param {integer} id - The ID of a project
 */
export const getProjectBuilds = wrap(defs.getProjectBuilds);

/**
 * @function getProjectRepositoryCommitBuilds
 * @static
 * 
 * @summary List commit builds
 * @description
 *
 * `GET /projects/:id/repository/commits/:sha/builds`
 *
 * ```bash
 * curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/repository/commits/0ff3ae198f8601a285adcf5c0fff204ee6fba5fd/builds"
 * ```
 *
 * @see {@link http://doc.gitlab.com/ce/api/builds.html#list-commit-builds|website doc} -
 *      {@link https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api/builds.md#list-commit-builds|repo doc}
 * 
 * @param {integer} id  - The ID of a project
 * @param {string}  sha - The SHA id of a commit
 */
export const getProjectRepositoryCommitBuilds = wrap(defs.getProjectRepositoryCommitBuilds);

/**
 * @function getProjectBuild
 * @static
 * 
 * @summary Get a single build
 * @description
 *
 * `GET /projects/:id/builds/:build_id`
 *
 * ```bash
 * curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/builds/8"
 * ```
 *
 * @see {@link http://doc.gitlab.com/ce/api/builds.html#get-a-single-build|website doc} -
 *      {@link https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api/builds.md#get-a-single-build|repo doc}
 * 
 * @param {integer} id       - The ID of a project
 * @param {integer} build_id - The ID of a build
 */
export const getProjectBuild = wrap(defs.getProjectBuild);

/**
 * @function getProjectBuildArtifacts
 * @static
 * 
 * @summary Get build artifacts
 * @description
 *
 * `GET /projects/:id/builds/:build_id/artifacts`
 *
 * ```bash
 * curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/builds/8/artifacts"
 * ```
 *
 * @see {@link http://doc.gitlab.com/ce/api/builds.html#get-build-artifacts|website doc} -
 *      {@link https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api/builds.md#get-build-artifacts|repo doc}
 * 
 * @param {integer} id       - The ID of a project
 * @param {integer} build_id - The ID of a build
 */
export const getProjectBuildArtifacts = wrap(defs.getProjectBuildArtifacts);

/**
 * @function addProjectBuildCancel
 * @static
 * 
 * @summary Cancel a build
 * @description
 *
 * `POST /projects/:id/builds/:build_id/cancel`
 *
 * ```bash
 * curl -X POST -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/builds/1/cancel"
 * ```
 *
 * @see {@link http://doc.gitlab.com/ce/api/builds.html#cancel-a-build|website doc} -
 *      {@link https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api/builds.md#cancel-a-build|repo doc}
 * 
 * @param {integer} id       - The ID of a project
 * @param {integer} build_id - The ID of a build
 */
export const addProjectBuildCancel = wrap(defs.addProjectBuildCancel);

/**
 * @function addProjectBuildRetry
 * @static
 * 
 * @summary Retry a build
 * @description
 *
 * `POST /projects/:id/builds/:build_id/retry`
 *
 * ```bash
 * curl -X POST -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/builds/1/retry"
 * ```
 *
 * @see {@link http://doc.gitlab.com/ce/api/builds.html#retry-a-build|website doc} -
 *      {@link https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api/builds.md#retry-a-build|repo doc}
 * 
 * @param {integer} id       - The ID of a project
 * @param {integer} build_id - The ID of a build
 */
export const addProjectBuildRetry = wrap(defs.addProjectBuildRetry);

/**
 * @function addProjectBuildErase
 * @static
 * 
 * @summary Erase a build
 * @description
 *
 * `POST /projects/:id/builds/:build_id/erase`
 *
 * @see {@link http://doc.gitlab.com/ce/api/builds.html#erase-a-build|website doc} -
 *      {@link https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/api/builds.md#erase-a-build|repo doc}
 * 
 * @param {integer} id       - The ID of a project
 * @param {integer} build_id - The ID of a build
 */
export const addProjectBuildErase = wrap(defs.addProjectBuildErase);

export default config => ({
    getProjectBuilds: getProjectBuilds(config),
    getProjectRepositoryCommitBuilds: getProjectRepositoryCommitBuilds(config),
    getProjectBuild: getProjectBuild(config),
    getProjectBuildArtifacts: getProjectBuildArtifacts(config),
    addProjectBuildCancel: addProjectBuildCancel(config),
    addProjectBuildRetry: addProjectBuildRetry(config),
    addProjectBuildErase: addProjectBuildErase(config)
});