bitriseapi

package
v0.0.0-...-2b6864c Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTriggerURL

func BuildTriggerURL(apiRootURL string, appSlug string) (*url.URL, error)

BuildTriggerURL ...

Types

type BuildParamsModel

type BuildParamsModel struct {
	// git commit hash
	CommitHash string `json:"commit_hash,omitempty"`
	// git commit message of head commit
	CommitMessage string `json:"commit_message,omitempty"`
	// git commit messages of all commits
	CommitMessages []string `json:"commit_messages,omitempty"`
	// source branch
	Branch string `json:"branch,omitempty"`
	// source branch repo owner
	BranchRepoOwner string `json:"branch_repo_owner,omitempty"`
	// destination branch, exposed for pull requests
	BranchDest string `json:"branch_dest,omitempty"`
	// destination branch repo owner, exposed for pull requests
	BranchDestRepoOwner string `json:"branch_dest_repo_owner,omitempty"`
	// tag
	Tag string `json:"tag,omitempty"`
	// pull request id, exposed for pull requests from the provider's serivce
	PullRequestID *int `json:"pull_request_id,omitempty"`
	// Deprecated: Use HeadRepositoryURL instead
	PullRequestRepositoryURL string `json:"pull_request_repository_url,omitempty"`
	// URL of the base repository
	BaseRepositoryURL string `json:"base_repository_url,omitempty"`
	// URL of the head repository
	HeadRepositoryURL string `json:"head_repository_url,omitempty"`
	// Pre-merged PR state, created by the git provider (if supported).
	// IMPORTANT: This should only be defined if the state is already up-to-date with the latest PR head state
	// Otherwise, use PullRequestUnverifiedMergeBranch.
	PullRequestMergeBranch string `json:"pull_request_merge_branch,omitempty"`
	// Similar to PullRequestMergeBranch, but this field contains a potentially stale state. One example is when a
	// PR branch gets a new commit and the merge ref is not updated yet.
	// A system using this field should check the freshness of the merge ref by other means before using it for checkouts.
	PullRequestUnverifiedMergeBranch string `json:"pull_request_unverified_merge_branch,omitempty"`
	// source branch mapped to the original repository if the provider supports it, exposed for pull requests
	PullRequestHeadBranch string `json:"pull_request_head_branch,omitempty"`
	// The creator of the pull request
	PullRequestAuthor string `json:"pull_request_author,omitempty"`
	// workflow id to run
	WorkflowID string `json:"workflow_id,omitempty"`
	// additional environment variables
	Environments []EnvironmentItem `json:"environments,omitempty"`
	// URL of the diff
	DiffURL string `json:"diff_url"`
	// paths of changes of all commits
	PushCommitPaths []CommitPaths `json:"commit_paths"`
	// pull request ready state
	PullRequestReadyState PullRequestReadyState `json:"pull_request_ready_state,omitempty"`
	// newly added pull request label
	PullRequestLabelsAdded []string `json:"pull_request_labels_added,omitempty"`
	// pull request labels
	PullRequestLabels []string `json:"pull_request_labels,omitempty"`
}

BuildParamsModel ...

type CommitPaths

type CommitPaths struct {
	Added    []string `json:"added"`
	Removed  []string `json:"removed"`
	Modified []string `json:"modified"`
}

CommitPaths ...

type EnvironmentItem

type EnvironmentItem struct {
	Name     string `json:"mapped_to"`
	Value    string `json:"value"`
	IsExpand bool   `json:"is_expand"`
}

EnvironmentItem ...

type PullRequestReadyState

type PullRequestReadyState string

PullRequestReadyState ...

const (
	PullRequestReadyStateDraft                     PullRequestReadyState = "draft"
	PullRequestReadyStateReadyForReview            PullRequestReadyState = "ready_for_review"
	PullRequestReadyStateConvertedToReadyForReview PullRequestReadyState = "converted_to_ready_for_review"
)

PullRequestReadyState ...

type TriggerAPIParamsModel

type TriggerAPIParamsModel struct {
	BuildParams BuildParamsModel `json:"build_params"`
	TriggeredBy string           `json:"triggered_by"`
}

TriggerAPIParamsModel ...

func (TriggerAPIParamsModel) Validate

func (triggerParams TriggerAPIParamsModel) Validate() error

Validate ...

type TriggerAPIResponseModel

type TriggerAPIResponseModel struct {
	Status            string `json:"status"`
	Message           string `json:"message"`
	Service           string `json:"service"`
	AppSlug           string `json:"slug"`
	BuildSlug         string `json:"build_slug"`
	BuildNumber       int    `json:"build_number"`
	BuildURL          string `json:"build_url"`
	TriggeredWorkflow string `json:"triggered_workflow"`
}

TriggerAPIResponseModel ...

func TriggerBuild

func TriggerBuild(url *url.URL, apiToken string, params TriggerAPIParamsModel, isOnlyLog bool) (TriggerAPIResponseModel, bool, error)

TriggerBuild ... Returns an error in case it can't send the request, or the response is not a HTTP success response.

If the response is an HTTP success response then the whole response body will be returned, and error will be nil.

Jump to

Keyboard shortcuts

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