Skip to content

Commit

Permalink
Merge pull request #175 from buildkite/SUP-1661-Webhook-Type-Literals
Browse files Browse the repository at this point in the history
SUP-1681: Webhook event type definition for struct literal creation
  • Loading branch information
james2791 authored Feb 1, 2024
2 parents c79f80f + ca1100c commit 35f6a1b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Unreleased
* Expose retry_source and retry_type on jobs [#171](https://github.com/buildkite/go-buildkite/pull/171) ([drcapulet](https://github.com/drcapulet))
* Expose additional webhook fields on builds and jobs [#173](https://github.com/buildkite/go-buildkite/pull/173) ([mstifflin](https://github.com/mstifflin))
* SUP-1697 Add username to Author struct [#174](https://github.com/buildkite/go-buildkite/pull/174) ([lizrabuya](https://github.com/lizrabuya))
* SUP-1681: Webhook event type definition for struct literal creation [#175](https://github.com/buildkite/go-buildkite/pull/175) ([james2791](https://github.com/james2791))

## [v3.10.0](https://github.com/buildkite/go-buildkite/compare/v3.9.0...v3.10.0) (2023-11-15)
* cluster_tokens: expose token string [#168](https://github.com/buildkite/go-buildkite/pull/168) ([gmichelo](https://github.com/gmichelo))
Expand Down
32 changes: 16 additions & 16 deletions buildkite/webhook_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package buildkite
// agentEvent is a wrapper for an agent event notification
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events
type agentEvent struct {
type AgentEvent struct {
Event *string `json:"event"`
Agent *Agent `json:"agent"`
Sender *User `json:"sender"`
Expand All @@ -13,41 +13,41 @@ type agentEvent struct {
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events
type AgentConnectedEvent struct {
agentEvent
AgentEvent
}

// AgentDisconnectedEvent is triggered when an agent has disconnected.
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events
type AgentDisconnectedEvent struct {
agentEvent
AgentEvent
}

// AgentLostEvent is triggered when an agent has been marked as lost.
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events
type AgentLostEvent struct {
agentEvent
AgentEvent
}

// AgentStoppedEvent is triggered when an agent has stopped.
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events
type AgentStoppedEvent struct {
agentEvent
AgentEvent
}

// AgentStoppingEvent is triggered when an agent is stopping.
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/agent-events
type AgentStoppingEvent struct {
agentEvent
AgentEvent
}

// buildEvent is a wrapper for a build event notification
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/build-events
type buildEvent struct {
type BuildEvent struct {
Event *string `json:"event"`
Build *Build `json:"build"`
Pipeline *Pipeline `json:"pipeline"`
Expand All @@ -58,34 +58,34 @@ type buildEvent struct {
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/build-events
type BuildFailingEvent struct {
buildEvent
BuildEvent
}

// BuildFinishedEvent is triggered when a build finishes
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/build-events
type BuildFinishedEvent struct {
buildEvent
BuildEvent
}

// BuildRunningEvent is triggered when a build starts running
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/build-events
type BuildRunningEvent struct {
buildEvent
BuildEvent
}

// BuildScheduledEvent is triggered when a build is scheduled
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/build-events
type BuildScheduledEvent struct {
buildEvent
BuildEvent
}

// jobEvent is a wrapper for a job event notification
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/job-events
type jobEvent struct {
type JobEvent struct {
Event *string `json:"event"`
Build *Build `json:"build"`
Job *Job `json:"job"`
Expand All @@ -97,28 +97,28 @@ type jobEvent struct {
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/job-events
type JobActivatedEvent struct {
jobEvent
JobEvent
}

// JobFinishedEvent is triggered when a job is finished
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/job-events
type JobFinishedEvent struct {
jobEvent
JobEvent
}

// JobScheduledEvent is triggered when a job is scheduled
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/job-events
type JobScheduledEvent struct {
jobEvent
JobEvent
}

// JobStartedEvent is triggered when a job is started
//
// Buildkite API docs: https://buildkite.com/docs/apis/webhooks/job-events
type JobStartedEvent struct {
jobEvent
JobEvent
}

// PingEvent is triggered when a webhook notification setting is changed
Expand Down

0 comments on commit 35f6a1b

Please sign in to comment.