From 4ab4098c9a77cd4d52bbb0e03e65c32f3258c131 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Tue, 15 Feb 2022 07:28:32 +0000 Subject: [PATCH] Add uploaded field. --- doc/StreamItem.md | 1 + lib/src/model/stream_item.dart | 16 ++++++++++++++++ lib/src/model/stream_item.g.dart | 19 ++++++++++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/doc/StreamItem.md b/doc/StreamItem.md index c2cb852..8f6f4b5 100644 --- a/doc/StreamItem.md +++ b/doc/StreamItem.md @@ -11,6 +11,7 @@ Name | Type | Description | Notes **duration** | **int** | The duration of the video in seconds. | **thumbnail** | **String** | The thumbnail of the video. | **title** | **String** | The title of the video. | +**uploaded** | **int** | The date in unix epoch the video was uploaded. | [optional] **uploadedDate** | **String** | The relative date the video was uploaded on. | [optional] **uploaderAvatar** | **String** | The avatar of the channel of the video. | [optional] **uploaderName** | **String** | The name of the channel of the video. | [optional] diff --git a/lib/src/model/stream_item.dart b/lib/src/model/stream_item.dart index 3e84a2b..4580d13 100644 --- a/lib/src/model/stream_item.dart +++ b/lib/src/model/stream_item.dart @@ -13,6 +13,7 @@ part 'stream_item.g.dart'; /// * [duration] - The duration of the video in seconds. /// * [thumbnail] - The thumbnail of the video. /// * [title] - The title of the video. +/// * [uploaded] - The date in unix epoch the video was uploaded. /// * [uploadedDate] - The relative date the video was uploaded on. /// * [uploaderAvatar] - The avatar of the channel of the video. /// * [uploaderName] - The name of the channel of the video. @@ -33,6 +34,10 @@ abstract class StreamItem implements Built { @BuiltValueField(wireName: r'title') String get title; + /// The date in unix epoch the video was uploaded. + @BuiltValueField(wireName: r'uploaded') + int? get uploaded; + /// The relative date the video was uploaded on. @BuiltValueField(wireName: r'uploadedDate') String? get uploadedDate; @@ -95,6 +100,12 @@ class _$StreamItemSerializer implements StructuredSerializer { ..add(r'title') ..add(serializers.serialize(object.title, specifiedType: const FullType(String))); + if (object.uploaded != null) { + result + ..add(r'uploaded') + ..add(serializers.serialize(object.uploaded, + specifiedType: const FullType(int))); + } if (object.uploadedDate != null) { result ..add(r'uploadedDate') @@ -165,6 +176,11 @@ class _$StreamItemSerializer implements StructuredSerializer { specifiedType: const FullType(String)) as String; result.title = valueDes; break; + case r'uploaded': + final valueDes = serializers.deserialize(value, + specifiedType: const FullType(int)) as int; + result.uploaded = valueDes; + break; case r'uploadedDate': final valueDes = serializers.deserialize(value, specifiedType: const FullType(String)) as String; diff --git a/lib/src/model/stream_item.g.dart b/lib/src/model/stream_item.g.dart index ff502e9..8c82c64 100644 --- a/lib/src/model/stream_item.g.dart +++ b/lib/src/model/stream_item.g.dart @@ -14,6 +14,8 @@ class _$StreamItem extends StreamItem { @override final String title; @override + final int? uploaded; + @override final String? uploadedDate; @override final String? uploaderAvatar; @@ -35,6 +37,7 @@ class _$StreamItem extends StreamItem { {required this.duration, required this.thumbnail, required this.title, + this.uploaded, this.uploadedDate, this.uploaderAvatar, this.uploaderName, @@ -63,6 +66,7 @@ class _$StreamItem extends StreamItem { duration == other.duration && thumbnail == other.thumbnail && title == other.title && + uploaded == other.uploaded && uploadedDate == other.uploadedDate && uploaderAvatar == other.uploaderAvatar && uploaderName == other.uploaderName && @@ -82,9 +86,11 @@ class _$StreamItem extends StreamItem { $jc( $jc( $jc( - $jc($jc(0, duration.hashCode), - thumbnail.hashCode), - title.hashCode), + $jc( + $jc($jc(0, duration.hashCode), + thumbnail.hashCode), + title.hashCode), + uploaded.hashCode), uploadedDate.hashCode), uploaderAvatar.hashCode), uploaderName.hashCode), @@ -100,6 +106,7 @@ class _$StreamItem extends StreamItem { ..add('duration', duration) ..add('thumbnail', thumbnail) ..add('title', title) + ..add('uploaded', uploaded) ..add('uploadedDate', uploadedDate) ..add('uploaderAvatar', uploaderAvatar) ..add('uploaderName', uploaderName) @@ -126,6 +133,10 @@ class StreamItemBuilder implements Builder { String? get title => _$this._title; set title(String? title) => _$this._title = title; + int? _uploaded; + int? get uploaded => _$this._uploaded; + set uploaded(int? uploaded) => _$this._uploaded = uploaded; + String? _uploadedDate; String? get uploadedDate => _$this._uploadedDate; set uploadedDate(String? uploadedDate) => _$this._uploadedDate = uploadedDate; @@ -166,6 +177,7 @@ class StreamItemBuilder implements Builder { _duration = $v.duration; _thumbnail = $v.thumbnail; _title = $v.title; + _uploaded = $v.uploaded; _uploadedDate = $v.uploadedDate; _uploaderAvatar = $v.uploaderAvatar; _uploaderName = $v.uploaderName; @@ -199,6 +211,7 @@ class StreamItemBuilder implements Builder { thumbnail, 'StreamItem', 'thumbnail'), title: BuiltValueNullFieldError.checkNotNull( title, 'StreamItem', 'title'), + uploaded: uploaded, uploadedDate: uploadedDate, uploaderAvatar: uploaderAvatar, uploaderName: uploaderName,