travis-got

2018-11-07 admin

travis-got是什么

什么是travis-got,Convenience wrapper for got to interact with the Travis API

travis-got使用教程帮助文档

travis-got Build Status

Convenience wrapper for got to interact with the Travis API

Install

$ npm install --save travis-got

Usage

Instead of:

const got = require('got');

got('https://api.travis-ci.org/repos/SamVerschueren/travis-got', {
    json: true,
    headers: {
        accept: 'application/vnd.travis-ci.2+json'
    }
}).then(res => {
    console.log(res.body.repo.slug);
    //=> 'SamVerschueren/latest-push'
});

You can do:

const travisGot = require('travis-got');

travisGot('repos/SamVerschueren/travis-got').then(res => {
    console.log(res.body.repo.slug);
    //=> 'SamVerschueren/latest-push'
});

Or:

const travisGot = require('travis-got');

travisGot('https://api.travis-ci.org/repos/SamVerschueren/travis-got').then(res => {
    console.log(res.body.repo.slug);
    //=> 'SamVerschueren/latest-push'
});

API

Same as got (including the stream API and aliases), but with some additional options:

token

Type: string

Travis access token.

Can be overridden globally with the TRAVIS_TOKEN environment variable.

endpoint

Type: string Default: https://api.travis-ci.org/

To support Travis Enterprise.

Can be overridden globally with the TRAVIS_ENDPOINT environment variable.

License

MIT © Sam Verschueren

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-44786.html

文章标题:travis-got

回到顶部