-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.go
179 lines (155 loc) · 5.5 KB
/
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
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
package gontentful
type Sys struct {
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
LinkType string `json:"linkType,omitempty"`
CreatedAt string `json:"createdAt,omitempty"`
CreatedBy *Entry `json:"createdBy,omitempty"`
UpdatedAt string `json:"updatedAt,omitempty"`
UpdatedBy *Entry `json:"updatedBy,omitempty"`
DeletedAt string `json:"deletedAt,omitempty"`
DeletedBy *Entry `json:"deletedBy,omitempty"`
Version int `json:"version,omitempty"`
Revision int `json:"revision,omitempty"`
ContentType *ContentType `json:"contentType,omitempty"`
FirstPublishedAt string `json:"firstPublishedAt,omitempty"`
PublishedCounter int `json:"publishedCounter,omitempty"`
PublishedAt string `json:"publishedAt,omitempty"`
PublishedBy *Entry `json:"publishedBy,omitempty"`
PublishedVersion int `json:"publishedVersion,omitempty"`
Space *Space `json:"space,omitempty"`
}
type Entries struct {
Sys *Sys `json:"sys"`
Total int `json:"total"`
Skip int `json:"skip"`
Limit int `json:"limit"`
Items []*Entry `json:"items"`
Includes *Include `json:"includes,omitempty"`
}
type Include struct {
Entry []*Entry `json:"entry,omitempty"`
Asset []*Entry `json:"asset,omitempty"`
}
type Fields map[string]interface{}
type Entry struct {
Sys *Sys `json:"sys"`
Locale string `json:"locale,omitempty"`
Fields Fields `json:"fields,omitempty"` // fields are dynamic
}
type Space struct {
Sys *Sys `json:"sys"`
Name string `json:"name"`
Locales []*Locale `json:"locales"`
}
type Spaces struct {
Sys *Sys `json:"sys"`
Total int `json:"total"`
Limit int `json:"limit"`
Skip int `json:"skip"`
Items []*Space `json:"items"`
}
type Locales struct {
Total int `json:"total"`
Limit int `json:"limit"`
Skip int `json:"skip"`
Items []*Locale `json:"items"`
}
type Locale struct {
Code string `json:"code"`
Default bool `json:"default"`
Name string `json:"name"`
FallbackCode string `json:"fallbackCode"`
CFLocales []string `json:"cfFallbackCode"`
}
type ContentType struct {
Sys *Sys `json:"sys"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Fields []*ContentTypeField `json:"fields,omitempty"`
DisplayField string `json:"displayField,omitempty"`
}
type ContentTypes struct {
Total int `json:"total"`
Limit int `json:"limit"`
Skip int `json:"skip"`
Items []*ContentType `json:"items"`
}
type ContentTypeField struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
LinkType string `json:"linkType,omitempty"`
Items *FieldTypeArrayItem `json:"items,omitempty"`
Required bool `json:"required,omitempty"`
Localized bool `json:"localized,omitempty"`
Disabled bool `json:"disabled,omitempty"`
Omitted bool `json:"omitted,omitempty"`
Validations []*FieldValidation `json:"validations,omitempty"`
DefaultValue map[string]interface{} `json:"defaultValue,omitempty"`
}
type FieldTypeArrayItem struct {
Type string `json:"type,omitempty"`
Validations []*FieldValidation `json:"validations,omitempty"`
LinkType string `json:"linkType,omitempty"`
}
type RegexpValidation struct {
Pattern int `json:"pattern"`
Flags int `json:"flags"`
}
type RangeValidation struct {
Min *int `json:"min,omitempty"`
Max *int `json:"max,omitempty"`
}
type FieldValidation struct {
LinkContentType []string `json:"linkContentType"`
LinkMimetypeGroup []string `json:"linkMimetypeGroup"`
Unique bool `json:"unique"`
In []string `json:"in,omitempty"`
Size *RangeValidation `json:"size,omitempty"`
Range *RangeValidation `json:"range,omitempty"`
Regexp *RegexpValidation `json:"regexp,omitempty"`
}
type CreateSpace struct {
Name string `json:"name"`
DefaultLocale string `json:"defaultLocale"`
}
type SyncResponse struct {
Sys *Sys `json:"sys"`
Items []*Entry `json:"items"`
NextPageURL string `json:"nextPageUrl"`
NextSyncURL string `json:"nextSyncUrl"`
}
type SyncResult struct {
Items []*Entry
Token string
}
type AssetFields struct {
Title map[string]string
File map[string]*AssetFile
}
type AssetFile struct {
URL string `json:"url"`
FileName string `json:"fileName"`
ContentType string `json:"contentType"`
Details struct {
Size int `json:"size"`
Image struct {
Width int `json:"width"`
Height int `json:"height"`
} `json:"image"`
} `json:"details"`
}
type PublishFields map[string]map[string]interface{}
type PublishedEntry struct {
Sys *Sys `json:"sys"`
Fields PublishFields `json:"fields"`
}
type PublishedEntries struct {
Sys *Sys `json:"sys"`
Total int `json:"total"`
Skip int `json:"skip"`
Limit int `json:"limit"`
Items []*PublishedEntry `json:"items"`
Includes *Include `json:"includes,omitempty"`
}