From 26f755fc5265a33734260814d8c223bdb3940eb6 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Fri, 9 Jun 2023 19:59:12 +0100 Subject: [PATCH] Update to latest openapi code. --- .openapi-generator/FILES | 4 - .openapi-generator/VERSION | 2 +- README.md | 6 +- analysis_options.yaml | 2 + doc/ChannelItem.md | 1 + doc/ContentItem.md | 33 ++++ doc/PlaylistItem.md | 1 + doc/SearchItem.md | 3 + doc/StreamItem.md | 3 + lib/model/channel_info.g.dart | 30 ++-- lib/model/exception_error.g.dart | 8 +- lib/model/regions.g.dart | 2 +- lib/model/stream.g.dart | 45 +++--- lib/model/stream_item.g.dart | 36 ++--- lib/model/streams_page.g.dart | 8 +- lib/model/subtitle.g.dart | 13 +- lib/model/video_info.g.dart | 63 +++----- lib/serializers.g.dart | 2 +- lib/src/api.dart | 4 +- lib/src/api/channel_api.dart | 60 +++---- lib/src/api/feed_api.dart | 15 +- lib/src/api/search_api.dart | 30 ++-- lib/src/api/unauthenticated_api.dart | 165 ++++++++++--------- lib/src/api/video_api.dart | 45 +++--- lib/src/model/channel_info.g.dart | 30 ++-- lib/src/model/channel_item.dart | 19 +++ lib/src/model/channel_item.g.dart | 36 +++-- lib/src/model/comment.g.dart | 39 ++--- lib/src/model/comments_page.g.dart | 10 +- lib/src/model/content_item.dart | 227 +++++++++++++++++++++++++++ lib/src/model/content_item.g.dart | 165 +++++++++++++++++++ lib/src/model/exception_error.g.dart | 8 +- lib/src/model/playlist_item.dart | 19 +++ lib/src/model/playlist_item.g.dart | 31 +++- lib/src/model/regions.g.dart | 2 +- lib/src/model/search_filter.g.dart | 2 +- lib/src/model/search_item.dart | 74 ++++++++- lib/src/model/search_item.g.dart | 7 +- lib/src/model/search_page.g.dart | 12 +- lib/src/model/stream.g.dart | 45 +++--- lib/src/model/stream_item.dart | 59 +++++++ lib/src/model/stream_item.g.dart | 83 +++++++--- lib/src/model/streams_page.g.dart | 8 +- lib/src/model/subtitle.g.dart | 13 +- lib/src/model/video_info.g.dart | 64 +++----- lib/src/serializers.g.dart | 2 +- pubspec.yaml | 4 +- test/content_item_test.dart | 125 +++++++++++++++ test/search_api_test.dart | 11 +- 49 files changed, 1224 insertions(+), 452 deletions(-) create mode 100644 doc/ContentItem.md create mode 100644 lib/src/model/content_item.dart create mode 100644 lib/src/model/content_item.g.dart create mode 100644 test/content_item_test.dart diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 590c584..5f03e02 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -53,7 +53,3 @@ lib/src/model/subtitle.dart lib/src/model/video_info.dart lib/src/serializers.dart pubspec.yaml -test/channel_api_test.dart -test/feed_api_test.dart -test/search_api_test.dart -test/video_api_test.dart diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 4ac4fde..cd802a1 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -6.2.0 \ No newline at end of file +6.6.0 \ No newline at end of file diff --git a/README.md b/README.md index b23a476..927ca26 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ For more information, please visit [https://github.com/TeamPiped/Piped/issues](h ## Requirements -* Dart 2.12.0 or later OR Flutter 1.26.0 or later -* Dio 4.0.0+ +* Dart 2.15.0+ or Flutter 2.8.0+ +* Dio 5.0.0+ (https://pub.dev/packages/dio) ## Installation & Usage @@ -109,7 +109,7 @@ Class | Method | HTTP request | Description ## Documentation For Authorization - All endpoints do not require authorization. +Endpoints do not require authorization. ## Author diff --git a/analysis_options.yaml b/analysis_options.yaml index a611887..139ad7a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -7,3 +7,5 @@ analyzer: implicit-casts: false exclude: - test/*.dart + errors: + deprecated_member_use_from_same_package: ignore diff --git a/doc/ChannelItem.md b/doc/ChannelItem.md index 4295ffa..14a26cf 100644 --- a/doc/ChannelItem.md +++ b/doc/ChannelItem.md @@ -8,6 +8,7 @@ import 'package:piped_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of the channel item. Always channel. | [optional] **description** | **String** | The description of the channel. | [optional] **name** | **String** | The name of the channel. | [optional] **subscribers** | **int** | The number of subscribers the channel has. | [optional] diff --git a/doc/ContentItem.md b/doc/ContentItem.md new file mode 100644 index 0000000..ce9ca27 --- /dev/null +++ b/doc/ContentItem.md @@ -0,0 +1,33 @@ +# piped_api.model.ContentItem + +## Load the model package +```dart +import 'package:piped_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of the content item. | +**duration** | **int** | The duration of the video in seconds. | +**thumbnail** | **String** | The thumbnail of the playlist. | +**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] +**uploaderUrl** | **String** | The relative URL of the channel of the video. | [optional] +**uploaderVerified** | **bool** | Whether or not the channel has a verified badge. | [optional] +**url** | **String** | The relative URL of the playlist. | +**views** | **int** | The number of views the video has. | [optional] +**isShort** | **bool** | Whether or not the video is a short video. | [optional] +**shortDescription** | **String** | The short description of the video. | [optional] +**description** | **String** | The description of the channel. | [optional] +**name** | **String** | The name of the playlist. | [optional] +**subscribers** | **int** | The number of subscribers the channel has. | [optional] +**verified** | **bool** | Whether the channel is verified. | [optional] +**videos** | **int** | The number of videos in the playlist. | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/doc/PlaylistItem.md b/doc/PlaylistItem.md index bc9f815..998dee8 100644 --- a/doc/PlaylistItem.md +++ b/doc/PlaylistItem.md @@ -8,6 +8,7 @@ import 'package:piped_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of the playlist item. Always playlist. | [optional] **name** | **String** | The name of the playlist. | [optional] **thumbnail** | **String** | The thumbnail of the playlist. | [optional] **url** | **String** | The relative URL of the playlist. | [optional] diff --git a/doc/SearchItem.md b/doc/SearchItem.md index 1c5e784..7d00bdd 100644 --- a/doc/SearchItem.md +++ b/doc/SearchItem.md @@ -8,6 +8,7 @@ import 'package:piped_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of the playlist item. Always playlist. | [optional] **duration** | **int** | The duration of the video in seconds. | **thumbnail** | **String** | The thumbnail of the playlist. | **title** | **String** | The title of the video. | @@ -19,6 +20,8 @@ Name | Type | Description | Notes **uploaderVerified** | **bool** | Whether or not the channel has a verified badge. | [optional] **url** | **String** | The relative URL of the playlist. | **views** | **int** | The number of views the video has. | [optional] +**isShort** | **bool** | Whether or not the video is a short video. | [optional] +**shortDescription** | **String** | The short description of the video. | [optional] **description** | **String** | The description of the channel. | [optional] **name** | **String** | The name of the playlist. | [optional] **subscribers** | **int** | The number of subscribers the channel has. | [optional] diff --git a/doc/StreamItem.md b/doc/StreamItem.md index 8f6f4b5..786e587 100644 --- a/doc/StreamItem.md +++ b/doc/StreamItem.md @@ -8,6 +8,7 @@ import 'package:piped_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**type** | **String** | The type of the stream item. Always stream. | [optional] **duration** | **int** | The duration of the video in seconds. | **thumbnail** | **String** | The thumbnail of the video. | **title** | **String** | The title of the video. | @@ -19,6 +20,8 @@ Name | Type | Description | Notes **uploaderVerified** | **bool** | Whether or not the channel has a verified badge. | [optional] **url** | **String** | The relative URL to the video. | **views** | **int** | The number of views the video has. | [optional] +**isShort** | **bool** | Whether or not the video is a short video. | [optional] +**shortDescription** | **String** | The short description of the video. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/lib/model/channel_info.g.dart b/lib/model/channel_info.g.dart index 5cc24a0..8502742 100644 --- a/lib/model/channel_info.g.dart +++ b/lib/model/channel_info.g.dart @@ -66,22 +66,18 @@ class _$ChannelInfo extends ChannelInfo { @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc($jc(0, avatarUrl.hashCode), - bannerUrl.hashCode), - description.hashCode), - id.hashCode), - name.hashCode), - nextpage.hashCode), - relatedStreams.hashCode), - subscriberCount.hashCode), - verified.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, avatarUrl.hashCode); + _$hash = $jc(_$hash, bannerUrl.hashCode); + _$hash = $jc(_$hash, description.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, nextpage.hashCode); + _$hash = $jc(_$hash, relatedStreams.hashCode); + _$hash = $jc(_$hash, subscriberCount.hashCode); + _$hash = $jc(_$hash, verified.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -207,4 +203,4 @@ class ChannelInfoBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/model/exception_error.g.dart b/lib/model/exception_error.g.dart index 313e67d..3c8aab5 100644 --- a/lib/model/exception_error.g.dart +++ b/lib/model/exception_error.g.dart @@ -40,7 +40,11 @@ class _$ExceptionError extends ExceptionError { @override int get hashCode { - return $jf($jc($jc(0, error.hashCode), message.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, error.hashCode); + _$hash = $jc(_$hash, message.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -104,4 +108,4 @@ class ExceptionErrorBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/model/regions.g.dart b/lib/model/regions.g.dart index 4652848..3a62b98 100644 --- a/lib/model/regions.g.dart +++ b/lib/model/regions.g.dart @@ -803,4 +803,4 @@ class _$RegionsSerializer implements PrimitiveSerializer { _fromWire[serialized] ?? (serialized is String ? serialized : '')); } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/model/stream.g.dart b/lib/model/stream.g.dart index dc91230..bf20156 100644 --- a/lib/model/stream.g.dart +++ b/lib/model/stream.g.dart @@ -159,32 +159,23 @@ class _$Stream extends Stream { @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc($jc(0, url.hashCode), - format.hashCode), - quality.hashCode), - mimeType.hashCode), - codec.hashCode), - videoOnly.hashCode), - bitrate.hashCode), - initStart.hashCode), - initEnd.hashCode), - indexStart.hashCode), - indexEnd.hashCode), - width.hashCode), - height.hashCode), - fps.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, url.hashCode); + _$hash = $jc(_$hash, format.hashCode); + _$hash = $jc(_$hash, quality.hashCode); + _$hash = $jc(_$hash, mimeType.hashCode); + _$hash = $jc(_$hash, codec.hashCode); + _$hash = $jc(_$hash, videoOnly.hashCode); + _$hash = $jc(_$hash, bitrate.hashCode); + _$hash = $jc(_$hash, initStart.hashCode); + _$hash = $jc(_$hash, initEnd.hashCode); + _$hash = $jc(_$hash, indexStart.hashCode); + _$hash = $jc(_$hash, indexEnd.hashCode); + _$hash = $jc(_$hash, width.hashCode); + _$hash = $jc(_$hash, height.hashCode); + _$hash = $jc(_$hash, fps.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -329,4 +320,4 @@ class StreamBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/model/stream_item.g.dart b/lib/model/stream_item.g.dart index 01ae601..2cff071 100644 --- a/lib/model/stream_item.g.dart +++ b/lib/model/stream_item.g.dart @@ -80,26 +80,20 @@ class _$StreamItem extends StreamItem { @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc($jc(0, duration.hashCode), - thumbnail.hashCode), - title.hashCode), - uploaded.hashCode), - uploadedDate.hashCode), - uploaderAvatar.hashCode), - uploaderName.hashCode), - uploaderUrl.hashCode), - uploaderVerified.hashCode), - url.hashCode), - views.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, duration.hashCode); + _$hash = $jc(_$hash, thumbnail.hashCode); + _$hash = $jc(_$hash, title.hashCode); + _$hash = $jc(_$hash, uploaded.hashCode); + _$hash = $jc(_$hash, uploadedDate.hashCode); + _$hash = $jc(_$hash, uploaderAvatar.hashCode); + _$hash = $jc(_$hash, uploaderName.hashCode); + _$hash = $jc(_$hash, uploaderUrl.hashCode); + _$hash = $jc(_$hash, uploaderVerified.hashCode); + _$hash = $jc(_$hash, url.hashCode); + _$hash = $jc(_$hash, views.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -229,4 +223,4 @@ class StreamItemBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/model/streams_page.g.dart b/lib/model/streams_page.g.dart index 94baa97..4a6739d 100644 --- a/lib/model/streams_page.g.dart +++ b/lib/model/streams_page.g.dart @@ -35,7 +35,11 @@ class _$StreamsPage extends StreamsPage { @override int get hashCode { - return $jf($jc($jc(0, relatedStreams.hashCode), nextpage.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, relatedStreams.hashCode); + _$hash = $jc(_$hash, nextpage.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -110,4 +114,4 @@ class StreamsPageBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/model/subtitle.g.dart b/lib/model/subtitle.g.dart index bdd9670..4204a27 100644 --- a/lib/model/subtitle.g.dart +++ b/lib/model/subtitle.g.dart @@ -42,10 +42,13 @@ class _$Subtitle extends Subtitle { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, autoGenerated.hashCode), code.hashCode), - mimeType.hashCode), - url.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, autoGenerated.hashCode); + _$hash = $jc(_$hash, code.hashCode); + _$hash = $jc(_$hash, mimeType.hashCode); + _$hash = $jc(_$hash, url.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -121,4 +124,4 @@ class SubtitleBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/model/video_info.g.dart b/lib/model/video_info.g.dart index 5d1ac8d..d521f27 100644 --- a/lib/model/video_info.g.dart +++ b/lib/model/video_info.g.dart @@ -110,44 +110,29 @@ class _$VideoInfo extends VideoInfo { @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc($jc(0, audioStreams.hashCode), - videoStreams.hashCode), - description.hashCode), - dislikes.hashCode), - duration.hashCode), - hls.hashCode), - lbryId.hashCode), - likes.hashCode), - livestream.hashCode), - proxyUrl.hashCode), - subtitles.hashCode), - dash.hashCode), - thumbnailUrl.hashCode), - title.hashCode), - uploadDate.hashCode), - uploader.hashCode), - uploaderAvatar.hashCode), - uploaderUrl.hashCode), - uploaderVerified.hashCode), - relatedStreams.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, audioStreams.hashCode); + _$hash = $jc(_$hash, videoStreams.hashCode); + _$hash = $jc(_$hash, description.hashCode); + _$hash = $jc(_$hash, dislikes.hashCode); + _$hash = $jc(_$hash, duration.hashCode); + _$hash = $jc(_$hash, hls.hashCode); + _$hash = $jc(_$hash, lbryId.hashCode); + _$hash = $jc(_$hash, likes.hashCode); + _$hash = $jc(_$hash, livestream.hashCode); + _$hash = $jc(_$hash, proxyUrl.hashCode); + _$hash = $jc(_$hash, subtitles.hashCode); + _$hash = $jc(_$hash, dash.hashCode); + _$hash = $jc(_$hash, thumbnailUrl.hashCode); + _$hash = $jc(_$hash, title.hashCode); + _$hash = $jc(_$hash, uploadDate.hashCode); + _$hash = $jc(_$hash, uploader.hashCode); + _$hash = $jc(_$hash, uploaderAvatar.hashCode); + _$hash = $jc(_$hash, uploaderUrl.hashCode); + _$hash = $jc(_$hash, uploaderVerified.hashCode); + _$hash = $jc(_$hash, relatedStreams.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -365,4 +350,4 @@ class VideoInfoBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/serializers.g.dart b/lib/serializers.g.dart index 6a51c25..37da402 100644 --- a/lib/serializers.g.dart +++ b/lib/serializers.g.dart @@ -37,4 +37,4 @@ Serializers _$serializers = (new Serializers().toBuilder() () => new ListBuilder())) .build(); -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/api.dart b/lib/src/api.dart index b50ff86..4f9d277 100644 --- a/lib/src/api.dart +++ b/lib/src/api.dart @@ -30,8 +30,8 @@ class PipedApi { this.dio = dio ?? Dio(BaseOptions( baseUrl: basePathOverride ?? basePath, - connectTimeout: 5000, - receiveTimeout: 3000, + connectTimeout: const Duration(milliseconds: 5000), + receiveTimeout: const Duration(milliseconds: 3000), )) { if (interceptors == null) { this.dio.interceptors.addAll([ diff --git a/lib/src/api/channel_api.dart b/lib/src/api/channel_api.dart index b0bfd8f..fac1de4 100644 --- a/lib/src/api/channel_api.dart +++ b/lib/src/api/channel_api.dart @@ -64,22 +64,23 @@ class ChannelApi { onReceiveProgress: onReceiveProgress, ); - ChannelInfo _responseData; + ChannelInfo? _responseData; try { - const _responseType = FullType(ChannelInfo); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ChannelInfo), ) as ChannelInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -138,22 +139,23 @@ class ChannelApi { onReceiveProgress: onReceiveProgress, ); - ChannelInfo _responseData; + ChannelInfo? _responseData; try { - const _responseType = FullType(ChannelInfo); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ChannelInfo), ) as ChannelInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -212,22 +214,23 @@ class ChannelApi { onReceiveProgress: onReceiveProgress, ); - ChannelInfo _responseData; + ChannelInfo? _responseData; try { - const _responseType = FullType(ChannelInfo); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ChannelInfo), ) as ChannelInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -293,22 +296,23 @@ class ChannelApi { onReceiveProgress: onReceiveProgress, ); - StreamsPage _responseData; + StreamsPage? _responseData; try { - const _responseType = FullType(StreamsPage); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(StreamsPage), ) as StreamsPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/lib/src/api/feed_api.dart b/lib/src/api/feed_api.dart index 14026ad..3355839 100644 --- a/lib/src/api/feed_api.dart +++ b/lib/src/api/feed_api.dart @@ -69,22 +69,23 @@ class FeedApi { onReceiveProgress: onReceiveProgress, ); - BuiltList _responseData; + BuiltList? _responseData; try { - const _responseType = FullType(BuiltList, [FullType(StreamItem)]); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(BuiltList, [FullType(StreamItem)]), ) as BuiltList; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response>( diff --git a/lib/src/api/search_api.dart b/lib/src/api/search_api.dart index 1a69e83..7831841 100644 --- a/lib/src/api/search_api.dart +++ b/lib/src/api/search_api.dart @@ -72,22 +72,23 @@ class SearchApi { onReceiveProgress: onReceiveProgress, ); - SearchPage _responseData; + SearchPage? _responseData; try { - const _responseType = FullType(SearchPage); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(SearchPage), ) as SearchPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -157,22 +158,23 @@ class SearchApi { onReceiveProgress: onReceiveProgress, ); - SearchPage _responseData; + SearchPage? _responseData; try { - const _responseType = FullType(SearchPage); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(SearchPage), ) as SearchPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/lib/src/api/unauthenticated_api.dart b/lib/src/api/unauthenticated_api.dart index 1cb0a09..0a200df 100644 --- a/lib/src/api/unauthenticated_api.dart +++ b/lib/src/api/unauthenticated_api.dart @@ -71,22 +71,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - ChannelInfo _responseData; + ChannelInfo? _responseData; try { - const _responseType = FullType(ChannelInfo); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ChannelInfo), ) as ChannelInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -145,22 +146,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - ChannelInfo _responseData; + ChannelInfo? _responseData; try { - const _responseType = FullType(ChannelInfo); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ChannelInfo), ) as ChannelInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -219,22 +221,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - ChannelInfo _responseData; + ChannelInfo? _responseData; try { - const _responseType = FullType(ChannelInfo); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(ChannelInfo), ) as ChannelInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -300,22 +303,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - StreamsPage _responseData; + StreamsPage? _responseData; try { - const _responseType = FullType(StreamsPage); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(StreamsPage), ) as StreamsPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -374,22 +378,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - CommentsPage _responseData; + CommentsPage? _responseData; try { - const _responseType = FullType(CommentsPage); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(CommentsPage), ) as CommentsPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -455,22 +460,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - CommentsPage _responseData; + CommentsPage? _responseData; try { - const _responseType = FullType(CommentsPage); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(CommentsPage), ) as CommentsPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -534,22 +540,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - BuiltList _responseData; + BuiltList? _responseData; try { - const _responseType = FullType(BuiltList, [FullType(StreamItem)]); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(BuiltList, [FullType(StreamItem)]), ) as BuiltList; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response>( @@ -616,22 +623,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - SearchPage _responseData; + SearchPage? _responseData; try { - const _responseType = FullType(SearchPage); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(SearchPage), ) as SearchPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -701,22 +709,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - SearchPage _responseData; + SearchPage? _responseData; try { - const _responseType = FullType(SearchPage); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(SearchPage), ) as SearchPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -775,22 +784,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - VideoInfo _responseData; + VideoInfo? _responseData; try { - const _responseType = FullType(VideoInfo); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(VideoInfo), ) as VideoInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -854,22 +864,23 @@ class UnauthenticatedApi { onReceiveProgress: onReceiveProgress, ); - BuiltList _responseData; + BuiltList? _responseData; try { - const _responseType = FullType(BuiltList, [FullType(StreamItem)]); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(BuiltList, [FullType(StreamItem)]), ) as BuiltList; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response>( diff --git a/lib/src/api/video_api.dart b/lib/src/api/video_api.dart index ab67015..034aade 100644 --- a/lib/src/api/video_api.dart +++ b/lib/src/api/video_api.dart @@ -64,22 +64,23 @@ class VideoApi { onReceiveProgress: onReceiveProgress, ); - CommentsPage _responseData; + CommentsPage? _responseData; try { - const _responseType = FullType(CommentsPage); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(CommentsPage), ) as CommentsPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -145,22 +146,23 @@ class VideoApi { onReceiveProgress: onReceiveProgress, ); - CommentsPage _responseData; + CommentsPage? _responseData; try { - const _responseType = FullType(CommentsPage); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(CommentsPage), ) as CommentsPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( @@ -219,22 +221,23 @@ class VideoApi { onReceiveProgress: onReceiveProgress, ); - VideoInfo _responseData; + VideoInfo? _responseData; try { - const _responseType = FullType(VideoInfo); - _responseData = _serializers.deserialize( - _response.data!, - specifiedType: _responseType, + final rawResponse = _response.data; + _responseData = rawResponse == null ? null : _serializers.deserialize( + rawResponse, + specifiedType: const FullType(VideoInfo), ) as VideoInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, - type: DioErrorType.other, + type: DioErrorType.unknown, error: error, - )..stackTrace = stackTrace; + stackTrace: stackTrace, + ); } return Response( diff --git a/lib/src/model/channel_info.g.dart b/lib/src/model/channel_info.g.dart index ea0c5ba..39c0b3f 100644 --- a/lib/src/model/channel_info.g.dart +++ b/lib/src/model/channel_info.g.dart @@ -65,22 +65,18 @@ class _$ChannelInfo extends ChannelInfo { @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc($jc(0, avatarUrl.hashCode), - bannerUrl.hashCode), - description.hashCode), - id.hashCode), - name.hashCode), - nextpage.hashCode), - relatedStreams.hashCode), - subscriberCount.hashCode), - verified.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, avatarUrl.hashCode); + _$hash = $jc(_$hash, bannerUrl.hashCode); + _$hash = $jc(_$hash, description.hashCode); + _$hash = $jc(_$hash, id.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, nextpage.hashCode); + _$hash = $jc(_$hash, relatedStreams.hashCode); + _$hash = $jc(_$hash, subscriberCount.hashCode); + _$hash = $jc(_$hash, verified.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -206,4 +202,4 @@ class ChannelInfoBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/channel_item.dart b/lib/src/model/channel_item.dart index 3327b56..a73f393 100644 --- a/lib/src/model/channel_item.dart +++ b/lib/src/model/channel_item.dart @@ -11,6 +11,7 @@ part 'channel_item.g.dart'; /// ChannelItem /// /// Properties: +/// * [type] - The type of the channel item. Always channel. /// * [description] - The description of the channel. /// * [name] - The name of the channel. /// * [subscribers] - The number of subscribers the channel has. @@ -20,6 +21,10 @@ part 'channel_item.g.dart'; /// * [videos] - The number of videos the channel has. @BuiltValue() abstract class ChannelItem implements Built { + /// The type of the channel item. Always channel. + @BuiltValueField(wireName: r'type') + String? get type; + /// The description of the channel. @BuiltValueField(wireName: r'description') String? get description; @@ -71,6 +76,13 @@ class _$ChannelItemSerializer implements PrimitiveSerializer { ChannelItem object, { FullType specifiedType = FullType.unspecified, }) sync* { + if (object.type != null) { + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(String), + ); + } if (object.description != null) { yield r'description'; yield serializers.serialize( @@ -143,6 +155,13 @@ class _$ChannelItemSerializer implements PrimitiveSerializer { final key = serializedList[i] as String; final value = serializedList[i + 1]; switch (key) { + case r'type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.type = valueDes; + break; case r'description': final valueDes = serializers.deserialize( value, diff --git a/lib/src/model/channel_item.g.dart b/lib/src/model/channel_item.g.dart index 359a37a..06dcfeb 100644 --- a/lib/src/model/channel_item.g.dart +++ b/lib/src/model/channel_item.g.dart @@ -7,6 +7,8 @@ part of 'channel_item.dart'; // ************************************************************************** class _$ChannelItem extends ChannelItem { + @override + final String? type; @override final String? description; @override @@ -26,7 +28,8 @@ class _$ChannelItem extends ChannelItem { (new ChannelItemBuilder()..update(updates))._build(); _$ChannelItem._( - {this.description, + {this.type, + this.description, this.name, this.subscribers, this.thumbnail, @@ -46,6 +49,7 @@ class _$ChannelItem extends ChannelItem { bool operator ==(Object other) { if (identical(other, this)) return true; return other is ChannelItem && + type == other.type && description == other.description && name == other.name && subscribers == other.subscribers && @@ -57,21 +61,23 @@ class _$ChannelItem extends ChannelItem { @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc($jc($jc(0, description.hashCode), name.hashCode), - subscribers.hashCode), - thumbnail.hashCode), - url.hashCode), - verified.hashCode), - videos.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, type.hashCode); + _$hash = $jc(_$hash, description.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, subscribers.hashCode); + _$hash = $jc(_$hash, thumbnail.hashCode); + _$hash = $jc(_$hash, url.hashCode); + _$hash = $jc(_$hash, verified.hashCode); + _$hash = $jc(_$hash, videos.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override String toString() { return (newBuiltValueToStringHelper(r'ChannelItem') + ..add('type', type) ..add('description', description) ..add('name', name) ..add('subscribers', subscribers) @@ -86,6 +92,10 @@ class _$ChannelItem extends ChannelItem { class ChannelItemBuilder implements Builder { _$ChannelItem? _$v; + String? _type; + String? get type => _$this._type; + set type(String? type) => _$this._type = type; + String? _description; String? get description => _$this._description; set description(String? description) => _$this._description = description; @@ -121,6 +131,7 @@ class ChannelItemBuilder implements Builder { ChannelItemBuilder get _$this { final $v = _$v; if ($v != null) { + _type = $v.type; _description = $v.description; _name = $v.name; _subscribers = $v.subscribers; @@ -150,6 +161,7 @@ class ChannelItemBuilder implements Builder { _$ChannelItem _build() { final _$result = _$v ?? new _$ChannelItem._( + type: type, description: description, name: name, subscribers: subscribers, @@ -162,4 +174,4 @@ class ChannelItemBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/comment.g.dart b/lib/src/model/comment.g.dart index d47a6e8..f04d570 100644 --- a/lib/src/model/comment.g.dart +++ b/lib/src/model/comment.g.dart @@ -77,28 +77,21 @@ class _$Comment extends Comment { @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc($jc(0, author.hashCode), - thumbnail.hashCode), - commentId.hashCode), - commentText.hashCode), - commentedTime.hashCode), - commentorUrl.hashCode), - repliesPage.hashCode), - likeCount.hashCode), - replyCount.hashCode), - hearted.hashCode), - pinned.hashCode), - verified.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, author.hashCode); + _$hash = $jc(_$hash, thumbnail.hashCode); + _$hash = $jc(_$hash, commentId.hashCode); + _$hash = $jc(_$hash, commentText.hashCode); + _$hash = $jc(_$hash, commentedTime.hashCode); + _$hash = $jc(_$hash, commentorUrl.hashCode); + _$hash = $jc(_$hash, repliesPage.hashCode); + _$hash = $jc(_$hash, likeCount.hashCode); + _$hash = $jc(_$hash, replyCount.hashCode); + _$hash = $jc(_$hash, hearted.hashCode); + _$hash = $jc(_$hash, pinned.hashCode); + _$hash = $jc(_$hash, verified.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -230,4 +223,4 @@ class CommentBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/comments_page.g.dart b/lib/src/model/comments_page.g.dart index fc5e308..d4f004b 100644 --- a/lib/src/model/comments_page.g.dart +++ b/lib/src/model/comments_page.g.dart @@ -37,8 +37,12 @@ class _$CommentsPage extends CommentsPage { @override int get hashCode { - return $jf($jc( - $jc($jc(0, comments.hashCode), nextpage.hashCode), disabled.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, comments.hashCode); + _$hash = $jc(_$hash, nextpage.hashCode); + _$hash = $jc(_$hash, disabled.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -121,4 +125,4 @@ class CommentsPageBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/content_item.dart b/lib/src/model/content_item.dart new file mode 100644 index 0000000..5f9d730 --- /dev/null +++ b/lib/src/model/content_item.dart @@ -0,0 +1,227 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// + +// ignore_for_file: unused_element +import 'package:piped_api/src/model/stream_item.dart'; +import 'package:built_collection/built_collection.dart'; +import 'package:piped_api/src/model/channel_item.dart'; +import 'package:piped_api/src/model/playlist_item.dart'; +import 'package:built_value/built_value.dart'; +import 'package:built_value/serializer.dart'; +import 'package:one_of/one_of.dart'; + +part 'content_item.g.dart'; + +/// ContentItem +/// +/// Properties: +/// * [type] - The type of the content item. +/// * [duration] - The duration of the video in seconds. +/// * [thumbnail] - The thumbnail of the playlist. +/// * [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. +/// * [uploaderUrl] - The relative URL of the channel of the video. +/// * [uploaderVerified] - Whether or not the channel has a verified badge. +/// * [url] - The relative URL of the playlist. +/// * [views] - The number of views the video has. +/// * [isShort] - Whether or not the video is a short video. +/// * [shortDescription] - The short description of the video. +/// * [description] - The description of the channel. +/// * [name] - The name of the playlist. +/// * [subscribers] - The number of subscribers the channel has. +/// * [verified] - Whether the channel is verified. +/// * [videos] - The number of videos in the playlist. +@BuiltValue() +abstract class ContentItem implements Built { + /// The type of the content item. + @BuiltValueField(wireName: r'type') + ContentItemTypeEnum get type; + // enum typeEnum { stream, channel, playlist, }; + + /// One Of [ChannelItem], [PlaylistItem], [StreamItem] + OneOf get oneOf; + + static const String discriminatorFieldName = r'type'; + + static const Map discriminatorMapping = { + r'channel': ChannelItem, + r'playlist': PlaylistItem, + r'stream': StreamItem, + }; + + ContentItem._(); + + factory ContentItem([void updates(ContentItemBuilder b)]) = _$ContentItem; + + @BuiltValueHook(initializeBuilder: true) + static void _defaults(ContentItemBuilder b) => b; + + @BuiltValueSerializer(custom: true) + static Serializer get serializer => _$ContentItemSerializer(); +} + +extension ContentItemDiscriminatorExt on ContentItem { + String? get discriminatorValue { + if (this is ChannelItem) { + return r'channel'; + } + if (this is PlaylistItem) { + return r'playlist'; + } + if (this is StreamItem) { + return r'stream'; + } + return null; + } +} +extension ContentItemBuilderDiscriminatorExt on ContentItemBuilder { + String? get discriminatorValue { + if (this is ChannelItemBuilder) { + return r'channel'; + } + if (this is PlaylistItemBuilder) { + return r'playlist'; + } + if (this is StreamItemBuilder) { + return r'stream'; + } + return null; + } +} + +class _$ContentItemSerializer implements PrimitiveSerializer { + @override + final Iterable types = const [ContentItem, _$ContentItem]; + + @override + final String wireName = r'ContentItem'; + + Iterable _serializeProperties( + Serializers serializers, + ContentItem object, { + FullType specifiedType = FullType.unspecified, + }) sync* { + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(ContentItemTypeEnum), + ); + } + + @override + Object serialize( + Serializers serializers, + ContentItem object, { + FullType specifiedType = FullType.unspecified, + }) { + final oneOf = object.oneOf; + final result = _serializeProperties(serializers, object, specifiedType: specifiedType).toList(); + result.addAll(serializers.serialize(oneOf.value, specifiedType: FullType(oneOf.valueType)) as Iterable); + return result; + } + + void _deserializeProperties( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + required List serializedList, + required ContentItemBuilder result, + required List unhandled, + }) { + for (var i = 0; i < serializedList.length; i += 2) { + final key = serializedList[i] as String; + final value = serializedList[i + 1]; + switch (key) { + case r'type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(ContentItemTypeEnum), + ) as ContentItemTypeEnum; + result.type = valueDes; + break; + default: + unhandled.add(key); + unhandled.add(value); + break; + } + } + } + + @override + ContentItem deserialize( + Serializers serializers, + Object serialized, { + FullType specifiedType = FullType.unspecified, + }) { + final result = ContentItemBuilder(); + Object? oneOfDataSrc; + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(ContentItem.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; + final unhandled = []; + _deserializeProperties( + serializers, + serialized, + specifiedType: specifiedType, + serializedList: serializedList, + unhandled: unhandled, + result: result + ); + oneOfDataSrc = unhandled; + final oneOfTypes = [ChannelItem, PlaylistItem, StreamItem, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'channel': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(ChannelItem), + ) as ChannelItem; + oneOfType = ChannelItem; + break; + case r'playlist': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(PlaylistItem), + ) as PlaylistItem; + oneOfType = PlaylistItem; + break; + case r'stream': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(StreamItem), + ) as StreamItem; + oneOfType = StreamItem; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); + return result.build(); + } +} + +class ContentItemTypeEnum extends EnumClass { + + /// The type of the content item. + @BuiltValueEnumConst(wireName: r'stream') + static const ContentItemTypeEnum stream = _$contentItemTypeEnum_stream; + /// The type of the content item. + @BuiltValueEnumConst(wireName: r'channel') + static const ContentItemTypeEnum channel = _$contentItemTypeEnum_channel; + /// The type of the content item. + @BuiltValueEnumConst(wireName: r'playlist') + static const ContentItemTypeEnum playlist = _$contentItemTypeEnum_playlist; + + static Serializer get serializer => _$contentItemTypeEnumSerializer; + + const ContentItemTypeEnum._(String name): super(name); + + static BuiltSet get values => _$contentItemTypeEnumValues; + static ContentItemTypeEnum valueOf(String name) => _$contentItemTypeEnumValueOf(name); +} + diff --git a/lib/src/model/content_item.g.dart b/lib/src/model/content_item.g.dart new file mode 100644 index 0000000..73d2830 --- /dev/null +++ b/lib/src/model/content_item.g.dart @@ -0,0 +1,165 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'content_item.dart'; + +// ************************************************************************** +// BuiltValueGenerator +// ************************************************************************** + +const ContentItemTypeEnum _$contentItemTypeEnum_stream = + const ContentItemTypeEnum._('stream'); +const ContentItemTypeEnum _$contentItemTypeEnum_channel = + const ContentItemTypeEnum._('channel'); +const ContentItemTypeEnum _$contentItemTypeEnum_playlist = + const ContentItemTypeEnum._('playlist'); + +ContentItemTypeEnum _$contentItemTypeEnumValueOf(String name) { + switch (name) { + case 'stream': + return _$contentItemTypeEnum_stream; + case 'channel': + return _$contentItemTypeEnum_channel; + case 'playlist': + return _$contentItemTypeEnum_playlist; + default: + throw new ArgumentError(name); + } +} + +final BuiltSet _$contentItemTypeEnumValues = + new BuiltSet(const [ + _$contentItemTypeEnum_stream, + _$contentItemTypeEnum_channel, + _$contentItemTypeEnum_playlist, +]); + +Serializer _$contentItemTypeEnumSerializer = + new _$ContentItemTypeEnumSerializer(); + +class _$ContentItemTypeEnumSerializer + implements PrimitiveSerializer { + static const Map _toWire = const { + 'stream': 'stream', + 'channel': 'channel', + 'playlist': 'playlist', + }; + static const Map _fromWire = const { + 'stream': 'stream', + 'channel': 'channel', + 'playlist': 'playlist', + }; + + @override + final Iterable types = const [ContentItemTypeEnum]; + @override + final String wireName = 'ContentItemTypeEnum'; + + @override + Object serialize(Serializers serializers, ContentItemTypeEnum object, + {FullType specifiedType = FullType.unspecified}) => + _toWire[object.name] ?? object.name; + + @override + ContentItemTypeEnum deserialize(Serializers serializers, Object serialized, + {FullType specifiedType = FullType.unspecified}) => + ContentItemTypeEnum.valueOf( + _fromWire[serialized] ?? (serialized is String ? serialized : '')); +} + +class _$ContentItem extends ContentItem { + @override + final ContentItemTypeEnum type; + @override + final OneOf oneOf; + + factory _$ContentItem([void Function(ContentItemBuilder)? updates]) => + (new ContentItemBuilder()..update(updates))._build(); + + _$ContentItem._({required this.type, required this.oneOf}) : super._() { + BuiltValueNullFieldError.checkNotNull(type, r'ContentItem', 'type'); + BuiltValueNullFieldError.checkNotNull(oneOf, r'ContentItem', 'oneOf'); + } + + @override + ContentItem rebuild(void Function(ContentItemBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + ContentItemBuilder toBuilder() => new ContentItemBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is ContentItem && type == other.type && oneOf == other.oneOf; + } + + @override + int get hashCode { + var _$hash = 0; + _$hash = $jc(_$hash, type.hashCode); + _$hash = $jc(_$hash, oneOf.hashCode); + _$hash = $jf(_$hash); + return _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'ContentItem') + ..add('type', type) + ..add('oneOf', oneOf)) + .toString(); + } +} + +class ContentItemBuilder implements Builder { + _$ContentItem? _$v; + + ContentItemTypeEnum? _type; + ContentItemTypeEnum? get type => _$this._type; + set type(ContentItemTypeEnum? type) => _$this._type = type; + + OneOf? _oneOf; + OneOf? get oneOf => _$this._oneOf; + set oneOf(OneOf? oneOf) => _$this._oneOf = oneOf; + + ContentItemBuilder() { + ContentItem._defaults(this); + } + + ContentItemBuilder get _$this { + final $v = _$v; + if ($v != null) { + _type = $v.type; + _oneOf = $v.oneOf; + _$v = null; + } + return this; + } + + @override + void replace(ContentItem other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$ContentItem; + } + + @override + void update(void Function(ContentItemBuilder)? updates) { + if (updates != null) updates(this); + } + + @override + ContentItem build() => _build(); + + _$ContentItem _build() { + final _$result = _$v ?? + new _$ContentItem._( + type: BuiltValueNullFieldError.checkNotNull( + type, r'ContentItem', 'type'), + oneOf: BuiltValueNullFieldError.checkNotNull( + oneOf, r'ContentItem', 'oneOf')); + replace(_$result); + return _$result; + } +} + +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/exception_error.g.dart b/lib/src/model/exception_error.g.dart index 1a9ac52..8ae1bde 100644 --- a/lib/src/model/exception_error.g.dart +++ b/lib/src/model/exception_error.g.dart @@ -39,7 +39,11 @@ class _$ExceptionError extends ExceptionError { @override int get hashCode { - return $jf($jc($jc(0, error.hashCode), message.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, error.hashCode); + _$hash = $jc(_$hash, message.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -103,4 +107,4 @@ class ExceptionErrorBuilder } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/playlist_item.dart b/lib/src/model/playlist_item.dart index 9d89657..957b0ed 100644 --- a/lib/src/model/playlist_item.dart +++ b/lib/src/model/playlist_item.dart @@ -11,12 +11,17 @@ part 'playlist_item.g.dart'; /// PlaylistItem /// /// Properties: +/// * [type] - The type of the playlist item. Always playlist. /// * [name] - The name of the playlist. /// * [thumbnail] - The thumbnail of the playlist. /// * [url] - The relative URL of the playlist. /// * [videos] - The number of videos in the playlist. @BuiltValue() abstract class PlaylistItem implements Built { + /// The type of the playlist item. Always playlist. + @BuiltValueField(wireName: r'type') + String? get type; + /// The name of the playlist. @BuiltValueField(wireName: r'name') String? get name; @@ -56,6 +61,13 @@ class _$PlaylistItemSerializer implements PrimitiveSerializer { PlaylistItem object, { FullType specifiedType = FullType.unspecified, }) sync* { + if (object.type != null) { + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(String), + ); + } if (object.name != null) { yield r'name'; yield serializers.serialize( @@ -107,6 +119,13 @@ class _$PlaylistItemSerializer implements PrimitiveSerializer { final key = serializedList[i] as String; final value = serializedList[i + 1]; switch (key) { + case r'type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.type = valueDes; + break; case r'name': final valueDes = serializers.deserialize( value, diff --git a/lib/src/model/playlist_item.g.dart b/lib/src/model/playlist_item.g.dart index a497e3a..a31a528 100644 --- a/lib/src/model/playlist_item.g.dart +++ b/lib/src/model/playlist_item.g.dart @@ -7,6 +7,8 @@ part of 'playlist_item.dart'; // ************************************************************************** class _$PlaylistItem extends PlaylistItem { + @override + final String? type; @override final String? name; @override @@ -19,7 +21,8 @@ class _$PlaylistItem extends PlaylistItem { factory _$PlaylistItem([void Function(PlaylistItemBuilder)? updates]) => (new PlaylistItemBuilder()..update(updates))._build(); - _$PlaylistItem._({this.name, this.thumbnail, this.url, this.videos}) + _$PlaylistItem._( + {this.type, this.name, this.thumbnail, this.url, this.videos}) : super._(); @override @@ -33,6 +36,7 @@ class _$PlaylistItem extends PlaylistItem { bool operator ==(Object other) { if (identical(other, this)) return true; return other is PlaylistItem && + type == other.type && name == other.name && thumbnail == other.thumbnail && url == other.url && @@ -41,14 +45,20 @@ class _$PlaylistItem extends PlaylistItem { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, name.hashCode), thumbnail.hashCode), url.hashCode), - videos.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, type.hashCode); + _$hash = $jc(_$hash, name.hashCode); + _$hash = $jc(_$hash, thumbnail.hashCode); + _$hash = $jc(_$hash, url.hashCode); + _$hash = $jc(_$hash, videos.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override String toString() { return (newBuiltValueToStringHelper(r'PlaylistItem') + ..add('type', type) ..add('name', name) ..add('thumbnail', thumbnail) ..add('url', url) @@ -61,6 +71,10 @@ class PlaylistItemBuilder implements Builder { _$PlaylistItem? _$v; + String? _type; + String? get type => _$this._type; + set type(String? type) => _$this._type = type; + String? _name; String? get name => _$this._name; set name(String? name) => _$this._name = name; @@ -84,6 +98,7 @@ class PlaylistItemBuilder PlaylistItemBuilder get _$this { final $v = _$v; if ($v != null) { + _type = $v.type; _name = $v.name; _thumbnail = $v.thumbnail; _url = $v.url; @@ -110,10 +125,14 @@ class PlaylistItemBuilder _$PlaylistItem _build() { final _$result = _$v ?? new _$PlaylistItem._( - name: name, thumbnail: thumbnail, url: url, videos: videos); + type: type, + name: name, + thumbnail: thumbnail, + url: url, + videos: videos); replace(_$result); return _$result; } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/regions.g.dart b/lib/src/model/regions.g.dart index 003076f..0978492 100644 --- a/lib/src/model/regions.g.dart +++ b/lib/src/model/regions.g.dart @@ -802,4 +802,4 @@ class _$RegionsSerializer implements PrimitiveSerializer { _fromWire[serialized] ?? (serialized is String ? serialized : '')); } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/search_filter.g.dart b/lib/src/model/search_filter.g.dart index 3e34ab4..cb77aa6 100644 --- a/lib/src/model/search_filter.g.dart +++ b/lib/src/model/search_filter.g.dart @@ -111,4 +111,4 @@ class _$SearchFilterSerializer implements PrimitiveSerializer { _fromWire[serialized] ?? (serialized is String ? serialized : '')); } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/search_item.dart b/lib/src/model/search_item.dart index 9e56705..9db83d5 100644 --- a/lib/src/model/search_item.dart +++ b/lib/src/model/search_item.dart @@ -15,6 +15,7 @@ part 'search_item.g.dart'; /// SearchItem /// /// Properties: +/// * [type] - The type of the playlist item. Always playlist. /// * [duration] - The duration of the video in seconds. /// * [thumbnail] - The thumbnail of the playlist. /// * [title] - The title of the video. @@ -26,6 +27,8 @@ part 'search_item.g.dart'; /// * [uploaderVerified] - Whether or not the channel has a verified badge. /// * [url] - The relative URL of the playlist. /// * [views] - The number of views the video has. +/// * [isShort] - Whether or not the video is a short video. +/// * [shortDescription] - The short description of the video. /// * [description] - The description of the channel. /// * [name] - The name of the playlist. /// * [subscribers] - The number of subscribers the channel has. @@ -36,6 +39,14 @@ abstract class SearchItem implements Built { /// One Of [ChannelItem], [PlaylistItem], [StreamItem] OneOf get oneOf; + static const String discriminatorFieldName = r'type'; + + static const Map discriminatorMapping = { + r'channel': ChannelItem, + r'playlist': PlaylistItem, + r'stream': StreamItem, + }; + SearchItem._(); factory SearchItem([void updates(SearchItemBuilder b)]) = _$SearchItem; @@ -47,6 +58,35 @@ abstract class SearchItem implements Built { static Serializer get serializer => _$SearchItemSerializer(); } +extension SearchItemDiscriminatorExt on SearchItem { + String? get discriminatorValue { + if (this is ChannelItem) { + return r'channel'; + } + if (this is PlaylistItem) { + return r'playlist'; + } + if (this is StreamItem) { + return r'stream'; + } + return null; + } +} +extension SearchItemBuilderDiscriminatorExt on SearchItemBuilder { + String? get discriminatorValue { + if (this is ChannelItemBuilder) { + return r'channel'; + } + if (this is PlaylistItemBuilder) { + return r'playlist'; + } + if (this is StreamItemBuilder) { + return r'stream'; + } + return null; + } +} + class _$SearchItemSerializer implements PrimitiveSerializer { @override final Iterable types = const [SearchItem, _$SearchItem]; @@ -79,9 +119,39 @@ class _$SearchItemSerializer implements PrimitiveSerializer { }) { final result = SearchItemBuilder(); Object? oneOfDataSrc; - final targetType = const FullType(OneOf, [FullType(StreamItem), FullType(ChannelItem), FullType(PlaylistItem), ]); + final serializedList = (serialized as Iterable).toList(); + final discIndex = serializedList.indexOf(SearchItem.discriminatorFieldName) + 1; + final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String; oneOfDataSrc = serialized; - result.oneOf = serializers.deserialize(oneOfDataSrc, specifiedType: targetType) as OneOf; + final oneOfTypes = [ChannelItem, PlaylistItem, StreamItem, ]; + Object oneOfResult; + Type oneOfType; + switch (discValue) { + case r'channel': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(ChannelItem), + ) as ChannelItem; + oneOfType = ChannelItem; + break; + case r'playlist': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(PlaylistItem), + ) as PlaylistItem; + oneOfType = PlaylistItem; + break; + case r'stream': + oneOfResult = serializers.deserialize( + oneOfDataSrc, + specifiedType: FullType(StreamItem), + ) as StreamItem; + oneOfType = StreamItem; + break; + default: + throw UnsupportedError("Couldn't deserialize oneOf for the discriminator value: ${discValue}"); + } + result.oneOf = OneOfDynamic(typeIndex: oneOfTypes.indexOf(oneOfType), types: oneOfTypes, value: oneOfResult); return result.build(); } } diff --git a/lib/src/model/search_item.g.dart b/lib/src/model/search_item.g.dart index 374cd88..c5c1bcd 100644 --- a/lib/src/model/search_item.g.dart +++ b/lib/src/model/search_item.g.dart @@ -32,7 +32,10 @@ class _$SearchItem extends SearchItem { @override int get hashCode { - return $jf($jc(0, oneOf.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, oneOf.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -86,4 +89,4 @@ class SearchItemBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/search_page.g.dart b/lib/src/model/search_page.g.dart index 0c5ab7b..c020a1f 100644 --- a/lib/src/model/search_page.g.dart +++ b/lib/src/model/search_page.g.dart @@ -41,9 +41,13 @@ class _$SearchPage extends SearchPage { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, corrected.hashCode), items.hashCode), nextpage.hashCode), - suggestion.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, corrected.hashCode); + _$hash = $jc(_$hash, items.hashCode); + _$hash = $jc(_$hash, nextpage.hashCode); + _$hash = $jc(_$hash, suggestion.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -132,4 +136,4 @@ class SearchPageBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/stream.g.dart b/lib/src/model/stream.g.dart index 8cfa8bb..9099978 100644 --- a/lib/src/model/stream.g.dart +++ b/lib/src/model/stream.g.dart @@ -158,32 +158,23 @@ class _$Stream extends Stream { @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc($jc(0, url.hashCode), - format.hashCode), - quality.hashCode), - mimeType.hashCode), - codec.hashCode), - videoOnly.hashCode), - bitrate.hashCode), - initStart.hashCode), - initEnd.hashCode), - indexStart.hashCode), - indexEnd.hashCode), - width.hashCode), - height.hashCode), - fps.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, url.hashCode); + _$hash = $jc(_$hash, format.hashCode); + _$hash = $jc(_$hash, quality.hashCode); + _$hash = $jc(_$hash, mimeType.hashCode); + _$hash = $jc(_$hash, codec.hashCode); + _$hash = $jc(_$hash, videoOnly.hashCode); + _$hash = $jc(_$hash, bitrate.hashCode); + _$hash = $jc(_$hash, initStart.hashCode); + _$hash = $jc(_$hash, initEnd.hashCode); + _$hash = $jc(_$hash, indexStart.hashCode); + _$hash = $jc(_$hash, indexEnd.hashCode); + _$hash = $jc(_$hash, width.hashCode); + _$hash = $jc(_$hash, height.hashCode); + _$hash = $jc(_$hash, fps.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -328,4 +319,4 @@ class StreamBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/stream_item.dart b/lib/src/model/stream_item.dart index ebfc81c..11d8e03 100644 --- a/lib/src/model/stream_item.dart +++ b/lib/src/model/stream_item.dart @@ -11,6 +11,7 @@ part 'stream_item.g.dart'; /// StreamItem /// /// Properties: +/// * [type] - The type of the stream item. Always stream. /// * [duration] - The duration of the video in seconds. /// * [thumbnail] - The thumbnail of the video. /// * [title] - The title of the video. @@ -22,8 +23,14 @@ part 'stream_item.g.dart'; /// * [uploaderVerified] - Whether or not the channel has a verified badge. /// * [url] - The relative URL to the video. /// * [views] - The number of views the video has. +/// * [isShort] - Whether or not the video is a short video. +/// * [shortDescription] - The short description of the video. @BuiltValue() abstract class StreamItem implements Built { + /// The type of the stream item. Always stream. + @BuiltValueField(wireName: r'type') + String? get type; + /// The duration of the video in seconds. @BuiltValueField(wireName: r'duration') int get duration; @@ -41,6 +48,7 @@ abstract class StreamItem implements Built { int? get uploaded; /// The relative date the video was uploaded on. + @Deprecated('uploadedDate has been deprecated') @BuiltValueField(wireName: r'uploadedDate') String? get uploadedDate; @@ -68,6 +76,14 @@ abstract class StreamItem implements Built { @BuiltValueField(wireName: r'views') int? get views; + /// Whether or not the video is a short video. + @BuiltValueField(wireName: r'isShort') + bool? get isShort; + + /// The short description of the video. + @BuiltValueField(wireName: r'shortDescription') + String? get shortDescription; + StreamItem._(); factory StreamItem([void updates(StreamItemBuilder b)]) = _$StreamItem; @@ -91,6 +107,13 @@ class _$StreamItemSerializer implements PrimitiveSerializer { StreamItem object, { FullType specifiedType = FullType.unspecified, }) sync* { + if (object.type != null) { + yield r'type'; + yield serializers.serialize( + object.type, + specifiedType: const FullType(String), + ); + } yield r'duration'; yield serializers.serialize( object.duration, @@ -160,6 +183,20 @@ class _$StreamItemSerializer implements PrimitiveSerializer { specifiedType: const FullType(int), ); } + if (object.isShort != null) { + yield r'isShort'; + yield serializers.serialize( + object.isShort, + specifiedType: const FullType(bool), + ); + } + if (object.shortDescription != null) { + yield r'shortDescription'; + yield serializers.serialize( + object.shortDescription, + specifiedType: const FullType.nullable(String), + ); + } } @override @@ -183,6 +220,13 @@ class _$StreamItemSerializer implements PrimitiveSerializer { final key = serializedList[i] as String; final value = serializedList[i + 1]; switch (key) { + case r'type': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(String), + ) as String; + result.type = valueDes; + break; case r'duration': final valueDes = serializers.deserialize( value, @@ -262,6 +306,21 @@ class _$StreamItemSerializer implements PrimitiveSerializer { ) as int; result.views = valueDes; break; + case r'isShort': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType(bool), + ) as bool; + result.isShort = valueDes; + break; + case r'shortDescription': + final valueDes = serializers.deserialize( + value, + specifiedType: const FullType.nullable(String), + ) as String?; + if (valueDes == null) continue; + result.shortDescription = valueDes; + break; default: unhandled.add(key); unhandled.add(value); diff --git a/lib/src/model/stream_item.g.dart b/lib/src/model/stream_item.g.dart index dfa7962..e85d39c 100644 --- a/lib/src/model/stream_item.g.dart +++ b/lib/src/model/stream_item.g.dart @@ -7,6 +7,8 @@ part of 'stream_item.dart'; // ************************************************************************** class _$StreamItem extends StreamItem { + @override + final String? type; @override final int duration; @override @@ -29,12 +31,17 @@ class _$StreamItem extends StreamItem { final String url; @override final int? views; + @override + final bool? isShort; + @override + final String? shortDescription; factory _$StreamItem([void Function(StreamItemBuilder)? updates]) => (new StreamItemBuilder()..update(updates))._build(); _$StreamItem._( - {required this.duration, + {this.type, + required this.duration, required this.thumbnail, required this.title, this.uploaded, @@ -44,7 +51,9 @@ class _$StreamItem extends StreamItem { this.uploaderUrl, this.uploaderVerified, required this.url, - this.views}) + this.views, + this.isShort, + this.shortDescription}) : super._() { BuiltValueNullFieldError.checkNotNull(duration, r'StreamItem', 'duration'); BuiltValueNullFieldError.checkNotNull( @@ -64,6 +73,7 @@ class _$StreamItem extends StreamItem { bool operator ==(Object other) { if (identical(other, this)) return true; return other is StreamItem && + type == other.type && duration == other.duration && thumbnail == other.thumbnail && title == other.title && @@ -74,36 +84,36 @@ class _$StreamItem extends StreamItem { uploaderUrl == other.uploaderUrl && uploaderVerified == other.uploaderVerified && url == other.url && - views == other.views; + views == other.views && + isShort == other.isShort && + shortDescription == other.shortDescription; } @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc($jc(0, duration.hashCode), - thumbnail.hashCode), - title.hashCode), - uploaded.hashCode), - uploadedDate.hashCode), - uploaderAvatar.hashCode), - uploaderName.hashCode), - uploaderUrl.hashCode), - uploaderVerified.hashCode), - url.hashCode), - views.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, type.hashCode); + _$hash = $jc(_$hash, duration.hashCode); + _$hash = $jc(_$hash, thumbnail.hashCode); + _$hash = $jc(_$hash, title.hashCode); + _$hash = $jc(_$hash, uploaded.hashCode); + _$hash = $jc(_$hash, uploadedDate.hashCode); + _$hash = $jc(_$hash, uploaderAvatar.hashCode); + _$hash = $jc(_$hash, uploaderName.hashCode); + _$hash = $jc(_$hash, uploaderUrl.hashCode); + _$hash = $jc(_$hash, uploaderVerified.hashCode); + _$hash = $jc(_$hash, url.hashCode); + _$hash = $jc(_$hash, views.hashCode); + _$hash = $jc(_$hash, isShort.hashCode); + _$hash = $jc(_$hash, shortDescription.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override String toString() { return (newBuiltValueToStringHelper(r'StreamItem') + ..add('type', type) ..add('duration', duration) ..add('thumbnail', thumbnail) ..add('title', title) @@ -114,7 +124,9 @@ class _$StreamItem extends StreamItem { ..add('uploaderUrl', uploaderUrl) ..add('uploaderVerified', uploaderVerified) ..add('url', url) - ..add('views', views)) + ..add('views', views) + ..add('isShort', isShort) + ..add('shortDescription', shortDescription)) .toString(); } } @@ -122,6 +134,10 @@ class _$StreamItem extends StreamItem { class StreamItemBuilder implements Builder { _$StreamItem? _$v; + String? _type; + String? get type => _$this._type; + set type(String? type) => _$this._type = type; + int? _duration; int? get duration => _$this._duration; set duration(int? duration) => _$this._duration = duration; @@ -168,6 +184,15 @@ class StreamItemBuilder implements Builder { int? get views => _$this._views; set views(int? views) => _$this._views = views; + bool? _isShort; + bool? get isShort => _$this._isShort; + set isShort(bool? isShort) => _$this._isShort = isShort; + + String? _shortDescription; + String? get shortDescription => _$this._shortDescription; + set shortDescription(String? shortDescription) => + _$this._shortDescription = shortDescription; + StreamItemBuilder() { StreamItem._defaults(this); } @@ -175,6 +200,7 @@ class StreamItemBuilder implements Builder { StreamItemBuilder get _$this { final $v = _$v; if ($v != null) { + _type = $v.type; _duration = $v.duration; _thumbnail = $v.thumbnail; _title = $v.title; @@ -186,6 +212,8 @@ class StreamItemBuilder implements Builder { _uploaderVerified = $v.uploaderVerified; _url = $v.url; _views = $v.views; + _isShort = $v.isShort; + _shortDescription = $v.shortDescription; _$v = null; } return this; @@ -208,6 +236,7 @@ class StreamItemBuilder implements Builder { _$StreamItem _build() { final _$result = _$v ?? new _$StreamItem._( + type: type, duration: BuiltValueNullFieldError.checkNotNull( duration, r'StreamItem', 'duration'), thumbnail: BuiltValueNullFieldError.checkNotNull( @@ -222,10 +251,12 @@ class StreamItemBuilder implements Builder { uploaderVerified: uploaderVerified, url: BuiltValueNullFieldError.checkNotNull( url, r'StreamItem', 'url'), - views: views); + views: views, + isShort: isShort, + shortDescription: shortDescription); replace(_$result); return _$result; } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/streams_page.g.dart b/lib/src/model/streams_page.g.dart index e67eb10..2ac3f60 100644 --- a/lib/src/model/streams_page.g.dart +++ b/lib/src/model/streams_page.g.dart @@ -34,7 +34,11 @@ class _$StreamsPage extends StreamsPage { @override int get hashCode { - return $jf($jc($jc(0, relatedStreams.hashCode), nextpage.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, relatedStreams.hashCode); + _$hash = $jc(_$hash, nextpage.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -109,4 +113,4 @@ class StreamsPageBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/subtitle.g.dart b/lib/src/model/subtitle.g.dart index 9c6ad6d..af9d41e 100644 --- a/lib/src/model/subtitle.g.dart +++ b/lib/src/model/subtitle.g.dart @@ -41,10 +41,13 @@ class _$Subtitle extends Subtitle { @override int get hashCode { - return $jf($jc( - $jc($jc($jc(0, autoGenerated.hashCode), code.hashCode), - mimeType.hashCode), - url.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, autoGenerated.hashCode); + _$hash = $jc(_$hash, code.hashCode); + _$hash = $jc(_$hash, mimeType.hashCode); + _$hash = $jc(_$hash, url.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -120,4 +123,4 @@ class SubtitleBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/model/video_info.g.dart b/lib/src/model/video_info.g.dart index ce89bab..1cd19a2 100644 --- a/lib/src/model/video_info.g.dart +++ b/lib/src/model/video_info.g.dart @@ -113,44 +113,30 @@ class _$VideoInfo extends VideoInfo { @override int get hashCode { - return $jf($jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc( - $jc($jc($jc(0, audioStreams.hashCode), videoStreams.hashCode), - description.hashCode), - dislikes.hashCode), - duration.hashCode), - hls.hashCode), - lbryId.hashCode), - likes.hashCode), - livestream.hashCode), - proxyUrl.hashCode), - subtitles.hashCode), - dash.hashCode), - thumbnailUrl.hashCode), - title.hashCode), - uploadDate.hashCode), - uploader.hashCode), - uploaderAvatar.hashCode), - uploaderUrl.hashCode), - uploaderVerified.hashCode), - views.hashCode), - relatedStreams.hashCode)); + var _$hash = 0; + _$hash = $jc(_$hash, audioStreams.hashCode); + _$hash = $jc(_$hash, videoStreams.hashCode); + _$hash = $jc(_$hash, description.hashCode); + _$hash = $jc(_$hash, dislikes.hashCode); + _$hash = $jc(_$hash, duration.hashCode); + _$hash = $jc(_$hash, hls.hashCode); + _$hash = $jc(_$hash, lbryId.hashCode); + _$hash = $jc(_$hash, likes.hashCode); + _$hash = $jc(_$hash, livestream.hashCode); + _$hash = $jc(_$hash, proxyUrl.hashCode); + _$hash = $jc(_$hash, subtitles.hashCode); + _$hash = $jc(_$hash, dash.hashCode); + _$hash = $jc(_$hash, thumbnailUrl.hashCode); + _$hash = $jc(_$hash, title.hashCode); + _$hash = $jc(_$hash, uploadDate.hashCode); + _$hash = $jc(_$hash, uploader.hashCode); + _$hash = $jc(_$hash, uploaderAvatar.hashCode); + _$hash = $jc(_$hash, uploaderUrl.hashCode); + _$hash = $jc(_$hash, uploaderVerified.hashCode); + _$hash = $jc(_$hash, views.hashCode); + _$hash = $jc(_$hash, relatedStreams.hashCode); + _$hash = $jf(_$hash); + return _$hash; } @override @@ -375,4 +361,4 @@ class VideoInfoBuilder implements Builder { } } -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/src/serializers.g.dart b/lib/src/serializers.g.dart index 1607c4b..e5ef13e 100644 --- a/lib/src/serializers.g.dart +++ b/lib/src/serializers.g.dart @@ -49,4 +49,4 @@ Serializers _$serializers = (new Serializers().toBuilder() () => new ListBuilder())) .build(); -// ignore_for_file: always_put_control_body_on_new_line,always_specify_types,annotate_overrides,avoid_annotating_with_dynamic,avoid_as,avoid_catches_without_on_clauses,avoid_returning_this,deprecated_member_use_from_same_package,lines_longer_than_80_chars,no_leading_underscores_for_local_identifiers,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new,unnecessary_lambdas +// ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/pubspec.yaml b/pubspec.yaml index 51c8131..89ca91d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,10 +4,10 @@ description: Automatically generated OpenAPI bindings for Piped. homepage: homepage environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.15.0 <3.0.0' dependencies: - dio: '>=4.0.1 <5.0.0' + dio: '^5.0.0' one_of: '>=1.5.0 <2.0.0' one_of_serializer: '>=1.5.0 <2.0.0' built_value: '>=8.4.0 <9.0.0' diff --git a/test/content_item_test.dart b/test/content_item_test.dart new file mode 100644 index 0000000..035c08b --- /dev/null +++ b/test/content_item_test.dart @@ -0,0 +1,125 @@ +import 'package:test/test.dart'; +import 'package:piped_api/piped_api.dart'; + +// tests for ContentItem +void main() { + final instance = ContentItemBuilder(); + // TODO add properties to the builder and call build() + + group(ContentItem, () { + // The type of the content item. + // String type + test('to test the property `type`', () async { + // TODO + }); + + // The duration of the video in seconds. + // int duration + test('to test the property `duration`', () async { + // TODO + }); + + // The thumbnail of the playlist. + // String thumbnail + test('to test the property `thumbnail`', () async { + // TODO + }); + + // The title of the video. + // String title + test('to test the property `title`', () async { + // TODO + }); + + // The date in unix epoch the video was uploaded. + // int uploaded + test('to test the property `uploaded`', () async { + // TODO + }); + + // The relative date the video was uploaded on. + // String uploadedDate + test('to test the property `uploadedDate`', () async { + // TODO + }); + + // The avatar of the channel of the video. + // String uploaderAvatar + test('to test the property `uploaderAvatar`', () async { + // TODO + }); + + // The name of the channel of the video. + // String uploaderName + test('to test the property `uploaderName`', () async { + // TODO + }); + + // The relative URL of the channel of the video. + // String uploaderUrl + test('to test the property `uploaderUrl`', () async { + // TODO + }); + + // Whether or not the channel has a verified badge. + // bool uploaderVerified + test('to test the property `uploaderVerified`', () async { + // TODO + }); + + // The relative URL of the playlist. + // String url + test('to test the property `url`', () async { + // TODO + }); + + // The number of views the video has. + // int views + test('to test the property `views`', () async { + // TODO + }); + + // Whether or not the video is a short video. + // bool isShort + test('to test the property `isShort`', () async { + // TODO + }); + + // The short description of the video. + // String shortDescription + test('to test the property `shortDescription`', () async { + // TODO + }); + + // The description of the channel. + // String description + test('to test the property `description`', () async { + // TODO + }); + + // The name of the playlist. + // String name + test('to test the property `name`', () async { + // TODO + }); + + // The number of subscribers the channel has. + // int subscribers + test('to test the property `subscribers`', () async { + // TODO + }); + + // Whether the channel is verified. + // bool verified + test('to test the property `verified`', () async { + // TODO + }); + + // The number of videos in the playlist. + // int videos + test('to test the property `videos`', () async { + // TODO + }); + + }); +} diff --git a/test/search_api_test.dart b/test/search_api_test.dart index d63e04e..ba81bdb 100644 --- a/test/search_api_test.dart +++ b/test/search_api_test.dart @@ -1,7 +1,6 @@ import 'package:test/test.dart'; import 'package:piped_api/piped_api.dart'; - /// tests for SearchApi void main() { final instance = PipedApi().getSearchApi(); @@ -9,21 +8,23 @@ void main() { group(SearchApi, () { // Searches for videos, channels, and playlists. // - // Searches for videos, channels, and playlists. + // Searches for videos, channels, and playlists. // //Future search(String q, SearchFilter filter) async test('test search', () async { - // TODO + print((await instance.search(q: "cat videos", filter: SearchFilter.all)) + .data + ?.items + ?.first); }); // Gets more search results // - // Gets more search results. + // Gets more search results. // //Future searchNextPage(String nextpage, String q, SearchFilter filter) async test('test searchNextPage', () async { // TODO }); - }); }