-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_types.go
143 lines (126 loc) · 3.47 KB
/
user_types.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
// Code generated by goagen v1.3.1, DO NOT EDIT.
//
// API "goa simple sample": Application User Types
//
// Command:
// $ goagen
// --design=github.com/pei0804/goa-simple-sample/design
// --out=$(GOPATH)/src/github.com/pei0804/goa-simple-sample
// --version=v1.3.1
package client
import (
"github.com/goadesign/goa"
)
// data user type.
type data struct {
Body *string `form:"body,omitempty" json:"body,omitempty" xml:"body,omitempty"`
Title *string `form:"title,omitempty" json:"title,omitempty" xml:"title,omitempty"`
}
// Validate validates the data type instance.
func (ut *data) Validate() (err error) {
if ut.Title == nil {
err = goa.MergeErrors(err, goa.MissingAttributeError(`request`, "title"))
}
if ut.Body == nil {
err = goa.MergeErrors(err, goa.MissingAttributeError(`request`, "body"))
}
return
}
// Publicize creates Data from data
func (ut *data) Publicize() *Data {
var pub Data
if ut.Body != nil {
pub.Body = *ut.Body
}
if ut.Title != nil {
pub.Title = *ut.Title
}
return &pub
}
// Data user type.
type Data struct {
Body string `form:"body" json:"body" xml:"body"`
Title string `form:"title" json:"title" xml:"title"`
}
// Validate validates the Data type instance.
func (ut *Data) Validate() (err error) {
if ut.Title == "" {
err = goa.MergeErrors(err, goa.MissingAttributeError(`type`, "title"))
}
if ut.Body == "" {
err = goa.MergeErrors(err, goa.MissingAttributeError(`type`, "body"))
}
return
}
// errorValue user type.
type errorValue struct {
Code *string `form:"code,omitempty" json:"code,omitempty" xml:"code,omitempty"`
Detail *string `form:"detail,omitempty" json:"detail,omitempty" xml:"detail,omitempty"`
Status *int `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
}
// Validate validates the errorValue type instance.
func (ut *errorValue) Validate() (err error) {
if ut.Status == nil {
err = goa.MergeErrors(err, goa.MissingAttributeError(`request`, "status"))
}
if ut.Code == nil {
err = goa.MergeErrors(err, goa.MissingAttributeError(`request`, "code"))
}
if ut.Detail == nil {
err = goa.MergeErrors(err, goa.MissingAttributeError(`request`, "detail"))
}
return
}
// Publicize creates ErrorValue from errorValue
func (ut *errorValue) Publicize() *ErrorValue {
var pub ErrorValue
if ut.Code != nil {
pub.Code = *ut.Code
}
if ut.Detail != nil {
pub.Detail = *ut.Detail
}
if ut.Status != nil {
pub.Status = *ut.Status
}
return &pub
}
// ErrorValue user type.
type ErrorValue struct {
Code string `form:"code" json:"code" xml:"code"`
Detail string `form:"detail" json:"detail" xml:"detail"`
Status int `form:"status" json:"status" xml:"status"`
}
// Validate validates the ErrorValue type instance.
func (ut *ErrorValue) Validate() (err error) {
if ut.Code == "" {
err = goa.MergeErrors(err, goa.MissingAttributeError(`type`, "code"))
}
if ut.Detail == "" {
err = goa.MergeErrors(err, goa.MissingAttributeError(`type`, "detail"))
}
return
}
// ok user type.
type ok struct {
Status *int `form:"status,omitempty" json:"status,omitempty" xml:"status,omitempty"`
}
// Validate validates the ok type instance.
func (ut *ok) Validate() (err error) {
if ut.Status == nil {
err = goa.MergeErrors(err, goa.MissingAttributeError(`request`, "status"))
}
return
}
// Publicize creates OK from ok
func (ut *ok) Publicize() *OK {
var pub OK
if ut.Status != nil {
pub.Status = *ut.Status
}
return &pub
}
// OK user type.
type OK struct {
Status int `form:"status" json:"status" xml:"status"`
}