@@ -84,6 +84,9 @@ module {
84
84
public type EntityIdErrors = {
85
85
#Unauthorized ;
86
86
#EntityNotFound ;
87
+ #TooManyPreviews ;
88
+ // Returns the index of the preview that is too large
89
+ #PreviewTooLarge : Int ;
87
90
#Error ;
88
91
};
89
92
@@ -125,6 +128,35 @@ module {
125
128
#Location ;
126
129
};
127
130
131
+ /**
132
+ * Stores the supported preview types
133
+ * Standard types are enumerated to create a standarized preview format.
134
+ * Unique formats can be stored via the other tag and labelled as such
135
+ */
136
+ public type EntityPreviewSupportedTypes = {
137
+ #Jpg ;
138
+ #Png ;
139
+ #Glb ;
140
+ #Gltf ;
141
+ #Other : Text ;
142
+ };
143
+
144
+ /**
145
+ * Defines the type for the various previews of an entity
146
+ */
147
+ public type EntityPreview = {
148
+ /**
149
+ * Stores the type of the preview. This is used to determine how to
150
+ * render the stored preview data
151
+ */
152
+ previewType: EntityPreviewSupportedTypes ;
153
+
154
+ /**
155
+ * The actual preview data associated with the preview
156
+ */
157
+ previewData: Blob ;
158
+ };
159
+
128
160
/**
129
161
* Type that defines the attributes for an Entity
130
162
*/
@@ -147,6 +179,11 @@ module {
147
179
* Contains all the bridge ids that point to this entity
148
180
*/
149
181
toIds : EntityAttachedBridges ;
182
+
183
+ /**
184
+ * Stores all the previews that are available for the current entity
185
+ */
186
+ previews : [EntityPreview ];
150
187
};
151
188
152
189
/**
@@ -192,6 +229,7 @@ module {
192
229
listOfEntitySpecificFieldKeys : [Text ] = ["entityType" , "fromIds" , "toIds" ];
193
230
toIds : EntityAttachedBridges = [];
194
231
fromIds : EntityAttachedBridges = [];
232
+ previews : [EntityPreview ] = [];
195
233
};
196
234
};
197
235
@@ -215,6 +253,7 @@ module {
215
253
listOfEntitySpecificFieldKeys = entity. listOfEntitySpecificFieldKeys;
216
254
fromIds = fromIds;
217
255
toIds = entity. toIds;
256
+ previews = entity. previews;
218
257
};
219
258
};
220
259
@@ -238,6 +277,7 @@ module {
238
277
listOfEntitySpecificFieldKeys = entity. listOfEntitySpecificFieldKeys;
239
278
fromIds = entity. fromIds;
240
279
toIds = toIds;
280
+ previews = entity. previews;
241
281
};
242
282
};
243
283
@@ -247,7 +287,7 @@ module {
247
287
*
248
288
* @return The new entity with the values updated with the entity update values
249
289
*/
250
- public func updateEntityFromUpdateObject(entityUpdateObject : EntityUpdateObject , originalEntity : Entity ) : Entity {
290
+ public func updateEntityFromUpdateObject(entityUpdateObject : EntityUpdateObject , originalEntity : Entity ) : Entity {
251
291
return {
252
292
id = originalEntity. id;
253
293
creationTimestamp = originalEntity. creationTimestamp;
@@ -256,12 +296,15 @@ module {
256
296
settings = Option . get< EntitySettings > (entityUpdateObject. settings, originalEntity. settings);
257
297
entityType = originalEntity. entityType;
258
298
name = Option . get< ?Text > (?entityUpdateObject. name, originalEntity. name);
299
+ // TODO: This isn't working properly. If you keep description null when updating, it will set it back to null and
300
+ // not keep it the same value. This is true for name as well. Preview seems to work as expected
259
301
description : ?Text = Option . get< ?Text > (?entityUpdateObject. description, originalEntity. description);
260
302
keywords : ?[Text ] = Option . get< ?[Text ]> (?entityUpdateObject. keywords, originalEntity. keywords);
261
303
entitySpecificFields = originalEntity. entitySpecificFields;
262
304
listOfEntitySpecificFieldKeys = originalEntity. listOfEntitySpecificFieldKeys;
263
305
fromIds = originalEntity. fromIds;
264
306
toIds = originalEntity. toIds;
307
+ previews : [EntityPreview ] = Option . get< [EntityPreview ]> (entityUpdateObject. previews, originalEntity. previews);
265
308
};
266
309
};
267
310
@@ -291,6 +334,10 @@ module {
291
334
* The Updated keywords for the entity
292
335
*/
293
336
keywords : ?[Text ];
337
+ /**
338
+ * Used to update the available previews for the entity
339
+ */
340
+ previews : ?[EntityPreview ]
294
341
};
295
342
296
343
/**
0 commit comments