bitbucketserver

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package bitbucketserver provides bitbucket server integration with tofutf

Index

Constants

View Source
const SignatureHeader = "X-Hub-Signature"

SignatureHeader is the header that contains the sha256 signature of the payload content.

Variables

Functions

func BaseHandleEvent added in v0.6.0

func BaseHandleEvent(r *http.Request, secret string) (*vcs.EventPayload, error)

BaseHandleEvent is the base event handler.

func ValidateEvent added in v0.6.0

func ValidateEvent(r *http.Request, secret string, payload []byte) error

ValidateEvent validates the request.

Types

type BitbucketHookEvent added in v0.6.0

type BitbucketHookEvent struct {
	EventKey string `json:"eventKey"`
	Date     string `json:"date"`
	Actor    struct {
		Name         string `json:"name"`
		EmailAddress string `json:"emailAddress"`
		ID           int    `json:"id"`
		DisplayName  string `json:"displayName"`
		Active       bool   `json:"active"`
		Slug         string `json:"slug"`
		Type         string `json:"type"`
		Links        struct {
			Self []struct {
				Href string `json:"href"`
			} `json:"self"`
		} `json:"links"`
	} `json:"actor"`
	Repository struct {
		Slug          string `json:"slug"`
		ID            int    `json:"id"`
		Name          string `json:"name"`
		HierarchyID   string `json:"hierarchyId"`
		ScmID         string `json:"scmId"`
		State         string `json:"state"`
		StatusMessage string `json:"statusMessage"`
		Forkable      bool   `json:"forkable"`
		Project       struct {
			Key         string `json:"key"`
			ID          int    `json:"id"`
			Name        string `json:"name"`
			Description string `json:"description"`
			Public      bool   `json:"public"`
			Type        string `json:"type"`
			Links       struct {
				Self []struct {
					Href string `json:"href"`
				} `json:"self"`
			} `json:"links"`
		} `json:"project"`
		Public bool `json:"public"`
		Links  struct {
			Clone []struct {
				Href string `json:"href"`
				Name string `json:"name"`
			} `json:"clone"`
			Self []struct {
				Href string `json:"href"`
			} `json:"self"`
		} `json:"links"`
	} `json:"repository"`
	Changes []struct {
		Ref struct {
			ID        string `json:"id"`
			DisplayID string `json:"displayId"`
			Type      string `json:"type"`
		} `json:"ref"`
		RefID    string `json:"refId"`
		FromHash string `json:"fromHash"`
		ToHash   string `json:"toHash"`
		Type     string `json:"type"`
	} `json:"changes"`
}

BitbucketHookEvent is the decoded bitbucket event.

func (BitbucketHookEvent) GetActorAvatarURL added in v0.6.0

func (e BitbucketHookEvent) GetActorAvatarURL() (string, error)

GetActorAvatarURL returns the URL of the user who triggered the event.

func (BitbucketHookEvent) GetActorURL added in v0.6.0

func (e BitbucketHookEvent) GetActorURL() (string, error)

GetActorURL returns the URL of the user who performed the operation that triggered the event.

func (BitbucketHookEvent) GetActorUsername added in v0.6.0

func (e BitbucketHookEvent) GetActorUsername() (string, error)

GetActorUsername returns the username of the user who created the event.

func (BitbucketHookEvent) GetCommitSHA added in v0.6.0

func (e BitbucketHookEvent) GetCommitSHA() (string, error)

GetCommitSHA extracts the commit sha from the event.

func (BitbucketHookEvent) GetCommitURL added in v0.6.0

func (e BitbucketHookEvent) GetCommitURL() (string, error)

GetCommitURL builds the URL of the commit in bitbucket server.

func (BitbucketHookEvent) GetTag added in v0.7.0

func (e BitbucketHookEvent) GetTag() (string, error)

func (BitbucketHookEvent) IsBranchPushEvent added in v0.6.0

func (e BitbucketHookEvent) IsBranchPushEvent() (bool, error)

IsBranchPushEvent returns true if the event is a BRANCH push event.

type EventFactory added in v0.6.0

type EventFactory func(next EventHandler) EventHandler

EventFactory decorate EventHandlers with extra functionality. This is used to provide middleware to event processing.

type EventHandler added in v0.6.0

type EventHandler func(r *http.Request, secret string) (*vcs.EventPayload, error)

EventHandler is a type that describes an event handler. Its a temporary duplication of the vcshooks.EventUnmarshaller.

func ApplyMiddleware added in v0.6.0

func ApplyMiddleware(base EventHandler, factories ...EventFactory) EventHandler

ApplyMiddleware applies middleware to the base EventHandler.

func HandleEventWithLogging added in v0.6.0

func HandleEventWithLogging(next EventHandler) EventHandler

HandleEventWithLogging is a decorator for an event handler that wraps the event handler with basic event logging.

type TokenClient

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

func NewTokenClient

func NewTokenClient(opts vcs.NewTokenClientOptions) (*TokenClient, error)

func (*TokenClient) CreateWebhook

func (g *TokenClient) CreateWebhook(ctx context.Context, opts vcs.CreateWebhookOptions) (string, error)

func (*TokenClient) DeleteWebhook

func (g *TokenClient) DeleteWebhook(ctx context.Context, opts vcs.DeleteWebhookOptions) error

func (*TokenClient) GetCommit

func (g *TokenClient) GetCommit(ctx context.Context, repo, ref string) (vcs.Commit, error)

func (*TokenClient) GetCurrentUser

func (g *TokenClient) GetCurrentUser(ctx context.Context) (string, error)

func (*TokenClient) GetRepoTarball

func (g *TokenClient) GetRepoTarball(ctx context.Context, opts vcs.GetRepoTarballOptions) ([]byte, string, error)

func (*TokenClient) GetRepository

func (g *TokenClient) GetRepository(ctx context.Context, identifier string) (vcs.Repository, error)

func (*TokenClient) GetWebhook

func (g *TokenClient) GetWebhook(ctx context.Context, opts vcs.GetWebhookOptions) (vcs.Webhook, error)

func (*TokenClient) ListPullRequestFiles

func (g *TokenClient) ListPullRequestFiles(ctx context.Context, repo string, pull int) ([]string, error)

func (*TokenClient) ListRepositories

func (g *TokenClient) ListRepositories(ctx context.Context, lopts vcs.ListRepositoriesOptions) ([]string, error)

func (*TokenClient) ListTags

func (g *TokenClient) ListTags(ctx context.Context, opts vcs.ListTagsOptions) ([]string, error)

func (*TokenClient) SetStatus

func (g *TokenClient) SetStatus(ctx context.Context, opts vcs.SetStatusOptions) error

func (*TokenClient) UpdateWebhook

func (g *TokenClient) UpdateWebhook(ctx context.Context, id string, opts vcs.UpdateWebhookOptions) error

Jump to

Keyboard shortcuts

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