forked from buildkite/agent
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpayloads.go
50 lines (39 loc) · 1.29 KB
/
payloads.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package jobapi
import (
"sort"
"github.com/buildkite/agent/v3/internal/socket"
)
// ErrorResponse is the response body for any errors that occur.
type ErrorResponse = socket.ErrorResponse
// EnvGetResponse is the response body for the GET /env endpoint
type EnvGetResponse struct {
Env map[string]string `json:"env"` // Different to EnvUpdateRequest because we don't want to send nulls
}
// EnvUpdateRequest is the request body for the PATCH /env endpoint
type EnvUpdateRequest struct {
Env map[string]string `json:"env"`
}
// EnvUpdateRequestPayload is the request body that the PATCH /env endpoint unmarshalls requests into
type EnvUpdateRequestPayload struct {
Env map[string]*string `json:"env"`
}
// EnvUpdateResponse is the response body for the PATCH /env endpoint
type EnvUpdateResponse struct {
Added []string `json:"added"`
Updated []string `json:"updated"`
}
func (e EnvUpdateResponse) Normalize() {
sort.Strings(e.Added)
sort.Strings(e.Updated)
}
// EnvDeleteRequest is the request body for the DELETE /env endpoint
type EnvDeleteRequest struct {
Keys []string `json:"keys"`
}
// EnvDeleteResponse is the response body for the DELETE /env endpoint
type EnvDeleteResponse struct {
Deleted []string `json:"deleted"`
}
func (e EnvDeleteResponse) Normalize() {
sort.Strings(e.Deleted)
}