azuredevops

package
v6.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 8 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHTTPMethod = errors.New("invalid HTTP Method")
	ErrParsingPayload    = errors.New("error parsing payload")
)

parse errors

Functions

This section is empty.

Types

type Account added in v6.3.0

type Account struct {
	ID string `json:"id"`
}

type BasicEvent

type BasicEvent struct {
	ID          string `json:"id"`
	EventType   Event  `json:"eventType"`
	PublisherID string `json:"publisherId"`
	Scope       string `json:"scope"`
	CreatedDate Date   `json:"createdDate"`
}

type Build

type Build struct {
	URI                string          `json:"uri"`
	ID                 int             `json:"id"`
	BuildNumber        string          `json:"buildNumber"`
	URL                string          `json:"url"`
	StartTime          Date            `json:"startTime"`
	FinishTime         Date            `json:"finishTime"`
	Reason             string          `json:"reason"`
	Status             string          `json:"status"`
	DropLocation       string          `json:"dropLocation"`
	Drop               Drop            `json:"drop"`
	Log                Log             `json:"log"`
	SourceGetVersion   string          `json:"sourceGetVersion"`
	LastChangedBy      User            `json:"lastChangedBy"`
	RetainIndefinitely bool            `json:"retainIndefinitely"`
	HasDiagnostics     bool            `json:"hasDiagnostics"`
	Definition         BuildDefinition `json:"definition"`
	Queue              Queue           `json:"queue"`
	Requests           []Request       `json:"requests"`
}

type BuildCompleteEvent

type BuildCompleteEvent struct {
	ID                 string      `json:"id"`
	EventType          Event       `json:"eventType"`
	PublisherID        string      `json:"publisherId"`
	Scope              string      `json:"scope"`
	Message            Message     `json:"message"`
	DetailedMessage    Message     `json:"detailedMessage"`
	Resource           Build       `json:"resource"`
	ResourceVersion    string      `json:"resourceVersion"`
	ResourceContainers interface{} `json:"resourceContainers"`
	CreatedDate        Date        `json:"createdDate"`
}

type BuildDefinition

type BuildDefinition struct {
	BatchSize      int    `json:"batchSize"`
	TriggerType    string `json:"triggerType"`
	DefinitionType string `json:"definitionType"`
	ID             int    `json:"id"`
	Name           string `json:"name"`
	URL            string `json:"url"`
}

type Commit

type Commit struct {
	CommitID string `json:"commitId"`
	URL      string `json:"url"`
}

type Date

type Date time.Time

func (Date) MarshalJSON

func (b Date) MarshalJSON() ([]byte, error)

func (*Date) UnmarshalJSON

func (b *Date) UnmarshalJSON(p []byte) error

type Drop

type Drop struct {
	Location    string `json:"location"`
	Type        string `json:"type"`
	URL         string `json:"url"`
	DownloadURL string `json:"downloadUrl"`
}

type Event

type Event string

Event defines an Azure DevOps server hook event type

const (
	BuildCompleteEventType         Event = "build.complete"
	GitPullRequestCreatedEventType Event = "git.pullrequest.created"
	GitPullRequestUpdatedEventType Event = "git.pullrequest.updated"
	GitPullRequestMergedEventType  Event = "git.pullrequest.merged"
	GitPushEventType               Event = "git.push"
)

Azure DevOps Server hook types

type GitPullRequestEvent

type GitPullRequestEvent struct {
	ID                 string      `json:"id"`
	EventType          Event       `json:"eventType"`
	PublisherID        string      `json:"publisherId"`
	Scope              string      `json:"scope"`
	Message            Message     `json:"message"`
	DetailedMessage    Message     `json:"detailedMessage"`
	Resource           PullRequest `json:"resource"`
	ResourceVersion    string      `json:"resourceVersion"`
	ResourceContainers interface{} `json:"resourceContainers"`
	CreatedDate        Date        `json:"createdDate"`
}

type GitPushEvent added in v6.3.0

type GitPushEvent struct {
	CreatedDate        string             `json:"createdDate"`
	DetailedMessage    Message            `json:"detailedMessage"`
	EventType          string             `json:"eventType"`
	ID                 string             `json:"id"`
	Message            Message            `json:"message"`
	PublisherID        string             `json:"publisherId"`
	Resource           Resource           `json:"resource"`
	ResourceContainers ResourceContainers `json:"resourceContainers"`
	ResourceVersion    string             `json:"resourceVersion"`
	Scope              string             `json:"scope"`
}

type Log

type Log struct {
	Type        string `json:"type"`
	URL         string `json:"url"`
	DownloadURL string `json:"downloadUrl"`
}

type Message

type Message struct {
	Text     string `json:"text"`
	HTML     string `json:"html"`
	Markdown string `json:"markdown"`
}

type Project

type Project struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	URL   string `json:"url"`
	State string `json:"state"`
}

type PullRequest

type PullRequest struct {
	Repository            Repository `json:"repository"`
	PullRequestID         int        `json:"pullRequestId"`
	Status                string     `json:"status"`
	CreatedBy             User       `json:"createdBy"`
	CreationDate          Date       `json:"creationDate"`
	ClosedDate            Date       `json:"closedDate"`
	Title                 string     `json:"title"`
	Description           string     `json:"description"`
	SourceRefName         string     `json:"sourceRefName"`
	TargetRefName         string     `json:"targetRefName"`
	MergeStatus           string     `json:"mergeStatus"`
	MergeID               string     `json:"mergeId"`
	LastMergeSourceCommit Commit     `json:"lastMergeSourceCommit"`
	LastMergeTargetCommit Commit     `json:"lastMergeTargetCommit"`
	LastMergeCommit       Commit     `json:"lastMergeCommit"`
	Reviewers             []Reviewer `json:"reviewers"`
	Commits               []Commit   `json:"commits"`
	URL                   string     `json:"url"`
}

type PushedBy added in v6.3.0

type PushedBy struct {
	DisplayName string `json:"displayName"`
	ID          string `json:"id"`
	UniqueName  string `json:"uniqueName"`
}

type Queue

type Queue struct {
	QueueType string `json:"queueType"`
	ID        int    `json:"id"`
	Name      string `json:"name"`
	URL       string `json:"url"`
}

type RefUpdate added in v6.3.0

type RefUpdate struct {
	Name        string `json:"name"`
	NewObjectID string `json:"newObjectId"`
	OldObjectID string `json:"oldObjectId"`
}

type Repository

type Repository struct {
	ID            string  `json:"id"`
	Name          string  `json:"name"`
	URL           string  `json:"url"`
	Project       Project `json:"project"`
	DefaultBranch string  `json:"defaultBranch"`
	RemoteURL     string  `json:"remoteUrl"`
}

type Request

type Request struct {
	ID           int    `json:"id"`
	URL          string `json:"url"`
	RequestedFor User   `json:"requestedFor"`
}

type Resource added in v6.3.0

type Resource struct {
	Commits    []Commit    `json:"commits"`
	Date       string      `json:"date"`
	PushedBy   PushedBy    `json:"pushedBy"`
	PushID     int         `json:"pushId"`
	RefUpdates []RefUpdate `json:"refUpdates"`
	Repository Repository  `json:"repository"`
	URL        string      `json:"url"`
}

type ResourceContainers added in v6.3.0

type ResourceContainers struct {
	Account    Account `json:"account"`
	Collection Account `json:"collection"`
	Project    Account `json:"project"`
}

type Reviewer

type Reviewer struct {
	ReviewerURL string `json:"reviewerUrl"`
	Vote        int    `json:"vote"`
	ID          string `json:"id"`
	DisplayName string `json:"displayName"`
	UniqueName  string `json:"uniqueName"`
	URL         string `json:"url"`
	ImageURL    string `json:"imageUrl"`
	IsContainer bool   `json:"isContainer"`
}

type User

type User struct {
	ID          string `json:"id"`
	DisplayName string `json:"displayName"`
	UniqueName  string `json:"uniqueName"`
	URL         string `json:"url"`
	ImageURL    string `json:"imageUrl"`
}

type Webhook

type Webhook struct {
}

Webhook instance contains all methods needed to process events

func New

func New() (*Webhook, error)

New creates and returns a WebHook instance

func (Webhook) Parse

func (hook Webhook) Parse(r *http.Request, events ...Event) (interface{}, error)

Parse verifies and parses the events specified and returns the payload object or an error

Jump to

Keyboard shortcuts

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