Skip to content

Commit b5df65c

Browse files
committed
feat(lib): add missing video flags
1 parent 6aaebe6 commit b5df65c

File tree

2 files changed

+86
-2
lines changed

2 files changed

+86
-2
lines changed

lib/src/types/video.dart

+52-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,39 @@
1+
import 'dart:ui';
2+
13
import 'package:json_annotation/json_annotation.dart';
4+
5+
import 'metadata.dart';
26
import 'video_assets.dart';
37
import 'video_source.dart';
4-
import 'metadata.dart';
58

69
part 'video.g.dart';
710

11+
/// The origin of the last update on the video's `language` attribute.
12+
enum LanguageOrigin {
13+
/// The language was set by the API.
14+
@JsonValue("api")
15+
api,
16+
17+
/// The language was done automatically by the API.
18+
@JsonValue("auto")
19+
auto
20+
}
21+
22+
/// Json converter for [Locale] objects.
23+
class _JsonLocaleConverter extends JsonConverter<Locale, String> {
24+
const _JsonLocaleConverter();
25+
26+
@override
27+
Locale fromJson(String json) {
28+
return Locale(json);
29+
}
30+
31+
@override
32+
String toJson(Locale object) {
33+
return object.toLanguageTag();
34+
}
35+
}
36+
837
/// A video from api.video
938
@JsonSerializable()
1039
class Video {
@@ -26,6 +55,22 @@ class Video {
2655
/// The date and time the video was updated. Date and time are provided using ISO-8601 UTC format.
2756
final DateTime? updatedAt;
2857

58+
/// The date and time the video was discarded.
59+
final DateTime? discardedAt;
60+
61+
/// The date and time the video will be permanently deleted.
62+
final DateTime? deletedAt;
63+
64+
/// Returns `true` for videos you discarded.
65+
final bool? discarded;
66+
67+
/// Returns the language of a video in [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format.
68+
@_JsonLocaleConverter()
69+
final Locale? language;
70+
71+
/// Returns the origin of the last update on the video's `language` attribute.
72+
final LanguageOrigin? languageOrigin;
73+
2974
/// One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces.
3075
final List<String>? tags;
3176

@@ -52,12 +97,17 @@ class Video {
5297
final bool? mp4Support;
5398

5499
/// Creates a [Video].
55-
Video(this.videoId,
100+
const Video(this.videoId,
56101
{this.createdAt,
57102
this.title,
58103
this.description,
59104
this.publishedAt,
60105
this.updatedAt,
106+
this.discardedAt,
107+
this.deletedAt,
108+
this.discarded,
109+
this.language,
110+
this.languageOrigin,
61111
this.tags,
62112
this.metadata,
63113
this.source,

lib/src/types/video.g.dart

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)