-
Notifications
You must be signed in to change notification settings - Fork 0
/
service_base.go
89 lines (68 loc) · 1.85 KB
/
service_base.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
// ServiceBase service base
// swagger:model ServiceBase
type ServiceBase struct {
// j w t
JWT string `json:"JWT,omitempty"`
// id
ID int64 `json:"id,omitempty"`
// name
Name string `json:"name,omitempty"`
// Project ID
Project int64 `json:"project,omitempty"`
// type
Type string `json:"type,omitempty"`
}
// Validate validates this service base
func (m *ServiceBase) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateType(formats); err != nil {
// prop
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
var serviceBaseTypeTypePropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["websocket","outgoing-webhook","incoming-webhook"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
serviceBaseTypeTypePropEnum = append(serviceBaseTypeTypePropEnum, v)
}
}
const (
serviceBaseTypeWebsocket string = "websocket"
serviceBaseTypeOutgoingWebhook string = "outgoing-webhook"
serviceBaseTypeIncomingWebhook string = "incoming-webhook"
)
// prop value enum
func (m *ServiceBase) validateTypeEnum(path, location string, value string) error {
if err := validate.Enum(path, location, value, serviceBaseTypeTypePropEnum); err != nil {
return err
}
return nil
}
func (m *ServiceBase) validateType(formats strfmt.Registry) error {
if swag.IsZero(m.Type) { // not required
return nil
}
// value enum
if err := m.validateTypeEnum("type", "body", m.Type); err != nil {
return err
}
return nil
}