-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommits.go
215 lines (189 loc) · 4.8 KB
/
commits.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
internal "github.com/FlatFilers/flatfile-go/internal"
time "time"
)
// A commit version
type Commit struct {
Id CommitId `json:"id" url:"id"`
SheetId SheetId `json:"sheetId" url:"sheetId"`
// The actor (user or system) who created the commit
CreatedBy string `json:"createdBy" url:"createdBy"`
// The actor (user or system) who completed the commit
CompletedBy *string `json:"completedBy,omitempty" url:"completedBy,omitempty"`
// The time the commit was created
CreatedAt time.Time `json:"createdAt" url:"createdAt"`
// The time the commit was acknowledged
CompletedAt *time.Time `json:"completedAt,omitempty" url:"completedAt,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (c *Commit) GetId() CommitId {
if c == nil {
return ""
}
return c.Id
}
func (c *Commit) GetSheetId() SheetId {
if c == nil {
return ""
}
return c.SheetId
}
func (c *Commit) GetCreatedBy() string {
if c == nil {
return ""
}
return c.CreatedBy
}
func (c *Commit) GetCompletedBy() *string {
if c == nil {
return nil
}
return c.CompletedBy
}
func (c *Commit) GetCreatedAt() time.Time {
if c == nil {
return time.Time{}
}
return c.CreatedAt
}
func (c *Commit) GetCompletedAt() *time.Time {
if c == nil {
return nil
}
return c.CompletedAt
}
func (c *Commit) GetExtraProperties() map[string]interface{} {
return c.extraProperties
}
func (c *Commit) UnmarshalJSON(data []byte) error {
type embed Commit
var unmarshaler = struct {
embed
CreatedAt *internal.DateTime `json:"createdAt"`
CompletedAt *internal.DateTime `json:"completedAt,omitempty"`
}{
embed: embed(*c),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*c = Commit(unmarshaler.embed)
c.CreatedAt = unmarshaler.CreatedAt.Time()
c.CompletedAt = unmarshaler.CompletedAt.TimePtr()
extraProperties, err := internal.ExtractExtraProperties(data, *c)
if err != nil {
return err
}
c.extraProperties = extraProperties
c.rawJSON = json.RawMessage(data)
return nil
}
func (c *Commit) MarshalJSON() ([]byte, error) {
type embed Commit
var marshaler = struct {
embed
CreatedAt *internal.DateTime `json:"createdAt"`
CompletedAt *internal.DateTime `json:"completedAt,omitempty"`
}{
embed: embed(*c),
CreatedAt: internal.NewDateTime(c.CreatedAt),
CompletedAt: internal.NewOptionalDateTime(c.CompletedAt),
}
return json.Marshal(marshaler)
}
func (c *Commit) String() string {
if len(c.rawJSON) > 0 {
if value, err := internal.StringifyJSON(c.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(c); err == nil {
return value
}
return fmt.Sprintf("%#v", c)
}
type CommitResponse struct {
Data *Commit `json:"data,omitempty" url:"data,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (c *CommitResponse) GetData() *Commit {
if c == nil {
return nil
}
return c.Data
}
func (c *CommitResponse) GetExtraProperties() map[string]interface{} {
return c.extraProperties
}
func (c *CommitResponse) UnmarshalJSON(data []byte) error {
type unmarshaler CommitResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*c = CommitResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *c)
if err != nil {
return err
}
c.extraProperties = extraProperties
c.rawJSON = json.RawMessage(data)
return nil
}
func (c *CommitResponse) String() string {
if len(c.rawJSON) > 0 {
if value, err := internal.StringifyJSON(c.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(c); err == nil {
return value
}
return fmt.Sprintf("%#v", c)
}
type ListCommitsResponse struct {
Data []*Commit `json:"data,omitempty" url:"data,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (l *ListCommitsResponse) GetData() []*Commit {
if l == nil {
return nil
}
return l.Data
}
func (l *ListCommitsResponse) GetExtraProperties() map[string]interface{} {
return l.extraProperties
}
func (l *ListCommitsResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ListCommitsResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*l = ListCommitsResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *l)
if err != nil {
return err
}
l.extraProperties = extraProperties
l.rawJSON = json.RawMessage(data)
return nil
}
func (l *ListCommitsResponse) String() string {
if len(l.rawJSON) > 0 {
if value, err := internal.StringifyJSON(l.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(l); err == nil {
return value
}
return fmt.Sprintf("%#v", l)
}