Documentation ¶
Overview ¶
Package coveralls provide functions to interact with Coveralls API
Index ¶
- type Client
- type Repository
- type RepositoryConfig
- type RepositoryService
- func (s *RepositoryService) Add(ctx context.Context, data *RepositoryConfig) (*RepositoryConfig, error)
- func (s *RepositoryService) Get(ctx context.Context, svc string, repo string) (*Repository, error)
- func (s *RepositoryService) Update(ctx context.Context, svc string, repo string, data *RepositoryConfig) (*RepositoryConfig, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Repositories *RepositoryService // Service to interact with repository-related endpoints // contains filtered or unexported fields }
Client is used to provide a single interface to interact with Coveralls API
type Repository ¶
type Repository struct { ID int `json:"id,omitempty"` Name string `json:"name,omitempty"` HasBadge bool `json:"has_badge,omitempty"` Token string `json:"token,omitempty"` }
Repository holds information about one specific repository
type RepositoryConfig ¶
type RepositoryConfig struct { Service string `json:"service"` // Git provider. Options include: github, bitbucket, gitlab, stash, manual Name string `json:"name"` // Name of the repo. E.g. with Github, this is username/reponame. CommentOnPullRequests bool `json:"comment_on_pull_requests"` // Whether comments should be posted on pull requests (defaults to true) SendBuildStatus bool `json:"send_build_status"` // Whether build status should be sent to the git provider (defaults to true) CommitStatusFailThreshold *float64 `json:"commit_status_fail_threshold"` // Minimum coverage that must be present on a build for the build to pass (default is null, meaning any decrease is a failure) CommitStatusFailChangeThreshold *float64 `json:"commit_status_fail_change_threshold"` // If coverage decreases, the maximum allowed amount of decrease that will be allowed for the build to pass (default is null, meaning that any decrease is a failure) }
RepositoryConfig represents config settings for a given repository
type RepositoryService ¶
type RepositoryService service
RepositoryService holds information to access repository-related endpoints
func (*RepositoryService) Add ¶
func (s *RepositoryService) Add(ctx context.Context, data *RepositoryConfig) (*RepositoryConfig, error)
Add a repository to Coveralls
func (*RepositoryService) Get ¶
func (s *RepositoryService) Get(ctx context.Context, svc string, repo string) (*Repository, error)
Get information about a repository already in Coveralls.
Ctx is a context that's propagated to underlying client. You can use it to cancel the request in progress (when the program is terminated, for example).
Svc indicates the service. Any value accepted by Coveralls API can be passed here. Soma valid inputs include 'github', 'bitbucket' or 'manual'.
Repo is the repository name. In GitHub, for example, this is 'organization/repository'; other services could have different formats.
If the request suceeded, it returns a Repository with the information available or an error if there was something wrong.
Example ¶
// Instantiate the client with your _personal access token_ client := NewClient("your-personal-access-token") // This returns information about a specific repository repository, err := client.Repositories.Get(context.Background(), "github", "user/repository") if err != nil { log.Fatalf("Error querying Coveralls API: %s\n", err) } fmt.Printf("Project has ID %d in Coveralls", repository.ID)
Output:
func (*RepositoryService) Update ¶
func (s *RepositoryService) Update(ctx context.Context, svc string, repo string, data *RepositoryConfig) (*RepositoryConfig, error)
Update repository configuration in Coveralls