-
Notifications
You must be signed in to change notification settings - Fork 7
/
requests.go
59 lines (48 loc) · 1.8 KB
/
requests.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
51
52
53
54
55
56
57
58
59
package common
import "strings"
type PublisherPost struct {
CodeHosting []CodeHosting `json:"codeHosting" validate:"required,gt=0,dive"`
Description string `json:"description" validate:"required"`
Email *string `json:"email" validate:"omitempty,email"`
Active *bool `json:"active"`
AlternativeID *string `json:"alternativeId" validate:"omitempty,min=1,max=255"`
}
type PublisherPatch struct {
CodeHosting *[]CodeHosting `json:"codeHosting" validate:"omitempty,gt=0,dive"`
Description *string `json:"description"`
Email *string `json:"email" validate:"omitempty,email"`
Active *bool `json:"active"`
AlternativeID *string `json:"alternativeId" validate:"omitempty,max=255"`
}
type CodeHosting struct {
URL string `json:"url" validate:"required,url"`
Group *bool `json:"group"`
}
type SoftwarePost struct {
URL string `json:"url" validate:"required,url"`
Aliases []string `json:"aliases" validate:"dive,url"`
PubliccodeYml string `json:"publiccodeYml" validate:"required"`
Active *bool `json:"active"`
Vitality *string `json:"vitality"`
}
type SoftwarePatch struct {
URL *string `json:"url" validate:"omitempty,url"`
Aliases *[]string `json:"aliases" validate:"omitempty,dive,url"`
PubliccodeYml *string `json:"publiccodeYml"`
Active *bool `json:"active"`
Vitality *string `json:"vitality"`
}
type Log struct {
Message string `json:"message" validate:"required,gt=1"`
}
type Webhook struct {
URL string `json:"url" validate:"required,url"`
Secret string `json:"secret"`
}
func NormalizeEmail(email *string) *string {
if email == nil {
return nil
}
normalized := strings.TrimSpace(strings.ToLower(*email))
return &normalized
}