golang.org/x/build@v0.0.0-20240506185731-218518f32b70/cmd/pubsubhelper/pubsubtypes/pubsubtypes.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package pubsubtypes contains types published by pubsubhelper. 6 package pubsubtypes 7 8 import ( 9 "go4.org/types" 10 ) 11 12 // Event is the type of event that comes out of pubsubhelper. 13 type Event struct { 14 // Time is the time the event was received, or the time of the 15 // long poll timeout. This is what clients should send as the 16 // "after" URL parameter for the next event. 17 Time types.Time3339 18 19 // LongPollTimeout indicates that no event occurred and the 20 // client should retry with ?after=<Time>. 21 LongPollTimeout bool `json:",omitempty"` 22 23 // Gerrit is non-nil for Gerrit events. 24 Gerrit *GerritEvent `json:",omitempty"` 25 26 // Github is non-nil for GitHub events. 27 GitHub *GitHubEvent `json:",omitempty"` 28 } 29 30 // GerritEvent is a type of Event. 31 type GerritEvent struct { 32 // URL is of the form "https://go-review.googlesource.com/39551". 33 URL string 34 35 // Project is the Gerrit project on the server, such as "go", 36 // "net", "crypto". 37 Project string 38 39 // CommitHash is in the Gerrit email headers, so it's included here. 40 // I don't dare specify what it means. It seems to be the commit hash 41 // that's new or being commented upon. Notably, it doesn't ever appear 42 // to be the meta hash for comments. 43 CommitHash string 44 45 // ChangeNumber is the number of the change (e.g. 39551). 46 ChangeNumber int `json:",omitempty"` 47 } 48 49 type GitHubEvent struct { 50 Action string 51 RepoOwner string // "golang" 52 Repo string // "go" 53 IssueNumber int `json:",omitempty"` 54 PullRequestNumber int `json:",omitempty"` 55 }