Skip to content

Commit 0b8cde4

Browse files
Merge pull request #96 from apivideo/discarded-videos
Add discarded videos feature
2 parents d2dff60 + 2e0d411 commit 0b8cde4

File tree

5 files changed

+32
-12
lines changed

5 files changed

+32
-12
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b89163ac996bc8f2bcaf0a054a6a9c28de9b0cf52e16fbcb17055f42852e2a57
1+
17ac0a7b292afb851962592fd7280e7727bb901d5d4e2a3f75808aa76a1ecdf5

Sources/Models/Video.swift

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,25 @@ public struct Video: Codable, Hashable {
1414

1515
/** The unique identifier of the video object. */
1616
public var videoId: String
17-
/** When a video was created, presented in ISO-8601 format. */
17+
/** When a video was created, presented in ATOM UTC format. */
1818
public var createdAt: Date?
1919
/** The title of the video content. */
2020
public var title: String?
2121
/** A description for the video content. */
2222
public var description: String?
23-
/** The date and time the API created the video. Date and time are provided using ISO-8601 UTC format. */
23+
/** The date and time the API created the video. Date and time are provided using ATOM UTC format. */
2424
public var publishedAt: Date?
25-
/** The date and time the video was updated. Date and time are provided using ISO-8601 UTC format. */
25+
/** The date and time the video was updated. Date and time are provided using ATOM UTC format. */
2626
public var updatedAt: Date?
27+
/** The date and time the video was discarded. The API populates this field only if you have the Video Restore feature enabled and discard a video. Date and time are provided using ATOM UTC format. */
28+
public var discardedAt: Date?
29+
/** The date and time the video will be permanently deleted. The API populates this field only if you have the Video Restore feature enabled and discard a video. Discarded videos are pemanently deleted after 90 days. Date and time are provided using ATOM UTC format. */
30+
public var deletesAt: Date?
31+
/** Returns `true` for videos you discarded when you have the Video Restore feature enabled. Returns `false` for every other video. */
32+
public var discarded: Bool?
2733
/** One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. */
2834
public var tags: [String]?
29-
/** Metadata you can use to categorise and filter videos. Metadata is a list of dictionaries, where each dictionary represents a key value pair for categorising a video. [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata/) allows you to define a key that allows any value pair. */
35+
/** Metadata you can use to categorise and filter videos. Metadata is a list of dictionaries, where each dictionary represents a key value pair for categorising a video. */
3036
public var metadata: [Metadata]?
3137
public var source: VideoSource?
3238
public var assets: VideoAssets?
@@ -39,13 +45,16 @@ public struct Video: Codable, Hashable {
3945
/** This lets you know whether mp4 is supported. If enabled, an mp4 URL will be provided in the response for the video. */
4046
public var mp4Support: Bool?
4147

42-
public init(videoId: String, createdAt: Date? = nil, title: String? = nil, description: String? = nil, publishedAt: Date? = nil, updatedAt: Date? = nil, tags: [String]? = nil, metadata: [Metadata]? = nil, source: VideoSource? = nil, assets: VideoAssets? = nil, playerId: String? = nil, _public: Bool? = nil, panoramic: Bool? = nil, mp4Support: Bool? = nil) {
48+
public init(videoId: String, createdAt: Date? = nil, title: String? = nil, description: String? = nil, publishedAt: Date? = nil, updatedAt: Date? = nil, discardedAt: Date? = nil, deletesAt: Date? = nil, discarded: Bool? = nil, tags: [String]? = nil, metadata: [Metadata]? = nil, source: VideoSource? = nil, assets: VideoAssets? = nil, playerId: String? = nil, _public: Bool? = nil, panoramic: Bool? = nil, mp4Support: Bool? = nil) {
4349
self.videoId = videoId
4450
self.createdAt = createdAt
4551
self.title = title
4652
self.description = description
4753
self.publishedAt = publishedAt
4854
self.updatedAt = updatedAt
55+
self.discardedAt = discardedAt
56+
self.deletesAt = deletesAt
57+
self.discarded = discarded
4958
self.tags = tags
5059
self.metadata = metadata
5160
self.source = source
@@ -63,6 +72,9 @@ public struct Video: Codable, Hashable {
6372
case description
6473
case publishedAt
6574
case updatedAt
75+
case discardedAt
76+
case deletesAt
77+
case discarded
6678
case tags
6779
case metadata
6880
case source
@@ -83,6 +95,9 @@ public struct Video: Codable, Hashable {
8395
try container.encodeIfPresent(description, forKey: .description)
8496
try container.encodeIfPresent(publishedAt, forKey: .publishedAt)
8597
try container.encodeIfPresent(updatedAt, forKey: .updatedAt)
98+
try container.encodeIfPresent(discardedAt, forKey: .discardedAt)
99+
try container.encodeIfPresent(deletesAt, forKey: .deletesAt)
100+
try container.encodeIfPresent(discarded, forKey: .discarded)
86101
try container.encodeIfPresent(tags, forKey: .tags)
87102
try container.encodeIfPresent(metadata, forKey: .metadata)
88103
try container.encodeIfPresent(source, forKey: .source)

Tests/TestResources/payloads/videos/upload/responses/201.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"key" : "Format",
1515
"value" : "Tutorial"
1616
} ],
17-
"publishedAt" : "4665-07-14T23:36:18.598Z",
17+
"publishedAt" : "2024-07-14T23:36:07+00:00",
18+
"discarded" : false,
1819
"source" : {
1920
"uri" : "/videos/vi4blUQJFrYWbaG44NChkH27/source"
2021
},

Tests/TestResources/payloads/videos/uploadWithUploadToken/responses/201.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"key" : "Format",
1414
"value" : "Tutorial"
1515
} ],
16-
"publishedAt" : "4665-07-14T23:36:18.598Z",
16+
"publishedAt" : "2024-07-14T23:36:07+00:00",
17+
"discarded" : false,
1718
"source" : {
1819
"uri" : "/videos/vi4k0jvEUuaTdRAEjQ4Jfrgz/source"
1920
},

docs/Video.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
66
**videoId** | **String** | The unique identifier of the video object. |
7-
**createdAt** | **Date** | When a video was created, presented in ISO-8601 format. | [optional]
7+
**createdAt** | **Date** | When a video was created, presented in ATOM UTC format. | [optional]
88
**title** | **String** | The title of the video content. | [optional]
99
**description** | **String** | A description for the video content. | [optional]
10-
**publishedAt** | **Date** | The date and time the API created the video. Date and time are provided using ISO-8601 UTC format. | [optional]
11-
**updatedAt** | **Date** | The date and time the video was updated. Date and time are provided using ISO-8601 UTC format. | [optional]
10+
**publishedAt** | **Date** | The date and time the API created the video. Date and time are provided using ATOM UTC format. | [optional]
11+
**updatedAt** | **Date** | The date and time the video was updated. Date and time are provided using ATOM UTC format. | [optional]
12+
**discardedAt** | **Date** | The date and time the video was discarded. The API populates this field only if you have the Video Restore feature enabled and discard a video. Date and time are provided using ATOM UTC format. | [optional]
13+
**deletesAt** | **Date** | The date and time the video will be permanently deleted. The API populates this field only if you have the Video Restore feature enabled and discard a video. Discarded videos are pemanently deleted after 90 days. Date and time are provided using ATOM UTC format. | [optional]
14+
**discarded** | **Bool** | Returns `true` for videos you discarded when you have the Video Restore feature enabled. Returns `false` for every other video. | [optional]
1215
**tags** | **[String]** | One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. | [optional]
13-
**metadata** | [Metadata] | Metadata you can use to categorise and filter videos. Metadata is a list of dictionaries, where each dictionary represents a key value pair for categorising a video. [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata/) allows you to define a key that allows any value pair. | [optional]
16+
**metadata** | [Metadata] | Metadata you can use to categorise and filter videos. Metadata is a list of dictionaries, where each dictionary represents a key value pair for categorising a video. | [optional]
1417
**source** | [**VideoSource**](VideoSource.md) | | [optional]
1518
**assets** | [**VideoAssets**](VideoAssets.md) | | [optional]
1619
**playerId** | **String** | The id of the player that will be applied on the video. | [optional]

0 commit comments

Comments
 (0)