@@ -71,6 +71,14 @@ type ContentTypeResult struct {
71
71
References map [string ][]EntryReference
72
72
}
73
73
74
+ type ContentTypeInfo struct {
75
+ ContentType string
76
+ Title string
77
+ Description string
78
+ }
79
+
80
+ type ContentTypeInfoMap map [string ]ContentTypeInfo
81
+
74
82
type EntryReference struct {
75
83
ContentType string
76
84
ID string
@@ -142,6 +150,23 @@ var (
142
150
)
143
151
144
152
var spaceContentTypes = []string {ContentTypeBrand , ContentTypeCategory , ContentTypeProduct }
153
+ var SpaceContentTypeInfoMap = ContentTypeInfoMap {
154
+ "brand" : ContentTypeInfo {
155
+ ContentType : "brand" ,
156
+ Title : "Brand" ,
157
+ Description : "" ,
158
+ },
159
+ "category" : ContentTypeInfo {
160
+ ContentType : "category" ,
161
+ Title : "Category" ,
162
+ Description : "" ,
163
+ },
164
+ "product" : ContentTypeInfo {
165
+ ContentType : "product" ,
166
+ Title : "Product" ,
167
+ Description : "" ,
168
+ },
169
+ }
145
170
146
171
func (cc * ContentfulClient ) BrokenReferences () (brokenReferences []BrokenReference ) {
147
172
if cc .Cache == nil {
@@ -235,11 +260,11 @@ func (cc *ContentfulClient) GetAllAssets() (map[string]*contentful.Asset, error)
235
260
return cc .getAllAssets (true )
236
261
}
237
262
238
- func (cc * ContentfulClient ) GetAssetByID (id string ) (* contentful.Asset , error ) {
263
+ func (cc * ContentfulClient ) GetAssetByID (id string , forceNoCache ... bool ) (* contentful.Asset , error ) {
239
264
if cc == nil || cc .Client == nil {
240
265
return nil , errors .New ("GetAssetByID: No client available" )
241
266
}
242
- if cc .Cache != nil && cc .Cache .assets != nil {
267
+ if cc .Cache != nil && cc .Cache .assets != nil && ( len ( forceNoCache ) == 0 || ! forceNoCache [ 0 ]) {
243
268
cc .Cache .assetsGcLock .RLock ()
244
269
asset , okAsset := cc .Cache .assets [id ]
245
270
cc .Cache .assetsGcLock .RUnlock ()
0 commit comments