travis

package module
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: BSD-3-Clause Imports: 11 Imported by: 1

README

go-travis

GitHub release Actions 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.List(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
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.

Unauthenticated client

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

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

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

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

Standard Representation / Minimal Representation

Travis CI API V3 provides two types of resource representations, standard and minimal. The API returns the resource you request in a standard representation and the resources related to the original resource in a minimal representation.

If you want the related resources in a standard representation, you need to eager load them by specifying include option.

For example, to eager load repository and commits when fetching a build, one can specify Include in BuildOption:

opt := BuildOption{Include: []string{"build.repository", "build.commits"}}
build, _, err := client.Builds.Find(context.Background(), 123, &opt)

Contribution

Contributions are of course always welcome!

  1. Fork shuheiktgw/go-travis (https://github.com/shuheiktgw/go-travis/fork)
  2. Run make install to install dependencies
  3. Create a feature branch
  4. Commit your changes
  5. Run test using make 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

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func Int64

func Int64(v int64) *int64

Int64 is a helper routine that allocates a new Int64 value to store v and returns a pointer to it.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

func Uint

func Uint(v uint) *uint

Uint is a helper routine that allocates a new Uint value to store v and returns a pointer to it.

Types

type ActiveOption

type ActiveOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

ActiveOption specifies the optional parameters for active endpoint

type ActiveService

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

ActiveService handles communication with the active endpoints of Travis CI API

func (*ActiveService) FindByGitHubId

func (as *ActiveService) FindByGitHubId(ctx context.Context, githubId uint, opt *ActiveOption) ([]*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

func (as *ActiveService) FindByOwner(ctx context.Context, owner string, opt *ActiveOption) ([]*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 Author

type Author Committer

Author is an author of the commit

type BetaFeature

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

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

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

func (*BetaFeaturesService) Delete

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

Delete delete a user's beta feature

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

func (*BetaFeaturesService) List

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

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 BetaMigrationRequest

type BetaMigrationRequest struct {
	// The beta_migration_request's id
	Id *uint `json:"id,omitempty"`
	// The beta_migration_request's owner_id
	OwnerId *uint `json:"owner_id,omitempty"`
	// The beta_migration_request's owner_name
	OwnerName *string `json:"owner_name,omitempty"`
	// Longer description of the feature
	OwnerType *string `json:"owner_type,omitempty"`
	// The beta_migration_request's accepted_at
	AcceptedAt *string `json:"accepted_at,omitempty"`
	// The beta_migration_request's organizations
	Organizations []*Organization `json:"organizations,omitempty"`
	*Metadata
}

BetaMigrationRequest is a standard representation of an individual beta migration request

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

type BetaMigrationRequestBody

type BetaMigrationRequestBody struct {
	// The beta_migration_request's organizations
	OrganizationIds []uint `json:"beta_migration_request.organizations"`
}

BetaMigrationRequestBody specifies body for creating a beta migration request.

type BetaMigrationRequestsOption

type BetaMigrationRequestsOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

BetaMigrationRequestOption specifies options for finding a beta migration requests.

type BetaMigrationRequestsService

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

BetaMigrationRequestsService handles communication with the beta migration requests related methods of the Travis CI API.

func (*BetaMigrationRequestsService) Create

Create creates a beta migration request

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

func (*BetaMigrationRequestsService) List

List fetches a list of beta migration requests created by the user

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

type Branch

type Branch struct {
	// Name of the git branch
	Name *string `json:"name,omitempty"`
	// GitHub Repository
	Repository *Repository `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 *Build `json:"last_build,omitempty"`
	// Last 10 builds on the branch (when `include=branch.recent_builds` is used)
	RecentBuilds []*Build `json:"recent_builds,omitempty"`
	*Metadata
}

Branch represents a branch of a GitHub repository

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

type BranchOption

type BranchOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

BranchOption specifies the optional parameters for branch endpoint

type BranchesOption

type BranchesOption 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"`
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

BranchesOption specifies the optional parameters for branches endpoint

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, opt *BranchOption) (*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, opt *BranchOption) (*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

func (bs *BranchesService) ListByRepoId(ctx context.Context, repoId uint, opt *BranchesOption) ([]*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

func (bs *BranchesService) ListByRepoSlug(ctx context.Context, repoSlug string, opt *BranchesOption) ([]*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

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

type BroadcastsOption struct {
	// Filters broadcasts by whether or not the broadcast should still be displayed
	Active bool `url:"active"`
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

BroadcastsOption specifies the optional parameters for broadcasts endpoint

type BroadcastsService

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

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

func (*BroadcastsService) List

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 *int64 `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 *Repository `json:"repository,omitempty"`
	// The branch the build is associated with
	Branch *Branch `json:"branch,omitempty"`
	// The build's tag
	Tag *Tag `json:"tag,omitempty"`
	// The commit the build is associated with
	Commit *Commit `json:"commit,omitempty"`
	// List of jobs that are part of the build's matrix
	Jobs []*Job `json:"jobs,omitempty"`
	// The stages of the build
	Stages []*Stage `json:"stages,omitempty"`
	// The User or Organization that created the build
	CreatedBy *Owner `json:"created_by,omitempty"`
	*Metadata
}

Build represents a Travis CI build

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

type BuildOption

type BuildOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

BuildOption specifies the optional parameters for build endpoint

type BuildsByRepoOption

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"`
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

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"`
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

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

func (bs *BuildsService) Cancel(ctx context.Context, id uint) (*Build, *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, opt *BuildOption) (*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

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

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

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

func (bs *BuildsService) Restart(ctx context.Context, id uint) (*Build, *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

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

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

CachesService handles communication with the caches endpoints of Travis CI API

func (*CachesService) DeleteByRepoId

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

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

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

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
	BetaFeatures          *BetaFeaturesService
	BetaMigrationRequests *BetaMigrationRequestsService
	Branches              *BranchesService
	Broadcasts            *BroadcastsService
	Builds                *BuildsService
	Caches                *CachesService
	Crons                 *CronsService
	EmailSubscriptions    *EmailSubscriptionsService
	EnvVars               *EnvVarsService
	GeneratedKeyPair      *GeneratedKeyPairService
	Installations         *InstallationsService
	KeyPair               *KeyPairService
	Jobs                  *JobsService
	Lint                  *LintService
	Logs                  *LogsService
	Messages              *MessagesService
	Organizations         *OrganizationsService
	Owner                 *OwnerService
	Preferences           *PreferencesService
	Repositories          *RepositoriesService
	Requests              *RequestsService
	Settings              *SettingsService
	Stages                *StagesService
	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.

func (*Client) SetToken

func (c *Client) SetToken(token string)

SetToken formats and writes provided Travis API token in the client's headers.

type Commit

type Commit 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 message
	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"`
	// Committer of the commit
	Committer *Committer `json:"committer,omitempty"`
	// Author of the commit
	Author *Author `json:"author,omitempty"`
	*Metadata
}

Commit is a standard representation of a GitHub commit as seen by Travis CI

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

type Committer

type Committer struct {
	Name      string `json:"name,omitempty"`
	AvatarURL string `json:"avatar_url,omitempty"`
}

Committer is a committer of the commit

type Config

type Config struct {
	Os            *string            `json:"os,omitempty"`
	Env           *string            `json:"env,omitempty"`
	Rvm           *string            `json:"rvm,omitempty"`
	Dist          *string            `json:"dist,omitempty"`
	Sudo          *bool              `json:"sudo,omitempty"`
	Cache         *map[string]bool   `json:"cache,omitempty"`
	Group         *string            `json:"group,omitempty"`
	Addons        *map[string]string `json:"addons,omitempty"`
	Script        *[]string          `json:"script,omitempty"`
	Result        *string            `json:".result,omitempty"`
	Language      *string            `json:"language,omitempty"`
	Services      *[]string          `json:"services,omitempty"`
	GlobalEnv     *string            `json:"global_env,omitempty"`
	BeforeScript  *[]string          `json:"before_script,omitempty"`
	BeforeInstall *[]string          `json:"before_install,omitempty"`
}

Config represents Travis CI job's configuration

type Cron

type Cron struct {
	// Value uniquely identifying the cron
	Id *uint `json:"id,omitempty"`
	// Github repository to which this cron belongs
	Repository *Repository `json:"repository,omitempty"`
	// Git branch of repository to which this cron belongs
	Branch *Branch `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

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 CronOption

type CronOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

CronOption specifies options for fetching cron.

type CronsOption

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"`
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

CronsOption specifies options for fetching crons.

type CronsService

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

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

func (*CronsService) CreateByRepoId

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

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

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

func (cs *CronsService) Find(ctx context.Context, id uint, opt *CronOption) (*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

func (cs *CronsService) FindByRepoId(ctx context.Context, repoId uint, branch string, opt *CronOption) (*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

func (cs *CronsService) FindByRepoSlug(ctx context.Context, repoSlug string, branch string, opt *CronOption) (*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

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

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

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

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

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

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

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

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"`
	// The env_var's branch.
	Branch *string `json:"branch,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

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"`
	// The env_var's branch.
	Branch string `json:"env_var.branch,omitempty"`
}

EnvVarBody specifies options for creating and updating env var.

type EnvVarsService

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

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

func (*EnvVarsService) CreateByRepoId

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

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

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

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

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

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

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

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

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

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 GeneratedKeyPairService

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

GeneratedKeyPairService handles communication with the key pair (generated) endpoints of Travis CI API

func (*GeneratedKeyPairService) CreateByRepoId

func (ks *GeneratedKeyPairService) CreateByRepoId(ctx context.Context, repoId uint) (*KeyPair, *http.Response, error)

CreateByRepoId creates the new default key pair based on the given repository id

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

func (*GeneratedKeyPairService) CreateByRepoSlug

func (ks *GeneratedKeyPairService) CreateByRepoSlug(ctx context.Context, repoSlug string) (*KeyPair, *http.Response, error)

CreateByRepoSlug creates the new default key pair based on the given repository slug

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

func (*GeneratedKeyPairService) FindByRepoId

func (ks *GeneratedKeyPairService) FindByRepoId(ctx context.Context, repoId uint) (*KeyPair, *http.Response, error)

FindByRepoId fetches the default key pair based on the given repository id

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

func (*GeneratedKeyPairService) FindByRepoSlug

func (ks *GeneratedKeyPairService) FindByRepoSlug(ctx context.Context, repoSlug string) (*KeyPair, *http.Response, error)

FindByRepoSlug fetches the default key pair based on the given repository slug

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

type Installation

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 *Owner `json:"owner,omitempty"`
	*Metadata
}

Installation represents a GitHub App installation

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

type InstallationOption

type InstallationOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

InstallationOption is query parameters to one can specify to find installation

type InstallationsService

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

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

func (*InstallationsService) Find

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 *Build `json:"build,omitempty"`
	// Worker queue this job is/was scheduled on
	Queue *string `json:"queue,omitempty"`
	// GitHub repository the job is associated with
	Repository *Repository `json:"repository,omitempty"`
	// The commit the job is associated with
	Commit *Commit `json:"commit,omitempty"`
	// GitHub user or organization the job belongs to
	Owner *Owner `json:"owner,omitempty"`
	// The stages of the job
	Stage *Stage `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"`
	// The job's config
	Config *Config `json:"config,omitempty"`
	*Metadata
}

Job represents a Travis CI job

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

type JobOption

type JobOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

JobOption is query parameters to one can specify to find job

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"`
	// List of attributes to eager load
	Include []string `url:"include,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

func (js *JobsService) Cancel(ctx context.Context, id uint) (*Job, *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

func (js *JobsService) Debug(ctx context.Context, id uint) (*Job, *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, opt *JobOption) (*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

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

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

func (js *JobsService) Restart(ctx context.Context, id uint) (*Job, *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 KeyPair

type KeyPair struct {
	// A text description.
	Description *string `json:"description,omitempty"`
	// The public key.
	PublicKey *string `json:"public_key,omitempty"`
	// The fingerprint.
	Fingerprint *string `json:"fingerprint,omitempty"`
	*Metadata
}

KeyPair is a standard representation of a public/private RSA key pair on Travis CI

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

type KeyPairBody

type KeyPairBody struct {
	// A text description.
	Description string `json:"key_pair.description,omitempty"`
	// The private key.
	Value string `json:"key_pair.value,omitempty"`
}

KeyPairBody specifies options for creating and updating key pair.

type KeyPairService

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

KeyPairService handles communication with the key pair endpoints of Travis CI API

func (*KeyPairService) CreateByRepoId

func (ks *KeyPairService) CreateByRepoId(ctx context.Context, repoId uint, keyPair *KeyPairBody) (*KeyPair, *http.Response, error)

CreateByRepoId creates the key pair based on the given repository id

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

func (*KeyPairService) CreateByRepoSlug

func (ks *KeyPairService) CreateByRepoSlug(ctx context.Context, repoSlug string, keyPair *KeyPairBody) (*KeyPair, *http.Response, error)

CreateByRepoSlug creates a new key pair based on the given repository slug

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

func (*KeyPairService) DeleteByRepoId

func (ks *KeyPairService) DeleteByRepoId(ctx context.Context, repoId uint) (*http.Response, error)

DeleteByRepoId deletes the key pair based on the given repository id and

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

func (*KeyPairService) DeleteByRepoSlug

func (ks *KeyPairService) DeleteByRepoSlug(ctx context.Context, repoSlug string) (*http.Response, error)

DeleteByRepoSlug deletes the key pair based on the given repository slug

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

func (*KeyPairService) FindByRepoId

func (ks *KeyPairService) FindByRepoId(ctx context.Context, repoId uint) (*KeyPair, *http.Response, error)

FindByRepoId fetches the key pair based on the given repository id

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

func (*KeyPairService) FindByRepoSlug

func (ks *KeyPairService) FindByRepoSlug(ctx context.Context, repoSlug string) (*KeyPair, *http.Response, error)

FindByRepoSlug fetches the key pair based on the given repository slug

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

func (*KeyPairService) UpdateByRepoId

func (ks *KeyPairService) UpdateByRepoId(ctx context.Context, repoId uint, keyPair *KeyPairBody) (*KeyPair, *http.Response, error)

UpdateByRepoId updates the key pair variable based on the given option

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

func (*KeyPairService) UpdateByRepoSlug

func (ks *KeyPairService) UpdateByRepoSlug(ctx context.Context, repoSlug string, keyPair *KeyPairBody) (*KeyPair, *http.Response, error)

UpdateByRepoSlug updates the key pair variable based on the given option

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

type LintService

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

LintService handles communication with the lint endpoint of Travis CI API

func (*LintService) Lint

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

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

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

func (*LogsService) DeleteByJobId

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

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

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

func (*LogsService) FindByJobId

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

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

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

type Message

type Message struct {
	// The message's id
	Id *uint `json:"id"`
	// The message's level
	Level *string `json:"level"`
	// The message's key
	Key *string `json:"key"`
	// The message's code
	Code *string `json:"code"`
	// The message's args
	Args json.RawMessage `json:"args"`
	*Metadata
}

Message represents an individual Message.

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

type MessagesOption

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

MessagesOption specifies the optional parameters for messages endpoint

type MessagesService

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

MessagesService handles communication with the Message related methods of the Travis CI API.

func (*MessagesService) ListByRepoId

func (ms *MessagesService) ListByRepoId(ctx context.Context, repoId uint, requestId uint, opt *MessagesOption) ([]*Message, *http.Response, error)

ListByRepoId returns a list of messages created by travis-yml for a request, if any exist.

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

func (*MessagesService) ListByRepoSlug

func (ms *MessagesService) ListByRepoSlug(ctx context.Context, repoSlug string, requestId uint, opt *MessagesOption) ([]*Message, *http.Response, error)

ListByRepoSlug returns a list of messages created by travis-yml for a request, if any exist.

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

type Metadata

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

func (*Metadata) IsMinimal

func (m *Metadata) IsMinimal() bool

IsStandard tells if the struct is in a minimal representation

func (*Metadata) IsStandard

func (m *Metadata) IsStandard() bool

IsStandard tells if the struct is in a standard representation

type Organization

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"`
	// Repositories belonging to this organization.
	Repositories []*Repository `json:"repositories,omitempty"`
	// Installation belonging to the organization
	Installation *Installation `json:"installation,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 OrganizationOption

type OrganizationOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

OrganizationOption specifies the optional parameters for organization endpoint

type OrganizationsOption

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"`
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

OrganizationsOption specifies the optional parameters for organizations endpoint

type OrganizationsService

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

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

func (*OrganizationsService) Find

Find fetches an organization with the given id

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

func (*OrganizationsService) List

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"`
	// Repositories belonging to this account
	Repositories []*Repository `json:"repositories"`
	// Installation belonging to the owner
	Installation *Installation `json:"installation"`
	*Metadata
}

Owner represents a GitHub Repository

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

type OwnerOption

type OwnerOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

OwnerOption specifies the optional parameters for owner endpoint

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, opt *OwnerOption) (*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, opt *OwnerOption) (*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

type Permissions map[string]bool

Permissions represents permissions of Travis CI API

type Preference

type Preference struct {
	// The preference's name
	Name *string `json:"name,omitempty"`
	// The preference's value
	Value interface{} `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 PreferenceBody

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

PreferenceBody is body for creating preference

type PreferencesService

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

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

func (*PreferencesService) Find

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

List fetches the current user's preferences

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

func (*PreferencesService) Update

func (ps *PreferencesService) Update(ctx context.Context, preference *PreferenceBody) (*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 RepositoriesOption

type RepositoriesOption struct {
	// Filters repositories by whether or not this repository is currently enabled on Travis CI.
	Active bool `url:"active,omitempty"`
	// Filters repositories by whether or not this repository runs builds on travis-ci.org (may also be null).
	ActiveOnOrg bool `url:"active_on_org,omitempty"`
	// Filters repositories by whether or not this repository is managed by a GitHub App installation.
	ManagedByInstallation bool `url:"managed_by_installation,omitempty"`
	// Filters repositories by whether or not this repository is private.
	Private bool `url:"private,omitempty"`
	// Filters repositories by whether or not this repository is starred.
	Starred bool `url:"starred,omitempty"`
	// How many repositories to include in the response
	Limit int `url:"limit,omitempty"`
	// How many repositories to skip before the first entry in the response
	Offset int `url:"offset,omitempty"`
	// Attributes to sort repositories by
	SortBy string `url:"sort_by,omitempty"`
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

RepositoriesOption is query parameters to one can specify to find repositories

type RepositoriesService

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

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

func (*RepositoriesService) Activate

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

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

Find fetches a repository based on the provided slug

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

func (*RepositoriesService) List

List fetches repositories of current user

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

func (*RepositoriesService) ListByGitHubId

func (rs *RepositoriesService) ListByGitHubId(ctx context.Context, id uint, opt *RepositoriesOption) ([]*Repository, *http.Response, error)

ListByGitHubId fetches repositories base on the provided GitHub Id

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

func (*RepositoriesService) ListByOwner

func (rs *RepositoriesService) ListByOwner(ctx context.Context, owner string, opt *RepositoriesOption) ([]*Repository, *http.Response, error)

ListByOwner fetches repositories base on the provided owner

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

func (*RepositoriesService) Migrate

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

Migrate migrates a repository

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

func (*RepositoriesService) Star

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

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 *Owner `json:"owner"`
	// The default branch on GitHub
	DefaultBranch *Branch `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"`
	// The repository's migration_status
	MigrationStatus *string `json:"migration_status"`
	// The repository's allow_migration
	AllowMigration *bool `json:"allow_migration"`
	*Metadata
}

Repository represents a Travis CI repository

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

type RepositoryOption

type RepositoryOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

RepositoryOption is query parameters to one can specify to find repository

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 *Repository `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 *Commit `json:"commit,omitempty"`
	// The request's builds
	Builds []*Build `json:"builds,omitempty"`
	// GitHub user or organization the request belongs to
	Owner *Owner `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"`
	// The base commit the request is associated with
	BaseCommit *string `json:"base_commit,omitempty"`
	// The head commit the request is associated with
	HeadCommit *string `json:"head_commit,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

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 RequestOption

type RequestOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

RequestOption specifies options for finding a request.

type RequestsOption

type RequestsOption 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"`
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

RequestsOption specifies options for listing requests.

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) (*Request, *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) (*Request, *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, opt *RequestOption) (*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, opt *RequestOption) (*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

func (rs *RequestsService) ListByRepoId(ctx context.Context, repoId uint, opt *RequestsOption) ([]*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

func (rs *RequestsService) ListByRepoSlug(ctx context.Context, repoSlug string, opt *RequestsOption) ([]*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

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 SettingBody

type SettingBody struct {
	Name  string      `json:"name,omitempty"`
	Value interface{} `json:"value,omitempty"`
}

SettingBody is a body to update setting

type SettingsService

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

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

func (*SettingsService) FindByRepoId

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

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

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

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

func (ss *SettingsService) UpdateByRepoId(ctx context.Context, repoId uint, setting *SettingBody) (*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

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

UpdateByRepoSlug updates a setting with setting property

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

type Stage

type Stage 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"`
	// The jobs of a stage.
	Jobs []*Job `json:"jobs,omitempty"`
	*Metadata
}

Stage is a standard representation of an individual stage

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

type StagesOption

type StagesOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

StagesOption is query parameters to one can specify to list stages

type StagesService

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

StagesService handles communication with the stage related methods of the Travis CI API.

func (*StagesService) ListByBuild

func (ss *StagesService) ListByBuild(ctx context.Context, buildId uint, opt *StagesOption) ([]*Stage, *http.Response, error)

ListByBuild fetches stages of the build

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

type Tag

type Tag 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
}

Tag is a standard representation of a Travis CI tag

type TravisYml

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"`
	// Repositories belonging to this user
	Repositories []*Repository `json:"repositories,omitempty"`
	// Installation belonging to the user
	Installation []*Repository `json:"installation,omitempty"`
	// The user's emails
	Emails []*string `json:"emails,omitempty"`
	*Metadata
}

User represents a Travis CI user.

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

type UserOption

type UserOption struct {
	// List of attributes to eager load
	Include []string `url:"include,omitempty,comma"`
}

UserOption is query parameters to one can specify to find a user

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, opt *UserOption) (*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, opt *UserOption) (*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

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