Skip to content

Commit f715407

Browse files
committedFeb 26, 2025
Add size property to Link
1 parent c56ac45 commit f715407

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎pkg/manifest/link.go

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Link struct {
1919
Properties Properties `json:"properties,omitempty"` // Properties associated to the linked resource.
2020
Height uint `json:"height,omitempty"` // Height of the linked resource in pixels.
2121
Width uint `json:"width,omitempty"` // Width of the linked resource in pixels.
22+
Size uint `json:"size,omitempty"` // Original size of the resource in bytes.
2223
Bitrate float64 `json:"bitrate,omitempty"` // Bitrate of the linked resource in kbps.
2324
Duration float64 `json:"duration,omitempty"` // Length of the linked resource in seconds.
2425
Languages Strings `json:"language,omitempty"` // Expected language of the linked resource (BCP 47 tag).
@@ -68,6 +69,7 @@ func LinkFromJSON(rawJson map[string]interface{}) (*Link, error) {
6869
Title: parseOptString(rawJson["title"]),
6970
Height: float64ToUint(parseOptFloat64(rawJson["height"])),
7071
Width: float64ToUint(parseOptFloat64(rawJson["width"])),
72+
Size: float64ToUint(parseOptFloat64(rawJson["size"])),
7173
Bitrate: float64Positive(parseOptFloat64(rawJson["bitrate"])),
7274
Duration: float64Positive(parseOptFloat64(rawJson["duration"])),
7375
}
@@ -183,6 +185,9 @@ func (l Link) MarshalJSON() ([]byte, error) {
183185
if l.Width > 0 {
184186
res["width"] = l.Width
185187
}
188+
if l.Size > 0 {
189+
res["size"] = l.Size
190+
}
186191
if l.Bitrate > 0 {
187192
res["bitrate"] = l.Bitrate
188193
}

0 commit comments

Comments
 (0)
Please sign in to comment.