add new
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package cihook
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
func Parse(b []byte) (*PipelineEvent, error) {
|
||||
p := &PipelineEvent{}
|
||||
if err := json.Unmarshal(b, p); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package cihook
|
||||
|
||||
import "time"
|
||||
|
||||
type PipelineEvent struct {
|
||||
ID string `json:"id"`
|
||||
EventType string `json:"eventType"`
|
||||
PublisherID string `json:"publisherId"`
|
||||
Message struct {
|
||||
Text string `json:"text"`
|
||||
HTML string `json:"html"`
|
||||
Markdown string `json:"markdown"`
|
||||
} `json:"message"`
|
||||
DetailedMessage struct {
|
||||
Text string `json:"text"`
|
||||
HTML string `json:"html"`
|
||||
Markdown string `json:"markdown"`
|
||||
} `json:"detailedMessage"`
|
||||
Resource struct {
|
||||
Run struct {
|
||||
Links struct {
|
||||
Self struct {
|
||||
Href string `json:"href"`
|
||||
} `json:"self"`
|
||||
Web struct {
|
||||
Href string `json:"href"`
|
||||
} `json:"web"`
|
||||
PipelineWeb struct {
|
||||
Href string `json:"href"`
|
||||
} `json:"pipeline.web"`
|
||||
Pipeline struct {
|
||||
Href string `json:"href"`
|
||||
} `json:"pipeline"`
|
||||
} `json:"_links"`
|
||||
Pipeline struct {
|
||||
URL string `json:"url"`
|
||||
ID int `json:"id"`
|
||||
Revision int `json:"revision"`
|
||||
Name string `json:"name"`
|
||||
Folder string `json:"folder"`
|
||||
} `json:"pipeline"`
|
||||
State string `json:"state"`
|
||||
Result string `json:"result"`
|
||||
CreatedDate time.Time `json:"createdDate"`
|
||||
FinishedDate time.Time `json:"finishedDate"`
|
||||
URL string `json:"url"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"run"`
|
||||
Pipeline struct {
|
||||
URL string `json:"url"`
|
||||
ID int `json:"id"`
|
||||
Revision int `json:"revision"`
|
||||
Name string `json:"name"`
|
||||
Folder string `json:"folder"`
|
||||
} `json:"pipeline"`
|
||||
} `json:"resource"`
|
||||
ResourceVersion string `json:"resourceVersion"`
|
||||
ResourceContainers struct {
|
||||
Collection struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"collection"`
|
||||
Account struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"account"`
|
||||
Project struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"project"`
|
||||
} `json:"resourceContainers"`
|
||||
CreatedDate time.Time `json:"createdDate"`
|
||||
}
|
||||
Reference in New Issue
Block a user