-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemas.ts
100 lines (94 loc) · 2.68 KB
/
schemas.ts
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
import * as coda from "@codahq/packs-sdk";
const MediaPhotoMetadata = coda.makeObjectSchema({
properties: {
cameraMake: { type: coda.ValueType.String },
cameraModel: { type: coda.ValueType.String },
focalLength: { type: coda.ValueType.Number },
apertureFNumber: { type: coda.ValueType.Number },
isoEquivalent: { type: coda.ValueType.Number },
exposureTime: { type: coda.ValueType.String },
},
});
const MediaVideoMetadata = coda.makeObjectSchema({
properties: {
cameraMake: { type: coda.ValueType.String },
cameraModel: { type: coda.ValueType.String },
fps: { type: coda.ValueType.Number },
status: { type: coda.ValueType.String },
},
});
const MediaMetadataSchema = coda.makeObjectSchema({
properties: {
photo: MediaPhotoMetadata,
video: MediaVideoMetadata,
}
});
export const MediaSchema = coda.makeObjectSchema({
properties: {
mediaId: { type: coda.ValueType.String },
filename: { type: coda.ValueType.String },
mediaType: { type: coda.ValueType.String },
mimeType: { type: coda.ValueType.String },
description: { type: coda.ValueType.String },
creationTime: {
type: coda.ValueType.String,
codaType: coda.ValueHintType.DateTime
},
mediaMetadata: MediaMetadataSchema,
width: { type: coda.ValueType.Number },
height: { type: coda.ValueType.Number },
image: {
type: coda.ValueType.String,
codaType: coda.ValueHintType.ImageAttachment,
},
url: {
type: coda.ValueType.String,
description: "Google Photos URL for the media.",
codaType: coda.ValueHintType.Url,
},
},
displayProperty: "filename",
idProperty: "mediaId",
featuredProperties: [
"image"
],
});
const MediaReferenceSchema = coda.makeObjectSchema({
codaType: coda.ValueHintType.Reference,
properties: {
filename: { type: coda.ValueType.String, required: true },
mediaId: { type: coda.ValueType.String, required: true },
},
displayProperty: "filename",
idProperty: "mediaId",
identity: {
name: "Media",
},
});
export const AlbumSchema = coda.makeObjectSchema({
properties: {
albumId: {
type: coda.ValueType.String,
},
title: { type: coda.ValueType.String },
url: {
type: coda.ValueType.String,
description: "Google Photos URL for the album.",
codaType: coda.ValueHintType.Url,
},
mediaItems: {
type: coda.ValueType.Array,
items: MediaReferenceSchema
},
coverPhoto: {
type: coda.ValueType.String,
codaType: coda.ValueHintType.ImageAttachment,
},
coverPhotoMediaItem: MediaReferenceSchema,
},
displayProperty: "title",
idProperty: "albumId",
featuredProperties: [
"coverPhoto"
]
});