travis

package module
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2019 License: BSD-3-Clause Imports: 11 Imported by: 0

README

go-travis

GitHub release Build Status License GoDoc

go-travis is a Go client library to interact with the Travis CI API V3.

Installation

$ go get github.com/shuheiktgw/go-travis

Usage

Interaction with the Travis CI API is done through a Client instance.

import "github.com/shuheiktgw/go-travis"

client := travis.NewClient(travis.ApiOrgUrl, "TravisApiToken")

// List all the builds which belongs to the current user
builds, res, err := client.Builds.Find(context.Background(), nil)
URL

Currently, there are two possible options for Travis CI API URL.

  • https://api.travis-ci.org/
  • https://api.travis-ci.com/

You 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.

Travis CI is migrating projects in https://api.travis-ci.org/ to https://api.travis-ci.com/, and please visit their documentation page for more information on the migration.

Authentication

There two ways to authenticator your Travis CI client.

  • Authentication with Travis API token
  • Authentication with GitHub personal access token
Authentication with Travis API token
client := travis.NewClient(travis.ApiOrgUrl, "TravisApiToken")

// Jobs.Cancel will success
_, err := client.Jobs.Cancel(context.Background(), 12345)

You 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 or using Travis CI command line tool.

For more information on how to issue Travis CI API token, please visit their documentation.

Authentication with GitHub personal access token

Authentication with a Github personal access token will require some extra steps. This GitHub help page guides you thorough how to create one.

client := travis.NewClient(travis.ApiOrgUrl, "")

err := client.Authentication.UsingGithubToken("GitHubToken")

// Jobs.Cancel will success
_, err := client.Jobs.Cancel(context.Background(), 12345)
Unauthenticated client

It is possible to interact with the API without authentication. However some resources are not accessible.

client := travis.NewClient(travis.ApiOrgUrl, "")

// Builds.FindByRepoSlug is available without authentication
builds, resp, err := client.Builds.FindByRepoSlug(context.Background(), "shuheiktgw/go-travis", nil)

// Jobs.Cancel is unavailable without authentication
_, err := client.Jobs.Cancel(context.Background(), 12345)

Supported / Unsupported features

Supported features
Unsupported features

Contribution

Contributions are of course always welcome!

  1. Fork shuheiktgw/go-travis (https://github.com/shuheiktgw/go-travis/fork)
  2. Run dep ensure to install dependencies
  3. Create a feature branch
  4. Commit your changes
  5. Run test using go test
  6. Create a Pull Request

See CONTRIBUTING.md for details.

Acknowledgements

This library is originally forked from Ableton/go-travis and most of the credits of this library is attributed to them.

Documentation

Index

Constants

View Source
const (
	// BuildStateCreated represents the build state `created`
	BuildStateCreated = "created"
	// BuildStateReceived represents the build state `received`
	BuildStateReceived = "received"
	// BuildStateStarted represents the build state `started`
	BuildStateStarted = "started"
	// BuildStatePassed represents the build state `passed`
	BuildStatePassed = "passed"
	// BuildStateFailed represents the build state `failed`
	BuildStateFailed = "failed"
	// BuildStateErrored represents the build state `errored`
	BuildStateErrored = "errored"
	// BuildStateCanceled represents the build state `canceled`
	BuildStateCanceled = "canceled"
)
View Source
const (
	// BuildEventTypePush represents the build event type `push`
	BuildEventTypePush = "push"
	// BuildEventTypePullRequest represents the build event type `pull_request`
	BuildEventTypePullRequest = "pull_request"
)
View Source
const (
	CronIntervalDaily   = "daily"
	CronIntervalWeekly  = "weekly"
	CronIntervalMonthly = "monthly"
)
View Source
const (
	// JobStatusCreated represents the job state `created`
	JobStatusCreated = "created"
	// JobStatusQueued represents the job state `queued`
	JobStatusQueued = "queued"
	// JobStatusReceived represents the job state `received`
	JobStatusReceived = "received"
	// JobStatusStarted represents the job state `started`
	JobStatusStarted = "started"
	// JobStatusCanceled represents the job state `canceled`
	JobStatusCanceled = "canceled"
	// JobStatusPassed represents the job state `passed`
	JobStatusPassed = "passed"
)
View Source
const (
	// BuildsOnlyWithTravisYmlSetting is a setting name for builds_only_with_travis_yml
	BuildsOnlyWithTravisYmlSetting = "builds_only_with_travis_yml"
	// BuildPushesSetting is a setting name for build_pushes
	BuildPushesSetting = "build_pushes"
	// BuildPullRequestsSetting is a setting name for build_pull_requests
	BuildPullRequestsSetting = "build_pull_requests"
	// MaximumNumberOfBuildsSetting is a setting name for maximum_number_of_builds
	MaximumNumberOfBuildsSetting = "maximum_number_of_builds"
	// AutoCancelPushesSetting is a setting name for auto_cancel_pushes
	AutoCancelPushesSetting = "auto_cancel_pushes"
	// AutoCancelPullRequestsSetting is a setting name for auto_cancel_pull_requests
	AutoCancelPullRequestsSetting = "auto_cancel_pull_requests"
)
View Source
const (
	ApiOrgUrl = "https://api.travis-ci.org/"
	ApiComUrl = "https://api.travis-ci.com/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken string

AccessToken is a token to access Travis CI API

type ActiveService added in v0.0.2

type ActiveService struct {
	// contains filtered or unexported fields
}

ActiveService handles communication with the active endpoints of Travis CI API

func (*ActiveService) FindByGitHubId added in v0.0.2

func (as *ActiveService) FindByGitHubId(ctx context.Context, githubId uint) ([]Build, *http.Response, error)

FindByGitHubId fetches active builds based on the owner's GitHub id

Travis CI API docs: https://developer.travis-ci.com/resource/active#for_owner

func (*ActiveService) FindByOwner added in v0.0.2

func (as *ActiveService) FindByOwner(ctx context.Context, owner string) ([]Build, *http.Response, error)

FindByOwner fetches active builds based on the owner's name

Travis CI API docs: https://developer.travis-ci.com/resource/active#for_owner

type AuthenticationService

type AuthenticationService struct {
	// contains filtered or unexported fields
}

BuildsService handles communication with the builds related methods of the Travis CI API.

func (*AuthenticationService) UsingGithubToken

func (as *AuthenticationService) UsingGithubToken(ctx context.Context, githubToken string) (AccessToken, *http.Response, error)

UsingGithubToken will generate a Travis CI API authentication token and call the UsingTravisToken method with it, leaving your client authenticated and ready to use.

func (*AuthenticationService) UsingTravisToken

func (as *AuthenticationService) UsingTravisToken(travisToken string) error

UsingTravisToken will format and write provided travisToken in the AuthenticationService client's headers.

type BetaFeature added in v0.1.0

type BetaFeature struct {
	// Value uniquely identifying the beta feature
	Id uint `json:"id,omitempty"`
	// The name of the feature
	Name string `json:"name,omitempty"`
	// Longer description of the feature
	Description string `json:"description,omitempty"`
	// Indicates if the user has this feature turned on
	Enabled bool `json:"enabled,omitempty"`
	// Url for users to leave Travis CI feedback on this feature
	FeedbackUrl string `json:"feedback_url,omitempty"`
	Metadata
}

BetaFeature is a standard representation of an individual beta feature

Travis CI API docs: https://developer.travis-ci.com/resource/beta_feature#attributes

type BetaFeaturesService added in v0.1.0

type BetaFeaturesService struct {
	// contains filtered or unexported fields
}

BetaFeaturesService handles communication with the beta feature related methods of the Travis CI API.

func (*BetaFeaturesService) List added in v0.1.0

func (bs *BetaFeaturesService) List(ctx context.Context, userId uint) ([]BetaFeature, *http.Response, error)

List fetches a list of beta features available to a user

Travis CI API docs: https://developer.travis-ci.com/resource/beta_features#find

func (*BetaFeaturesService) Update added in v0.1.0

func (bs *BetaFeaturesService) Update(ctx context.Context, userId uint, id uint, enabled bool) (*BetaFeature, *http.Response, error)

Update updates a user's beta_feature

Travis CI API docs: https://developer.travis-ci.com/resource/beta_feature#update

type Branch

type Branch struct {
	// Name of the git branch
	Name string `json:"name,omitempty"`
	// GitHub Repository
	Repository MinimalRepository `json:"repository,omitempty"`
	// Whether or not this is the repository's default branch
	DefaultBranch bool `json:"default_branch,omitempty"`
	// Whether or not the branch still exists on GitHub
	ExistsOnGithub bool `json:"exists_on_github,omitempty"`
	// Last build on the branch
	LastBuild MinimalBuild `json:"last_build,omitempty"`
	Metadata
}

Branch represents a branch of a GitHub repository

Travis CI API docs: https://developer.travis-ci.com/resource/branch#standard-representation

type BranchesService

type BranchesService struct {
	// contains filtered or unexported fields
}

BranchesService handles communication with the branch related methods of the Travis CI API.

func (*BranchesService) FindByRepoId

func (bs *BranchesService) FindByRepoId(ctx context.Context, repoId uint, branchName string) (*Branch, *http.Response, error)

FindByRepoId fetches a branch based on the provided repository id and branch name

Travis CI API docs: https://developer.travis-ci.com/resource/branch#find

func (*BranchesService) FindByRepoSlug

func (bs *BranchesService) FindByRepoSlug(ctx context.Context, repoSlug string, branchName string) (*Branch, *http.Response, error)

FindByRepoSlug fetches a branch based on the provided repository slug and branch name

Travis CI API docs: https://developer.travis-ci.com/resource/branch#find

func (*BranchesService) ListByRepoId added in v0.0.7

func (bs *BranchesService) ListByRepoId(ctx context.Context, repoId uint, opt *ListBranchesOption) ([]Branch, *http.Response, error)

ListByRepoId fetches the branches of a given repository id.

Travis CI API docs: https://developer.travis-ci.com/resource/branches#find

func (*BranchesService) ListByRepoSlug added in v0.0.7

func (bs *BranchesService) ListByRepoSlug(ctx context.Context, repoSlug string, opt *ListBranchesOption) ([]Branch, *http.Response, error)

ListByRepoSlug fetches the branches of a given repository slug.

Travis CI API docs: https://developer.travis-ci.com/resource/branches#find

type Broadcast added in v0.0.9

type Broadcast struct {
	// Value uniquely identifying the broadcast
	Id uint `json:"id,omitempty"`
	// Message to display to the user
	Message string `json:"message,omitempty"`
	// Broadcast category (used for icon and color)
	Category string `json:"category,omitempty"`
	// Whether or not the broadcast should still be displayed
	Active bool `json:"active,omitempty"`
	// When the broadcast was created
	CreatedAt string `json:"created_at,omitempty"`
	// Either a user, organization or repository, or null for global
	Recipient interface{} `json:"recipient,omitempty"`
	Metadata
}

Broadcast is a standard representation of an individual broadcast

Travis CI API docs: https://developer.travis-ci.com/resource/broadcast#standard-representation

type BroadcastsOption added in v0.0.9

type BroadcastsOption struct {
	// Filters broadcasts by whether or not the broadcast should still be displayed
	Active bool `url:"active"`
}

BroadcastsOption specifies the optional parameters for broadcasts endpoint

type BroadcastsService added in v0.0.9

type BroadcastsService struct {
	// contains filtered or unexported fields
}

BroadcastsService handles communication with the broadcasts related methods of the Travis CI API.

func (*BroadcastsService) List added in v0.0.9

List fetches a list of broadcasts for the current user

Travis CI API docs: https://developer.travis-ci.com/resource/broadcasts#for_current_user

type Build

type Build struct {
	// Value uniquely identifying the build
	Id uint `json:"id,omitempty"`
	// Incremental number for a repository's builds
	Number string `json:"number,omitempty"`
	// Current state of the build
	State string `json:"state,omitempty"`
	// Wall clock time in seconds
	Duration uint `json:"duration,omitempty"`
	// Event that triggered the build
	EventType string `json:"event_type,omitempty"`
	// State of the previous build (useful to see if state changed)
	PreviousState string `json:"previous_state,omitempty"`
	// Title of the build's pull request
	PullRequestTitle string `json:"pull_request_title,omitempty"`
	// Number of the build's pull request
	PullRequestNumber uint `json:"pull_request_number,omitempty"`
	// When the build started
	StartedAt string `json:"started_at,omitempty"`
	// When the build finished
	FinishedAt string `json:"finished_at,omitempty"`
	// The last time the build was updated
	UpdatedAt string `json:"updated_at,omitempty"`
	// Whether or not the build is private
	Private bool `json:"private,omitempty"`
	// GitHub repository the build is associated with
	Repository MinimalRepository `json:"repository,omitempty"`
	// The branch the build is associated with
	Branch MinimalBranch `json:"branch,omitempty"`
	// The build's tag
	Tag MinimalTag `json:"tag,omitempty"`
	// The commit the build is associated with
	Commit MinimalCommit `json:"commit,omitempty"`
	// List of jobs that are part of the build's matrix
	Jobs []MinimalJob `json:"jobs,omitempty"`
	// The stages of the build
	Stages []MinimalStage `json:"stages,omitempty"`
	// The User or Organization that created the build
	CreatedBy MinimalOwner `json:"owner,omitempty"`
	Metadata
}

Build represents a Travis CI build

Travis CI API docs: https://developer.travis-ci.com/resource/build#standard-representation

type BuildsByRepoOption added in v0.1.4

type BuildsByRepoOption struct {
	// Filters builds by name of the git branch
	BranchName []string `url:"branch.name,omitempty,comma"`
	// The User or Organization that created the build
	CreatedBy []string `url:"created_by,omitempty,comma"`
	// Event that triggered the build
	EventType []string `url:"event_type,omitempty,comma"`
	// State of the previous build (useful to see if state changed)
	PreviousState []string `url:"previous_state,omitempty,comma"`
	// Current state of the build
	State []string `url:"state,omitempty,comma"`
	// How many builds to include in the response
	Limit int `url:"limit,omitempty"`
	// How many builds to skip before the first entry in the response
	Offset int `url:"offset,omitempty"`
	// Attributes to sort builds by
	SortBy string `url:"sort_by,omitempty"`
}

BuildsByRepoOption specifies the optional parameters for builds endpoint

type BuildsOption

type BuildsOption struct {
	// How many builds to include in the response
	Limit int `url:"limit,omitempty"`
	// How many builds to skip before the first entry in the response
	Offset int `url:"offset,omitempty"`
	// Attributes to sort builds by
	SortBy string `url:"sort_by,omitempty"`
}

BuildsOption specifies the optional parameters for builds endpoint

type BuildsService

type BuildsService struct {
	// contains filtered or unexported fields
}

BuildsService handles communication with the builds related methods of the Travis CI API.

func (*BuildsService) Cancel added in v0.0.7

func (bs *BuildsService) Cancel(ctx context.Context, id uint) (*MinimalBuild, *http.Response, error)

Cancel cancels a build based on the provided build id

Travis CI API docs: https://developer.travis-ci.com/resource/build#cancel

func (*BuildsService) Find

func (bs *BuildsService) Find(ctx context.Context, id uint) (*Build, *http.Response, error)

Find fetches a build based on the provided build id

Travis CI API docs: https://developer.travis-ci.com/resource/build#find

func (*BuildsService) List added in v0.0.7

func (bs *BuildsService) List(ctx context.Context, opt *BuildsOption) ([]Build, *http.Response, error)

List fetches current user's builds based on the provided options

Travis CI API docs: https://developer.travis-ci.com/resource/builds#for_current_user

func (*BuildsService) ListByRepoId added in v0.0.7

func (bs *BuildsService) ListByRepoId(ctx context.Context, repoId uint, opt *BuildsByRepoOption) ([]Build, *http.Response, error)

ListByRepoId fetches current user's builds based on the repository id and options

Travis CI API docs: https://developer.travis-ci.com/resource/builds#find

func (*BuildsService) ListByRepoSlug added in v0.0.7

func (bs *BuildsService) ListByRepoSlug(ctx context.Context, repoSlug string, opt *BuildsByRepoOption) ([]Build, *http.Response, error)

ListByRepoSlug fetches current user's builds based on the repository slug and options

Travis CI API docs: https://developer.travis-ci.com/resource/builds#find

func (*BuildsService) Restart added in v0.0.7

func (bs *BuildsService) Restart(ctx context.Context, id uint) (*MinimalBuild, *http.Response, error)

Restart restarts a build based on the provided build id

Travis CI API docs: https://developer.travis-ci.com/resource/build#restart

type Cache added in v0.0.4

type Cache struct {
	// The branch the cache belongs to
	Branch string `json:"branch,omitempty"`
	// The string to match against the cache name
	Match string `json:"match,omitempty"`
	Metadata
}

Cache is a standard representation of a cache on Travis CI

Travis CI API docs: https://developer.travis-ci.com/resource/caches#attributes

type CachesService added in v0.0.4

type CachesService struct {
	// contains filtered or unexported fields
}

CachesService handles communication with the caches endpoints of Travis CI API

func (*CachesService) DeleteByRepoId added in v0.0.4

func (cs *CachesService) DeleteByRepoId(ctx context.Context, repoId uint) ([]Cache, *http.Response, error)

DeleteByRepoId deletes caches based on the given repository id

Travis CI API docs: https://developer.travis-ci.com/resource/caches#delete

func (*CachesService) DeleteByRepoSlug added in v0.0.4

func (cs *CachesService) DeleteByRepoSlug(ctx context.Context, repoSlug string) ([]Cache, *http.Response, error)

DeleteByRepoSlug deletes caches based on the given repository slug

Travis CI API docs: https://developer.travis-ci.com/resource/caches#delete

func (*CachesService) ListByRepoId added in v0.0.7

func (cs *CachesService) ListByRepoId(ctx context.Context, repoId uint) ([]Cache, *http.Response, error)

ListByRepoId fetches caches based on the given repository id

Travis CI API docs: https://developer.travis-ci.com/resource/caches#find

func (*CachesService) ListByRepoSlug added in v0.0.7

func (cs *CachesService) ListByRepoSlug(ctx context.Context, repoSlug string) ([]Cache, *http.Response, error)

ListByRepoSlug fetches caches based on the given repository slug

Travis CI API docs: https://developer.travis-ci.com/resource/caches#find

type Client

type Client struct {
	// HTTP client used to communicate with the API
	HTTPClient *http.Client

	// Headers to attach to every requests made with the client.
	// As a default, Headers will be used to provide Travis API authentication
	// token and other necessary headers.
	// However these could be updated per-request through a parameters.
	Headers map[string]string

	// Base URL for api requests. Defaults to the public Travis API, but
	// can be set to an alternative endpoint to use with Travis Pro or Enterprise.
	// BaseURL should always be terminated by a slash.
	BaseURL *url.URL

	// User agent used when communicating with the Travis API
	UserAgent string

	// Services used to manipulate API entities
	Active             *ActiveService
	Authentication     *AuthenticationService
	BetaFeatures       *BetaFeaturesService
	Branches           *BranchesService
	Broadcasts         *BroadcastsService
	Builds             *BuildsService
	Caches             *CachesService
	Crons              *CronsService
	EmailSubscriptions *EmailSubscriptionsService
	EnvVars            *EnvVarsService
	Installations      *InstallationsService
	Jobs               *JobsService
	Lint               *LintService
	Logs               *LogsService
	Organizations      *OrganizationsService
	Owner              *OwnerService
	Preferences        *PreferencesService
	Repositories       *RepositoriesService
	Requests           *RequestsService
	Settings           *SettingsService
	User               *UserService
}

A Client manages communication with the Travis CI API.

func NewClient

func NewClient(baseUrl string, travisToken string) *Client

NewClient returns a new Travis API client. If travisToken is not provided, the client can be authenticated at any time, using it's Authentication exposed service.

func NewDefaultClient

func NewDefaultClient(travisToken string) *Client

NewDefaultClient returns a new Travis API client bound to the public travis API. If travisToken is not provided, the client can be authenticated at any time, using it's Authentication exposed service.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.

func (*Client) IsAuthenticated

func (c *Client) IsAuthenticated() bool

IsAuthenticated indicates if Authorization headers were found in Client.Headers mapping.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}, headers map[string]string) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body. If specified, the map provided by headers will be used to udate request headers.

type Cron added in v0.0.4

type Cron struct {
	// Value uniquely identifying the cron
	Id uint `json:"id,omitempty"`
	// Github repository to which this cron belongs
	Repository MinimalRepository `json:"repository,omitempty"`
	// Git branch of repository to which this cron belongs
	Branch MinimalBranch `json:"branch,omitempty"`
	// Interval at which the cron will run (can be "daily", "weekly" or "monthly")
	Interval string `json:"interval,omitempty"`
	// Whether a cron build should run if there has been a build on this branch in the last 24 hours
	DontRunIfRecentBuildExists bool `json:"dont_run_if_recent_build_exists,omitempty"`
	// When the cron ran last
	LastRun string `json:"last_run,omitempty"`
	// When the cron is scheduled to run next
	NextRun string `json:"next_run,omitempty"`
	// When the cron was created
	CreatedAt string `json:"created_at,omitempty"`
	// Whether the cron is active or not
	Active bool `json:"active,omitempty"`
	Metadata
}

Cron is a standard representation of an individual cron

Travis CI API docs: https://developer.travis-ci.com/resource/cron#standard-representation

type CronBody added in v0.0.4

type CronBody struct {
	// Interval at which the cron will run (can be "daily", "weekly" or "monthly")
	Interval string `json:"cron.interval,omitempty"`
	// Whether a cron build should run if there has been a build on this branch in the last 24 hours
	DontRunIfRecentBuildExists bool `json:"cron.dont_run_if_recent_build_exists"`
}

CronBody specifies body for creating cron.

type CronsOption added in v0.0.4

type CronsOption struct {
	// How many crons to include in the response
	Limit int `url:"limit,omitempty"`
	// How many crons to skip before the first entry in the response
	Offset int `url:"offset,omitempty"`
}

CronsOption specifies options for fetching crons.

type CronsService added in v0.0.4

type CronsService struct {
	// contains filtered or unexported fields
}

CronsService handles communication with the crons related methods of the Travis CI API.

func (*CronsService) CreateByRepoId added in v0.0.7

func (cs *CronsService) CreateByRepoId(ctx context.Context, repoId uint, branchName string, cron *CronBody) (*Cron, *http.Response, error)

CreateByRepoId creates a cron based on the provided repository id and branch name

Travis CI API docs: https://developer.travis-ci.com/resource/cron#create

func (*CronsService) CreateByRepoSlug added in v0.0.7

func (cs *CronsService) CreateByRepoSlug(ctx context.Context, repoSlug string, branchName string, cron *CronBody) (*Cron, *http.Response, error)

CreateByRepoSlug creates a cron based on the provided repository slug and branch name

Travis CI API docs: https://developer.travis-ci.com/resource/cron#create

func (*CronsService) Delete added in v0.0.7

func (cs *CronsService) Delete(ctx context.Context, id uint) (*http.Response, error)

Delete deletes a cron based on the provided id

Travis CI API docs: https://developer.travis-ci.com/resource/cron#delete

func (*CronsService) Find added in v0.0.7

func (cs *CronsService) Find(ctx context.Context, id uint) (*Cron, *http.Response, error)

Find fetches a cron based on the provided id

Travis CI API docs: https://developer.travis-ci.com/resource/cron#find

func (*CronsService) FindByRepoId added in v0.0.4

func (cs *CronsService) FindByRepoId(ctx context.Context, repoId uint, branch string) (*Cron, *http.Response, error)

FindByRepoId fetches a cron based on the provided repository id and branch name

Travis CI API docs: https://developer.travis-ci.com/resource/cron#for_branch

func (*CronsService) FindByRepoSlug added in v0.0.4

func (cs *CronsService) FindByRepoSlug(ctx context.Context, repoSlug string, branch string) (*Cron, *http.Response, error)

FindByRepoSlug fetches a cron based on the provided repository slug and branch name

Travis CI API docs: https://developer.travis-ci.com/resource/cron#for_branch

func (*CronsService) ListByRepoId added in v0.0.7

func (cs *CronsService) ListByRepoId(ctx context.Context, repoId uint, opt *CronsOption) ([]Cron, *http.Response, error)

ListByRepoId fetches crons based on the provided repository id

Travis CI API docs: https://developer.travis-ci.com/resource/crons#for_repository

func (*CronsService) ListByRepoSlug added in v0.0.7

func (cs *CronsService) ListByRepoSlug(ctx context.Context, repoSlug string, opt *CronsOption) ([]Cron, *http.Response, error)

ListByRepoSlug fetches crons based on the provided repository slug

Travis CI API docs: https://developer.travis-ci.com/resource/crons#for_repository

type EmailSubscriptionsService added in v0.0.7

type EmailSubscriptionsService struct {
	// contains filtered or unexported fields
}

EmailSubscriptionService handles communication with the email subscription related methods of the Travis CI API.

func (*EmailSubscriptionsService) SubscribeByRepoId added in v0.0.7

func (es *EmailSubscriptionsService) SubscribeByRepoId(ctx context.Context, repoId uint) (*http.Response, error)

SubscribeByRepoId enables an email subscription of the repository based on the provided repository id

Travis CI API docs: https://developer.travis-ci.com/resource/email_subscription#resubscribe

func (*EmailSubscriptionsService) SubscribeByRepoSlug added in v0.0.7

func (es *EmailSubscriptionsService) SubscribeByRepoSlug(ctx context.Context, repoSlug string) (*http.Response, error)

SubscribeByRepoSlug enables an email subscription of the repository based on the provided repository slug

Travis CI API docs: https://developer.travis-ci.com/resource/email_subscription#resubscribe

func (*EmailSubscriptionsService) UnsubscribeByRepoId added in v0.0.7

func (es *EmailSubscriptionsService) UnsubscribeByRepoId(ctx context.Context, repoId uint) (*http.Response, error)

UnsubscribeByRepoId disables an email subscription of the repository based on the provided repository id

Travis CI API docs: https://developer.travis-ci.com/resource/email_subscription#unsubscribe

func (*EmailSubscriptionsService) UnsubscribeByRepoSlug added in v0.0.7

func (es *EmailSubscriptionsService) UnsubscribeByRepoSlug(ctx context.Context, repoSlug string) (*http.Response, error)

UnsubscribeByRepoSlug disables an email subscription of the repository based on the provided repository slug

Travis CI API docs: https://developer.travis-ci.com/resource/email_subscription#unsubscribe

type EnvVar added in v0.0.3

type EnvVar struct {
	// The environment variable id
	Id string `json:"id,omitempty"`
	// The environment variable name, e.g. FOO
	Name string `json:"name,omitempty"`
	// The environment variable's value, e.g. bar
	Value string `json:"value,omitempty"`
	// Whether this environment variable should be publicly visible or not
	Public bool `json:"public,omitempty"`
	Metadata
}

EnvVar is a standard representation of a environment variable on Travis CI

Travis CI API docs: https://developer.travis-ci.com/resource/env_var#standard-representation

type EnvVarBody added in v0.0.4

type EnvVarBody struct {
	// The environment variable name, e.g. FOO
	Name string `json:"env_var.name,omitempty"`
	// The environment variable's value, e.g. bar
	Value string `json:"env_var.value,omitempty"`
	// Whether this environment variable should be publicly visible or not
	Public bool `json:"env_var.public"`
}

EnvVarBody specifies options for creating and updating env var.

type EnvVarsService added in v0.0.3

type EnvVarsService struct {
	// contains filtered or unexported fields
}

EnvVarsService handles communication with the env vars endpoints of Travis CI API

func (*EnvVarsService) CreateByRepoId added in v0.0.3

func (es *EnvVarsService) CreateByRepoId(ctx context.Context, repoId uint, envVar *EnvVarBody) (*EnvVar, *http.Response, error)

CreateByRepoId creates environment variable based on the given repository id

Travis CI API docs: https://developer.travis-ci.com/resource/env_vars#create

func (*EnvVarsService) CreateByRepoSlug added in v0.0.3

func (es *EnvVarsService) CreateByRepoSlug(ctx context.Context, repoSlug string, envVar *EnvVarBody) (*EnvVar, *http.Response, error)

CreateByRepoSlug creates environment variable based on the given repository slug

Travis CI API docs: https://developer.travis-ci.com/resource/env_vars#create

func (*EnvVarsService) DeleteByRepoId added in v0.0.7

func (es *EnvVarsService) DeleteByRepoId(ctx context.Context, repoId uint, id string) (*http.Response, error)

DeleteByRepoId deletes environment variable based on the given repository id and the env var id

Travis CI API docs: https://developer.travis-ci.com/resource/env_var#delete

func (*EnvVarsService) DeleteByRepoSlug added in v0.0.7

func (es *EnvVarsService) DeleteByRepoSlug(ctx context.Context, repoSlug string, id string) (*http.Response, error)

DeleteByRepoSlug deletes environment variable based on the given repository slug and the env var id

Travis CI API docs: https://developer.travis-ci.com/resource/env_var#delete

func (*EnvVarsService) FindByRepoId added in v0.0.3

func (es *EnvVarsService) FindByRepoId(ctx context.Context, repoId uint, id string) (*EnvVar, *http.Response, error)

FindByRepoId fetches environment variable based on the given repository id and env var id

Travis CI API docs: https://developer.travis-ci.com/resource/env_var#find

func (*EnvVarsService) FindByRepoSlug added in v0.0.3

func (es *EnvVarsService) FindByRepoSlug(ctx context.Context, repoSlug string, id string) (*EnvVar, *http.Response, error)

FindByRepoSlug fetches environment variable based on the given repository slug and env var id

Travis CI API docs: https://developer.travis-ci.com/resource/env_var#find

func (*EnvVarsService) ListByRepoId added in v0.0.7

func (es *EnvVarsService) ListByRepoId(ctx context.Context, repoId uint) ([]EnvVar, *http.Response, error)

ListByRepoId fetches environment variables based on the given repository id

Travis CI API docs: https://developer.travis-ci.com/resource/env_vars#for_repository

func (*EnvVarsService) ListByRepoSlug added in v0.0.7

func (es *EnvVarsService) ListByRepoSlug(ctx context.Context, repoSlug string) ([]EnvVar, *http.Response, error)

ListByRepoSlug fetches environment variables based on the given repository slug

Travis CI API docs: https://developer.travis-ci.com/resource/env_vars#for_repository

func (*EnvVarsService) UpdateByRepoId added in v0.0.7

func (es *EnvVarsService) UpdateByRepoId(ctx context.Context, repoId uint, id string, envVar *EnvVarBody) (*EnvVar, *http.Response, error)

UpdateByRepoId updates environment variable based on the given option

Travis CI API docs: https://developer.travis-ci.com/resource/env_var#update

func (*EnvVarsService) UpdateByRepoSlug added in v0.0.7

func (es *EnvVarsService) UpdateByRepoSlug(ctx context.Context, repoSlug string, id string, envVar *EnvVarBody) (*EnvVar, *http.Response, error)

UpdateByRepoSlug updates environment variable based on the given option

Travis CI API docs: https://developer.travis-ci.com/resource/env_var#update

type ErrorResponse

type ErrorResponse struct {
	// HTTP response that caused this error
	Response *http.Response

	// The error's type
	ErrorType string `json:"error_type"`

	// The error's message
	ErrorMessage string `json:"error_message"`

	// The error's resource type
	ResourceType string `json:"resource_type"`

	// The error's permission
	Permission string `json:"permission"`
}

ErrorResponse reports an error caused by an API request. ErrorResponse implemented the Error interface.

Travis CI API docs: https://developer.travis-ci.com/resource/error#error

func (*ErrorResponse) Error

func (er *ErrorResponse) Error() string

type Installation added in v0.0.6

type Installation struct {
	// The installation id
	Id uint `json:"id,omitempty"`
	// The installation's id on GitHub
	GitHubId uint `json:"github_id,omitempty"`
	// GitHub user or organization the installation belongs to
	Owner MinimalOwner `json:"owner,omitempty"`
	Metadata
}

Installation represents a GitHub App installation

Travis CI API docs: https://developer.travis-ci.com/resource/installation#standard-representation

type InstallationsService added in v0.0.7

type InstallationsService struct {
	// contains filtered or unexported fields
}

InstallationsService handles communication with the installation related methods of the Travis CI API.

func (*InstallationsService) Find added in v0.0.7

Find fetches a single GitHub installation based on the provided id.

Travis CI API docs: https://developer.travis-ci.com/resource/installation#find

type Job

type Job struct {
	// Value uniquely identifying the job
	Id uint `json:"id,omitempty"`
	// The job's allow_failure
	AllowFailure bool `json:"allow_failure,omitempty"`
	// Incremental number for a repository's builds
	Number string `json:"number,omitempty"`
	// Current state of the job
	State string `json:"state,omitempty"`
	// When the job started
	StartedAt string `json:"started_at,omitempty"`
	// When the job finished
	FinishedAt string `json:"finished_at,omitempty"`
	// The build the job is associated with
	Build MinimalBuild `json:"build,omitempty"`
	// Worker queue this job is/was scheduled on
	Queue string `json:"queue,omitempty"`
	// GitHub repository the job is associated with
	Repository MinimalRepository `json:"repository,omitempty"`
	// The commit the job is associated with
	Commit MinimalCommit `json:"commit,omitempty"`
	// GitHub user or organization the job belongs to
	Owner MinimalOwner `json:"owner,omitempty"`
	// The stages of the job
	Stage MinimalStage `json:"stage,omitempty"`
	// When the job was created
	CreatedAt string `json:"created_at,omitempty"`
	// When the job was updated
	UpdatedAt string `json:"updated_at,omitempty"`
	// Whether or not the job is private
	Private bool `json:"private,omitempty"`
	Metadata
}

Job represents a Travis CI job

Travis CI API docs: https://developer.travis-ci.com/resource/job#standard-representation

type JobsOption

type JobsOption struct {
	// How many jobs to include in the response
	Limit int `url:"limit,omitempty"`
	// How many jobs to skip before the first entry in the response
	Offset int `url:"offset,omitempty"`
	// Attributes to sort jobs by
	SortBy []string `url:"sort_by,omitempty,comma"`
	// // Current state of the job
	State []string `url:"state,omitempty,comma"`
}

JobsOption is query parameters to one can specify to find jobs

type JobsService

type JobsService struct {
	// contains filtered or unexported fields
}

JobsService handles communication with the jobs related methods of the Travis CI API.

func (*JobsService) Cancel added in v0.0.7

func (js *JobsService) Cancel(ctx context.Context, id uint) (*MinimalJob, *http.Response, error)

Cancel cancels a job based on the provided job id

Travis CI API docs: https://developer.travis-ci.com/resource/job#cancel

func (*JobsService) Debug added in v0.0.7

func (js *JobsService) Debug(ctx context.Context, id uint) (*MinimalJob, *http.Response, error)

Debug restarts a job in debug mode based on the provided job id Debug is only available on the travis-ci.com domain, and you need to enable the debug feature

Travis CI API docs: https://developer.travis-ci.com/resource/job#debug

func (*JobsService) Find

func (js *JobsService) Find(ctx context.Context, id uint) (*Job, *http.Response, error)

Find fetches a job based on the provided job id

Travis CI API docs: https://developer.travis-ci.com/resource/job#find

func (*JobsService) List added in v0.0.7

func (js *JobsService) List(ctx context.Context, opt *JobsOption) ([]Job, *http.Response, error)

List fetches current user's jobs based on the provided options As of 2018/9/4, this endpoint returns 500 and does not seem to work correctly See jobs_integration_test.go, TestJobsService_Find

Travis CI API docs: https://developer.travis-ci.com/resource/jobs#find

func (*JobsService) ListByBuild added in v0.0.7

func (js *JobsService) ListByBuild(ctx context.Context, buildId uint) ([]Job, *http.Response, error)

ListByBuild fetches jobs based on the provided build id

Travis CI API docs: https://developer.travis-ci.csom/resource/jobs#find

func (*JobsService) Restart added in v0.0.7

func (js *JobsService) Restart(ctx context.Context, id uint) (*MinimalJob, *http.Response, error)

Restart restarts a job based on the provided job id

Travis CI API docs: https://developer.travis-ci.com/resource/job#restart

type LintService added in v0.0.5

type LintService struct {
	// contains filtered or unexported fields
}

LintService handles communication with the lint endpoint of Travis CI API

func (*LintService) Lint added in v0.0.5

func (es *LintService) Lint(ctx context.Context, yml *TravisYml) ([]Warning, *http.Response, error)

Lint validates the .travis.yml file and returns any warnings

Travis CI API docs: https://developer.travis-ci.com/resource/lint#lint

type ListBranchesOption added in v0.0.7

type ListBranchesOption struct {
	// Whether or not the branch still exists on GitHub
	ExistsOnGithub bool `url:"exists_on_github,omitempty"`
	// How many branches to include in the response
	Limit int `url:"limit,omitempty"`
	// How many branches to skip before the first entry in the response
	Offset int `url:"offset,omitempty"`
	// Attributes to sort branches by
	SortBy string `url:"sort_by,omitempty"`
}

ListBranchesOption specifies the optional parameters for branches endpoint

type ListRequestsOption added in v0.0.7

type ListRequestsOption struct {
	// How many requests to include in the response
	Limit int `url:"limit,omitempty"`
	// How many requests to skip before the first entry in the response
	Offset int `url:"offset,omitempty"`
}

ListRequestsOption specifies options for FindRequests request.

type Log

type Log struct {
	// The log's id
	Id uint `json:"id,omitempty"`
	// The content of the log
	Content string `json:"content,omitempty"`
	// The log parts that form the log
	LogParts []LogPart `json:"log_parts,omitempty"`
	Metadata
}

Log represents a Travis CI job log

type LogPart

type LogPart struct {
	Content string `json:"content,omitempty"`
	Final   bool   `json:"final,omitempty"`
	Number  uint   `json:"number,omitempty"`
}

LogPart is parts that form the log

type LogsService added in v0.0.7

type LogsService struct {
	// contains filtered or unexported fields
}

LogsService handles communication with the logs related methods of the Travis CI API.

func (*LogsService) FindByJob added in v0.0.7

func (ls *LogsService) FindByJob(ctx context.Context, jobId uint) (*Log, *http.Response, error)

FindByJob fetches a job's log based on it's provided id.

Travis CI API docs: https://developer.travis-ci.com/resource/log#find

type Metadata added in v0.0.8

type Metadata struct {
	// The type of data returned from the API
	Type string `json:"@type,omitempty"`
	// The link for data returned from the API
	Href string `json:"@href,omitempty"`
	// The representation of data returned from the API, standard or minimal
	Representation string `json:"@representation,omitempty"`
	// The permissions of data returned from the API
	Permissions Permissions `json:"@permissions,omitempty"`
}

Metadata is a metadata returned from the Travis CI API

type MinimalBranch

type MinimalBranch struct {
	// Name of the git branch
	Name string `json:"name,omitempty"`
}

MinimalBranch included when the resource is returned as part of another resource

Travis CI API docs: https://developer.travis-ci.com/resource/branch#minimal-representation

type MinimalBuild

type MinimalBuild struct {
	// Value uniquely identifying the build
	Id uint `json:"id,omitempty"`
	// Incremental number for a repository's builds
	Number string `json:"number,omitempty"`
	// Current state of the build
	State string `json:"state,omitempty"`
	// Wall clock time in seconds
	Duration uint `json:"duration,omitempty"`
	// Event that triggered the build
	EventType string `json:"event_type,omitempty"`
	// State of the previous build (useful to see if state changed)
	PreviousState string `json:"previous_state,omitempty"`
	// Title of the build's pull request
	PullRequestTitle string `json:"pull_request_title,omitempty"`
	// Number of the build's pull request
	PullRequestNumber uint `json:"pull_request_number,omitempty"`
	// When the build started
	StartedAt string `json:"started_at,omitempty"`
	// When the build finished
	FinishedAt string `json:"finished_at,omitempty"`
	// Whether or not the build is private
	Private bool `json:"private,omitempty"`
}

MinimalBuild is a minimal representation of a Travis CI build

Travis CI API docs: https://developer.travis-ci.com/resource/build#minimal-representation

type MinimalCommit

type MinimalCommit struct {
	// Value uniquely identifying the commit
	Id uint `json:"id,omitempty"`
	// Checksum the commit has in git and is identified by
	Sha string `json:"sha,omitempty"`
	// Named reference the commit has in git.
	Ref string `json:"ref,omitempty"`
	// Commit mesage
	Message string `json:"message,omitempty"`
	// URL to the commit's diff on GitHub
	CompareUrl string `json:"compare_url,omitempty"`
	// Commit date from git
	CommittedAt string `json:"committed_at,omitempty"`
}

MinimalCommit is a minimal representation of a GitHub commit as seen by Travis CI

Travis CI API docs: https://developer.travis-ci.com/resource/commit#minimal-representation

type MinimalJob

type MinimalJob struct {
	// Value uniquely identifying the job
	Id uint `json:"id,omitempty"`
}

MinimalJob is a minimal representation of a Travis CI job

Travis CI API docs: https://developer.travis-ci.com/resource/job#standard-representation

type MinimalOwner

type MinimalOwner struct {
	// // Value uniquely identifying the owner
	Id uint `json:"id"`
	// User or organization login set on GitHub
	Login string `json:"login"`
}

MinimalOwner represents a minimal GitHub Owner

Travis CI API docs: https://developer.travis-ci.com/resource/owner#minimal-representation

type MinimalRepository

type MinimalRepository struct {
	// Value uniquely identifying the repository
	Id uint `json:"id"`
	// The repository's name on GitHub
	Name string `json:"name"`
	// Same as {repository.owner.name}/{repository.name}
	Slug string `json:"slug"`
}

MinimalRepository is a minimal representation of a Travis CI repository

Travis CI API docs: https://developer.travis-ci.com/resource/repository#minimal-representation

type MinimalRequest

type MinimalRequest struct {
	// Value uniquely identifying the request
	Id uint `json:"id,omitempty"`
	// The state of a request (eg. whether it has been processed or not)
	State string `json:"state,omitempty"`
	// The result of the request (eg. rejected or approved)
	Result string `json:"result,omitempty"`
	// Travis-ci status message attached to the request.
	Message string `json:"message,omitempty"`
}

MinimalRequest is a minimal representation a Travis CI request.

Travis CI API docs: https://developer.travis-ci.com/resource/request#minimal-representation

type MinimalStage

type MinimalStage struct {
	// Value uniquely identifying the stage
	Id uint `json:"id,omitempty"`
	// Incremental number for a stage
	Number uint `json:"number,omitempty"`
	// The name of the stage
	Name string `json:"name,omitempty"`
	// Current state of the stage
	State string `json:"state,omitempty"`
	// When the stage started
	StartedAt string `json:"started_at,omitempty"`
	// When the stage finished
	FinishedAt string `json:"finished_at,omitempty"`
}

MinimalStage is a minimal representation of an individual stage

Travis CI API docs: https://developer.travis-ci.com/resource/stage#minimal-representation

type MinimalTag added in v0.1.8

type MinimalTag struct {
	// Value uniquely identifying a repository of the build belongs to
	RepositoryId uint `json:"repository_id"`
	// Name of the tag
	Name string `json:"name,omitempty"`
	// Id of a last build on the branch
	LastBuildId uint `json:"last_build_id"`
	Metadata
}

MinimalTag is a minimal representation of a Travis CI tag

type Organization added in v0.1.0

type Organization struct {
	// Value uniquely identifying the organization
	Id uint `json:"id,omitempty"`
	// Login set on GitHub
	Login string `json:"login,omitempty"`
	// Name set on GitHub
	Name string `json:"name,omitempty"`
	// Id set on GitHub
	GithubId uint `json:"github_id,omitempty"`
	// Avatar_url set on GitHub
	AvatarUrl string `json:"avatar_url,omitempty"`
	// Whether or not the organization has an education account
	Education bool `json:"education,omitempty"`
	Metadata
}

Organization is a standard representation of an individual organization

Travis CI API docs: https://developer.travis-ci.com/resource/organization#standard-representation

type OrganizationsOption added in v0.1.0

type OrganizationsOption struct {
	// How many organizations to include in the response
	Limit int `url:"limit,omitempty"`
	// How many organizations to skip before the first entry in the response
	Offset int `url:"offset,omitempty"`
	// Attributes to sort organizations by
	SortBy string `url:"sort_by,omitempty"`
}

OrganizationsOption specifies the optional parameters for organizations endpoint

type OrganizationsService added in v0.1.0

type OrganizationsService struct {
	// contains filtered or unexported fields
}

OrganizationsService handles communication with the organization related methods of the Travis CI API.

func (*OrganizationsService) Find added in v0.1.0

Find fetches an organization with the given id

Travis CI API docs: https://developer.travis-ci.com/resource/organization#find

func (*OrganizationsService) List added in v0.1.0

List fetches a list of organizations the current user is a member of

Travis CI API docs: https://developer.travis-ci.com/resource/organizations#for_current_user

type Owner

type Owner struct {
	// Value uniquely identifying the owner
	Id uint `json:"id"`
	// User or organization login set on GitHub
	Login string `json:"login"`
	// User or organization name set on GitHub
	Name string `json:"name"`
	// User or organization id set on GitHub
	GitHubId uint `json:"github_id"`
	// Link to user or organization avatar (image) set on GitHub
	AvatarUrl string `json:"avatar_url"`
	// Whether or not the owner has an education account
	Education bool `json:"education"`
	Metadata
}

Owner represents a GitHub Repository

Travis CI API docs: https://developer.travis-ci.com/resource/owner#standard-representation

type OwnerService

type OwnerService struct {
	// contains filtered or unexported fields
}

OwnerService handles communication with the GitHub owner related methods of the Travis CI API.

func (*OwnerService) FindByGitHubId

func (os *OwnerService) FindByGitHubId(ctx context.Context, githubId uint) (*Owner, *http.Response, error)

Find fetches a owner based on the provided GitHub id

Travis CI API docs: https://developer.travis-ci.com/resource/owner#find

func (*OwnerService) FindByLogin

func (os *OwnerService) FindByLogin(ctx context.Context, login string) (*Owner, *http.Response, error)

Find fetches a owner based on the provided login Login is user or organization login set on GitHub

Travis CI API docs: https://developer.travis-ci.com/resource/owner#find

type Permissions added in v0.0.9

type Permissions map[string]bool

Permissions represents permissions of Travis CI API

type Preference added in v0.0.6

type Preference struct {
	// The preference's name
	Name string `json:"name,omitempty"`
	// The preference's value
	Value bool `json:"value"`
	Metadata
}

Preference is a standard representation of an individual preference

Travis CI API docs: https://developer.travis-ci.com/resource/preference#standard-representation

type PreferencesService added in v0.0.6

type PreferencesService struct {
	// contains filtered or unexported fields
}

PreferencesService handles communication with the preferences related methods of the Travis CI API.

func (*PreferencesService) Find added in v0.0.6

Find fetches the current user's preference based on the provided preference name

Travis CI API docs: https://developer.travis-ci.com/resource/preference#find

func (*PreferencesService) List added in v0.0.7

List fetches the current user's preferences

Travis CI API docs: https://developer.travis-ci.com/resource/preferences#for_user

func (*PreferencesService) Update added in v0.0.7

func (ps *PreferencesService) Update(ctx context.Context, preference *Preference) (*Preference, *http.Response, error)

Update updates the current user's preference based on the provided preference property

Travis CI API docs: https://developer.travis-ci.com/resource/preference#update

type RepositoriesService added in v0.0.7

type RepositoriesService struct {
	// contains filtered or unexported fields
}

RepositoriesService handles communication with the builds related methods of the Travis CI API.

func (*RepositoriesService) Activate added in v0.0.7

func (rs *RepositoriesService) Activate(ctx context.Context, slug string) (*Repository, *http.Response, error)

Activate activates Travis CI on the specified repository

Travis CI API docs: https://developer.travis-ci.com/resource/repository#activate

func (*RepositoriesService) Deactivate added in v0.0.7

func (rs *RepositoriesService) Deactivate(ctx context.Context, slug string) (*Repository, *http.Response, error)

Deactivate deactivates Travis CI on the specified repository

Travis CI API docs: https://developer.travis-ci.com/resource/repository#deactivate

func (*RepositoriesService) Find added in v0.0.7

Find fetches a repository based on the provided slug

Travis CI API docs: https://developer.travis-ci.com/resource/repository#find

func (*RepositoriesService) Star added in v0.0.7

Star stars a repository based on the currently logged in user

Travis CI API docs: https://developer.travis-ci.com/resource/repository#star

func (*RepositoriesService) Unstar added in v0.0.7

func (rs *RepositoriesService) Unstar(ctx context.Context, slug string) (*Repository, *http.Response, error)

Unstar unstars a repository based on the currently logged in user

Travis CI API docs: https://developer.travis-ci.com/resource/repository#unstar

type Repository

type Repository struct {
	// Value uniquely identifying the repository
	Id uint `json:"id"`
	// The repository's name on GitHub
	Name string `json:"name"`
	// Same as {repository.owner.name}/{repository.name}
	Slug string `json:"slug"`
	// The repository's description from GitHub
	Description string `json:"description"`
	// The repository's id on GitHub
	GitHubId uint `json:"github_id"`
	// The main programming language used according to GitHub
	GitHubLanguage string `json:"github_language"`
	// Whether or not this repository is currently enabled on Travis CI
	Active bool `json:"active"`
	// Whether or not this repository is private
	Private bool `json:"private"`
	// GitHub user or organization the repository belongs to
	Owner MinimalOwner `json:"owner"`
	// The default branch on GitHub
	DefaultBranch MinimalBranch `json:"default_branch"`
	// Whether or not this repository is starred
	Starred bool `json:"starred"`
	// Whether or not this repository is managed by a GitHub App installation
	ManagedByInstallation bool `json:"managed_by_installation"`
	// Whether or not this repository runs builds on travis-ci.org (may also be null)
	ActiveOnOrg bool `json:"active_on_org"`
	Metadata
}

Repository represents a Travis CI repository

Travis CI API docs: https://developer.travis-ci.com/resource/repository#standard-representation

type Request

type Request struct {
	// Value uniquely identifying the request
	Id uint `json:"id,omitempty"`
	// The state of a request (eg. whether it has been processed or not)
	State string `json:"state,omitempty"`
	// The result of the request (eg. rejected or approved)
	Result string `json:"result,omitempty"`
	// Travis-ci status message attached to the request.
	Message string `json:"message,omitempty"`
	// GitHub user or organization the request belongs to
	Repository MinimalRepository `json:"repository,omitempty"`
	// Name of the branch requested to be built
	BranchName string `json:"branch_name,omitempty"`
	// The commit the request is associated with
	Commit MinimalCommit `json:"commit,omitempty"`
	// The request's builds
	Builds []MinimalBuild `json:"builds,omitempty"`
	// GitHub user or organization the request belongs to
	Owner MinimalOwner `json:"owner,omitempty"`
	// When Travis CI created the request
	CreatedAt string `json:"created_at,omitempty"`
	// Origin of request (push, pull request, api)
	EventType string `json:"event_type,omitempty"`
	Metadata
}

Request represents a Travis CI request. They can be used to see if and why a GitHub even has or has not triggered a new build.

// Travis CI API docs: https://developer.travis-ci.com/resource/request#standard-representation

type RequestBody added in v0.0.4

type RequestBody struct {
	// Build configuration (as parsed from .travis.yml)
	Config interface{} `json:"config,omitempty"`
	// Travis-ci status message attached to the request
	Message string `json:"message,omitempty"`
	// Branch requested to be built
	Branch string `json:"branch,omitempty"`
	// Travis token associated with webhook on GitHub (DEPRECATED)
	Token string `json:"token,omitempty"`
}

RequestBody specifies body for creating request.

type RequestsService

type RequestsService struct {
	// contains filtered or unexported fields
}

RequestsService handles communication with the requests related methods of the Travis CI API.

func (*RequestsService) CreateByRepoId

func (rs *RequestsService) CreateByRepoId(ctx context.Context, repoId uint, request *RequestBody) (*MinimalRequest, *http.Response, error)

CreateByRepoId create requests of given repository id and provided options

Travis CI API docs: https://developer.travis-ci.com/resource/requests#create

func (*RequestsService) CreateByRepoSlug

func (rs *RequestsService) CreateByRepoSlug(ctx context.Context, repoSlug string, request *RequestBody) (*MinimalRequest, *http.Response, error)

CreateByRepoSlug create requests of given repository slug and provided options

Travis CI API docs: https://developer.travis-ci.com/resource/requests#create

func (*RequestsService) FindByRepoId

func (rs *RequestsService) FindByRepoId(ctx context.Context, repoId uint, id uint) (*Request, *http.Response, error)

FindByRepoId fetches request of given repository id and request id

Travis CI API docs: https://developer.travis-ci.com/resource/request#find

func (*RequestsService) FindByRepoSlug

func (rs *RequestsService) FindByRepoSlug(ctx context.Context, repoSlug string, id uint) (*Request, *http.Response, error)

FindByRepoSlug fetches request of given repository slug and request id

Travis CI API docs: https://developer.travis-ci.com/resource/request#find

func (*RequestsService) ListByRepoId added in v0.0.7

func (rs *RequestsService) ListByRepoId(ctx context.Context, repoId uint, opt *ListRequestsOption) ([]Request, *http.Response, error)

ListByRepoId fetches requests of given repository id

Travis CI API docs: https://developer.travis-ci.com/resource/requests#find

func (*RequestsService) ListByRepoSlug added in v0.0.7

func (rs *RequestsService) ListByRepoSlug(ctx context.Context, repoSlug string, opt *ListRequestsOption) ([]Request, *http.Response, error)

ListByRepoSlug fetches requests of given repository slug

Travis CI API docs: https://developer.travis-ci.com/resource/requests#find

type Setting added in v0.0.8

type Setting struct {
	// The setting's name
	Name string `json:"name,omitempty"`
	// The setting's value
	// Currently value can be boolean or integer
	Value interface{} `json:"value,omitempty"`
	Metadata
}

Setting represents a Travis CI setting.

Travis CI API docs: https://developer.travis-ci.com/resource/setting#standard-representation

type SettingsService added in v0.0.8

type SettingsService struct {
	// contains filtered or unexported fields
}

SettingsService handles communication with the setting related methods of the Travis CI API.

func (*SettingsService) FindByRepoId added in v0.0.8

func (ss *SettingsService) FindByRepoId(ctx context.Context, repoId uint, name string) (*Setting, *http.Response, error)

FindByRepoId fetches a setting of given repository id and setting name

Travis CI API docs: https://developer.travis-ci.com/resource/setting#find

func (*SettingsService) FindByRepoSlug added in v0.0.8

func (ss *SettingsService) FindByRepoSlug(ctx context.Context, repoSlug string, name string) (*Setting, *http.Response, error)

FindByRepoSlug fetches a setting of given repository slug and setting name

Travis CI API docs: https://developer.travis-ci.com/resource/setting#find

func (*SettingsService) ListByRepoId added in v0.0.8

func (ss *SettingsService) ListByRepoId(ctx context.Context, repoId uint) ([]Setting, *http.Response, error)

ListByRepoId fetches a list of settings of given repository id

Travis CI API docs: https://developer.travis-ci.com/resource/settings#for_repository

func (*SettingsService) ListByRepoSlug added in v0.0.8

func (ss *SettingsService) ListByRepoSlug(ctx context.Context, repoSlug string) ([]Setting, *http.Response, error)

ListByRepoSlug fetches a list of settings of given repository slug

Travis CI API docs: https://developer.travis-ci.com/resource/settings#for_repository

func (*SettingsService) UpdateByRepoId added in v0.0.8

func (ss *SettingsService) UpdateByRepoId(ctx context.Context, repoId uint, setting *Setting) (*Setting, *http.Response, error)

UpdateByRepoId updates a setting with setting property

Travis CI API docs: https://developer.travis-ci.com/resource/setting#update

func (*SettingsService) UpdateByRepoSlug added in v0.0.8

func (ss *SettingsService) UpdateByRepoSlug(ctx context.Context, repoSlug string, setting *Setting) (*Setting, *http.Response, error)

UpdateByRepoSlug updates a setting with setting property

Travis CI API docs: https://developer.travis-ci.com/resource/setting#update

type TravisYml added in v0.0.5

type TravisYml struct {
	Content string `json:"content,omitempty"`
}

type User

type User struct {
	// Value uniquely identifying the user
	Id uint `json:"id,omitempty"`
	// Login set on Github
	Login string `json:"login,omitempty"`
	// Name set on GitHub
	Name string `json:"name,omitempty"`
	// Id set on GitHub
	GithubId uint `json:"github_id,omitempty"`
	// Avatar URL set on GitHub
	AvatarUrl string `json:"avatar_url,omitempty"`
	// Whether or not the user has an education account
	Education bool `json:"education,omitempty"`
	// Whether or not the user is currently being synced with Github
	IsSyncing bool `json:"is_syncing,omitempty"`
	// The last time the user was synced with GitHub
	SyncedAt string `json:"synced_at,omitempty"`
	Metadata
}

User represents a Travis CI user.

Travis CI API docs: https://developer.travis-ci.com/resource/user#standard-representation

type UserService

type UserService struct {
	// contains filtered or unexported fields
}

UserService handles communication with the users related methods of the Travis CI API.

func (*UserService) Current

func (us *UserService) Current(ctx context.Context) (*User, *http.Response, error)

Current fetches the currently authenticated user from Travis CI API.

Travis CI API docs: https://developer.travis-ci.com/resource/user#current

func (*UserService) Find

func (us *UserService) Find(ctx context.Context, id uint) (*User, *http.Response, error)

Get fetches the user with the provided id from the Travis CI API.

Travis CI API docs: https://developer.travis-ci.com/resource/user#find

func (*UserService) Sync

func (us *UserService) Sync(ctx context.Context, id uint) (*User, *http.Response, error)

Sync triggers a new sync with GitHub. Might return status 409 if the user is currently syncing.

Travis CI API docs: https://developer.travis-ci.com/resource/user#sync

type Warning added in v0.0.5

type Warning struct {
	Key     []string `json:"key,omitempty"`
	Message string   `json:"message,omitempty"`
	Metadata
}

Warning is a standard representation of a warning of .travis.yml content validation

Travis CI API docs: https://developer.travis-ci.com/resource/lint

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL