• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.chglog/H02-May-2019-7772

scripts/H02-May-2019-128

.gitignoreH A D02-May-20197 11

.travis.ymlH A D02-May-201939 54

CHANGELOG.mdH A D02-May-20192.4 KiB8763

CONTRIBUTING.mdH A D02-May-20191.7 KiB3927

Gopkg.lockH A D02-May-2019518 1814

Gopkg.tomlH A D02-May-2019131 86

LICENSEH A D02-May-20191.4 KiB2824

README.mdH A D02-May-20194.4 KiB11371

active.goH A D02-May-20192 KiB7747

active_integration_test.goH A D02-May-20191 KiB4326

active_test.goH A D02-May-20191.9 KiB6446

authentication.goH A D02-May-20191.9 KiB7039

authentication_integration_test.goH A D02-May-2019693 3017

authentication_test.goH A D02-May-20192.1 KiB7151

beta_features.goH A D02-May-20193.1 KiB11168

beta_features_integration_test.goH A D02-May-20192.3 KiB8959

beta_features_test.goH A D02-May-20193 KiB7957

branches.goH A D02-May-20194.6 KiB15596

branches_integration_test.goH A D02-May-20193 KiB12489

branches_test.goH A D02-May-20194.5 KiB11486

broadcasts.goH A D02-May-20192.2 KiB7440

broadcasts_integration_test.goH A D02-May-2019787 3924

broadcasts_test.goH A D02-May-20191.1 KiB3725

builds.goH A D02-May-20198.4 KiB276167

builds_integration_test.goH A D02-May-20193.9 KiB158117

builds_test.goH A D02-May-20194.8 KiB147109

caches.goH A D02-May-20193.5 KiB12982

caches_integration_test.goH A D02-May-20191.5 KiB6342

caches_test.goH A D02-May-20192.8 KiB9972

commits.goH A D02-May-20191.2 KiB3917

crons.goH A D02-May-20197.6 KiB267169

crons_integration_test.goH A D02-May-20199 KiB307209

crons_test.goH A D02-May-20196.8 KiB194147

email_subscriptions.goH A D02-May-20192.8 KiB9258

email_subscriptions_integration_test.goH A D02-May-20192 KiB6338

email_subscriptions_test.goH A D02-May-20192.1 KiB7451

env_vars.goH A D02-May-20197.9 KiB280183

env_vars_integration_test.goH A D02-May-20196.4 KiB234172

env_vars_test.goH A D02-May-20197.6 KiB225169

init_integration_test.goH A D02-May-2019956 3624

installations_integration_test.goH A D02-May-2019626 2816

installations_test.goH A D02-May-20191.1 KiB4027

installatios.goH A D02-May-20191.7 KiB6134

jobs.goH A D02-May-20196.7 KiB242147

jobs_integration_test.goH A D02-May-20192.5 KiB10973

jobs_test.goH A D02-May-20194.1 KiB147109

lint.goH A D02-May-20191.4 KiB5935

lint_integration_test.goH A D02-May-2019648 3118

lint_test.goH A D02-May-2019912 3725

logs.goH A D02-May-20191.4 KiB6036

logs_integration_test.goH A D02-May-2019562 2715

logs_test.goH A D02-May-2019827 3624

metadata.goH A D02-May-20191 KiB3417

metadata_test.goH A D02-May-2019921 4734

organizations.goH A D02-May-20193.3 KiB11264

organizations_integration_test.goH A D02-May-20191.3 KiB5133

organizations_test.goH A D02-May-20192.1 KiB6144

owners.goH A D02-May-20192.6 KiB9555

owners_integration_test.goH A D02-May-20191.5 KiB5738

owners_test.goH A D02-May-20191.7 KiB6144

preferences.goH A D02-May-20192.7 KiB10565

preferences_integration_test.goH A D02-May-20193.2 KiB11281

preferences_test.goH A D02-May-20192.3 KiB8158

repositories.goH A D02-May-20198.4 KiB274173

repositories_integration_test.goH A D02-May-20194 KiB147105

repositories_test.goH A D02-May-20196.5 KiB193146

requests.goH A D02-May-20197.7 KiB250136

requests_integration_test.goH A D02-May-20193.5 KiB11982

requests_test.goH A D02-May-20195 KiB147109

settings.goH A D02-May-20195.7 KiB202132

settings_integration_test.goH A D02-May-20194.2 KiB159121

settings_test.goH A D02-May-20193.4 KiB10376

stages.goH A D02-May-20191.9 KiB7341

stages_integration_test.goH A D02-May-2019631 2816

stages_test.goH A D02-May-20191 KiB3927

tags.goH A D02-May-2019518 187

testing_helpers_test.goH A D02-May-2019559 2314

travis.goH A D02-May-20198.3 KiB311208

travis_test.goH A D02-May-20194.6 KiB215164

users.goH A D02-May-20193.3 KiB12474

users_integration_test.goH A D02-May-20192 KiB8156

users_test.goH A D02-May-20192.5 KiB8461

version.goH A D02-May-2019211 92

README.md

1go-travis
2====
3
4[![GitHub release](http://img.shields.io/github/release/shuheiktgw/go-travis.svg?style=flat-square)](https://github.com/shuheiktgw/go-travis/releases/latest)
5[![Build Status](https://travis-ci.org/shuheiktgw/go-travis.svg?branch=master)](https://travis-ci.org/shuheiktgw/go-travis)
6[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
7[![GoDoc](https://godoc.org/github.com/shuheiktgw/go-travis?status.svg)](https://godoc.org/github.com/shuheiktgw/go-travis)
8
9go-travis is a Go client library to interact with the [Travis CI API V3](https://developer.travis-ci.com/).
10
11## Installation
12
13```bash
14$ go get github.com/shuheiktgw/go-travis
15```
16
17## Usage
18
19Interaction with the Travis CI API is done through a `Client` instance.
20
21```go
22import "github.com/shuheiktgw/go-travis"
23
24client := travis.NewClient(travis.ApiOrgUrl, "TravisApiToken")
25
26// List all the builds which belongs to the current user
27builds, res, err := client.Builds.Find(context.Background(), nil)
28```
29
30### URL
31Currently, there are two possible options for Travis CI API URL.
32
33- `https://api.travis-ci.org/`
34- `https://api.travis-ci.com/`
35
36You should know which URL your project belongs to, and hand it in to `NewClient` method as an argument. We provide two constants, `ApiOrgUrl` for `https://api.travis-ci.org/` and `ApiComUrl` for `https://api.travis-ci.com/`, so please choose one of them.
37
38Travis CI is migrating projects in `https://api.travis-ci.org/` to `https://api.travis-ci.com/`, and please visit [their documentation page](https://docs.travis-ci.com/user/open-source-on-travis-ci-com#existing-private-repositories-on-travis-cicom) for more information on the migration.
39
40
41### Authentication
42
43There two ways to authenticator your Travis CI client.
44
45- Authentication with Travis API token
46- Authentication with GitHub personal access token
47
48##### Authentication with Travis API token
49
50```go
51client := travis.NewClient(travis.ApiOrgUrl, "TravisApiToken")
52
53// Jobs.Cancel will success
54_, err := client.Jobs.Cancel(context.Background(), 12345)
55```
56
57You can issue Travis API token and hand it in to `NewClient` method directly. You can issue your token by visiting your Travis CI [Profile page](https://travis-ci.com/profile) or using Travis CI [command line tool](https://github.com/travis-ci/travis.rb#readme).
58
59For more information on how to issue Travis CI API token, please visit [their documentation](https://docs.travis-ci.com/user/triggering-builds/).
60
61
62
63##### Authentication with GitHub personal access token
64Authentication with a Github personal access token will require some extra steps. [This GitHub help page](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) guides you thorough how to create one.
65
66```go
67client := travis.NewClient(travis.ApiOrgUrl, "")
68
69err := client.Authentication.UsingGithubToken("GitHubToken")
70
71// Jobs.Cancel will success
72_, err := client.Jobs.Cancel(context.Background(), 12345)
73```
74
75#### Unauthenticated client
76
77It is possible to interact with the API without authentication. However some resources are not accessible.
78
79```go
80client := travis.NewClient(travis.ApiOrgUrl, "")
81
82// Builds.FindByRepoSlug is available without authentication
83builds, resp, err := client.Builds.FindByRepoSlug(context.Background(), "shuheiktgw/go-travis", nil)
84
85// Jobs.Cancel is unavailable without authentication
86_, err := client.Jobs.Cancel(context.Background(), 12345)
87```
88
89## Supported / Unsupported features
90
91### Supported features
92- ~~Covers all the [Travis CI API v3 public endpoints](https://developer.travis-ci.com/)! :tada:~~
93- As of April 14. 2019, there are several changes on the API we have not yet handled yet. Check https://github.com/shuheiktgw/go-travis/issues/19 and help us fix the problems! :+1:
94
95### Unsupported features
96- [Eager loading](https://developer.travis-ci.com/eager-loading#eager%20loading) is not supported so far
97
98## Contribution
99Contributions are of course always welcome!
100
1011. Fork shuheiktgw/go-travis (https://github.com/shuheiktgw/go-travis/fork)
1022. Run `dep ensure` to install dependencies
1033. Create a feature branch
1044. Commit your changes
1055. Run test using `go test`
1066. Create a Pull Request
107
108See [`CONTRIBUTING.md`](https://github.com/shuheiktgw/go-travis/blob/master/CONTRIBUTING.md) for details.
109
110## Acknowledgements
111
112This library is originally forked from [Ableton/go-travis](https://github.com/Ableton/go-travis) and most of the credits of this library is attributed to them.
113