Update to latest openapi code.

This commit is contained in:
Kavin 2023-06-09 19:59:12 +01:00
parent fd20ae95b1
commit 26f755fc52
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
49 changed files with 1224 additions and 452 deletions

View File

@ -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

View File

@ -1 +1 @@
6.2.0
6.6.0

View File

@ -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

View File

@ -7,3 +7,5 @@ analyzer:
implicit-casts: false
exclude:
- test/*.dart
errors:
deprecated_member_use_from_same_package: ignore

View File

@ -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]

33
doc/ContentItem.md Normal file
View File

@ -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)

View File

@ -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]

View File

@ -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]

View File

@ -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)

View File

@ -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<ChannelInfo, ChannelInfoBuilder> {
}
}
// 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

View File

@ -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

View File

@ -803,4 +803,4 @@ class _$RegionsSerializer implements PrimitiveSerializer<Regions> {
_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

View File

@ -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<Stream, StreamBuilder> {
}
}
// 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

View File

@ -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<StreamItem, StreamItemBuilder> {
}
}
// 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

View File

@ -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<StreamsPage, StreamsPageBuilder> {
}
}
// 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

View File

@ -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<Subtitle, SubtitleBuilder> {
}
}
// 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

View File

@ -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<VideoInfo, VideoInfoBuilder> {
}
}
// 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

View File

@ -37,4 +37,4 @@ Serializers _$serializers = (new Serializers().toBuilder()
() => new ListBuilder<StreamItem>()))
.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

View File

@ -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([

View File

@ -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<ChannelInfo>(
@ -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<ChannelInfo>(
@ -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<ChannelInfo>(
@ -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<StreamsPage>(

View File

@ -69,22 +69,23 @@ class FeedApi {
onReceiveProgress: onReceiveProgress,
);
BuiltList<StreamItem> _responseData;
BuiltList<StreamItem>? _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<StreamItem>;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
response: _response,
type: DioErrorType.other,
type: DioErrorType.unknown,
error: error,
)..stackTrace = stackTrace;
stackTrace: stackTrace,
);
}
return Response<BuiltList<StreamItem>>(

View File

@ -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<SearchPage>(
@ -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<SearchPage>(

View File

@ -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<ChannelInfo>(
@ -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<ChannelInfo>(
@ -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<ChannelInfo>(
@ -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<StreamsPage>(
@ -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<CommentsPage>(
@ -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<CommentsPage>(
@ -534,22 +540,23 @@ class UnauthenticatedApi {
onReceiveProgress: onReceiveProgress,
);
BuiltList<StreamItem> _responseData;
BuiltList<StreamItem>? _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<StreamItem>;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
response: _response,
type: DioErrorType.other,
type: DioErrorType.unknown,
error: error,
)..stackTrace = stackTrace;
stackTrace: stackTrace,
);
}
return Response<BuiltList<StreamItem>>(
@ -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<SearchPage>(
@ -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<SearchPage>(
@ -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<VideoInfo>(
@ -854,22 +864,23 @@ class UnauthenticatedApi {
onReceiveProgress: onReceiveProgress,
);
BuiltList<StreamItem> _responseData;
BuiltList<StreamItem>? _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<StreamItem>;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
response: _response,
type: DioErrorType.other,
type: DioErrorType.unknown,
error: error,
)..stackTrace = stackTrace;
stackTrace: stackTrace,
);
}
return Response<BuiltList<StreamItem>>(

View File

@ -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<CommentsPage>(
@ -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<CommentsPage>(
@ -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<VideoInfo>(

View File

@ -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<ChannelInfo, ChannelInfoBuilder> {
}
}
// 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

View File

@ -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<ChannelItem, ChannelItemBuilder> {
/// 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> {
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<ChannelItem> {
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,

View File

@ -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, ChannelItemBuilder> {
_$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<ChannelItem, ChannelItemBuilder> {
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, ChannelItemBuilder> {
_$ChannelItem _build() {
final _$result = _$v ??
new _$ChannelItem._(
type: type,
description: description,
name: name,
subscribers: subscribers,
@ -162,4 +174,4 @@ class ChannelItemBuilder implements Builder<ChannelItem, ChannelItemBuilder> {
}
}
// 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

View File

@ -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<Comment, CommentBuilder> {
}
}
// 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

View File

@ -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

View File

@ -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<ContentItem, ContentItemBuilder> {
/// 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<String, Type> 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<ContentItem> 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<ContentItem> {
@override
final Iterable<Type> types = const [ContentItem, _$ContentItem];
@override
final String wireName = r'ContentItem';
Iterable<Object?> _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<Object?>);
return result;
}
void _deserializeProperties(
Serializers serializers,
Object serialized, {
FullType specifiedType = FullType.unspecified,
required List<Object?> serializedList,
required ContentItemBuilder result,
required List<Object?> 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<Object?>).toList();
final discIndex = serializedList.indexOf(ContentItem.discriminatorFieldName) + 1;
final discValue = serializers.deserialize(serializedList[discIndex], specifiedType: FullType(String)) as String;
final unhandled = <Object?>[];
_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<ContentItemTypeEnum> get serializer => _$contentItemTypeEnumSerializer;
const ContentItemTypeEnum._(String name): super(name);
static BuiltSet<ContentItemTypeEnum> get values => _$contentItemTypeEnumValues;
static ContentItemTypeEnum valueOf(String name) => _$contentItemTypeEnumValueOf(name);
}

View File

@ -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<ContentItemTypeEnum> _$contentItemTypeEnumValues =
new BuiltSet<ContentItemTypeEnum>(const <ContentItemTypeEnum>[
_$contentItemTypeEnum_stream,
_$contentItemTypeEnum_channel,
_$contentItemTypeEnum_playlist,
]);
Serializer<ContentItemTypeEnum> _$contentItemTypeEnumSerializer =
new _$ContentItemTypeEnumSerializer();
class _$ContentItemTypeEnumSerializer
implements PrimitiveSerializer<ContentItemTypeEnum> {
static const Map<String, Object> _toWire = const <String, Object>{
'stream': 'stream',
'channel': 'channel',
'playlist': 'playlist',
};
static const Map<Object, String> _fromWire = const <Object, String>{
'stream': 'stream',
'channel': 'channel',
'playlist': 'playlist',
};
@override
final Iterable<Type> types = const <Type>[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, ContentItemBuilder> {
_$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

View File

@ -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

View File

@ -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<PlaylistItem, PlaylistItemBuilder> {
/// 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> {
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<PlaylistItem> {
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,

View File

@ -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, PlaylistItemBuilder> {
_$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

View File

@ -802,4 +802,4 @@ class _$RegionsSerializer implements PrimitiveSerializer<Regions> {
_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

View File

@ -111,4 +111,4 @@ class _$SearchFilterSerializer implements PrimitiveSerializer<SearchFilter> {
_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

View File

@ -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<SearchItem, SearchItemBuilder> {
/// One Of [ChannelItem], [PlaylistItem], [StreamItem]
OneOf get oneOf;
static const String discriminatorFieldName = r'type';
static const Map<String, Type> 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<SearchItem, SearchItemBuilder> {
static Serializer<SearchItem> 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<SearchItem> {
@override
final Iterable<Type> types = const [SearchItem, _$SearchItem];
@ -79,9 +119,39 @@ class _$SearchItemSerializer implements PrimitiveSerializer<SearchItem> {
}) {
final result = SearchItemBuilder();
Object? oneOfDataSrc;
final targetType = const FullType(OneOf, [FullType(StreamItem), FullType(ChannelItem), FullType(PlaylistItem), ]);
final serializedList = (serialized as Iterable<Object?>).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();
}
}

View File

@ -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<SearchItem, SearchItemBuilder> {
}
}
// 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

View File

@ -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<SearchPage, SearchPageBuilder> {
}
}
// 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

View File

@ -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<Stream, StreamBuilder> {
}
}
// 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

View File

@ -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<StreamItem, StreamItemBuilder> {
/// 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<StreamItem, StreamItemBuilder> {
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<StreamItem, StreamItemBuilder> {
@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> {
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<StreamItem> {
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<StreamItem> {
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<StreamItem> {
) 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);

View File

@ -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, StreamItemBuilder> {
_$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<StreamItem, StreamItemBuilder> {
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<StreamItem, StreamItemBuilder> {
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<StreamItem, StreamItemBuilder> {
_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, StreamItemBuilder> {
_$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<StreamItem, StreamItemBuilder> {
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

View File

@ -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<StreamsPage, StreamsPageBuilder> {
}
}
// 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

View File

@ -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<Subtitle, SubtitleBuilder> {
}
}
// 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

View File

@ -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<VideoInfo, VideoInfoBuilder> {
}
}
// 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

View File

@ -49,4 +49,4 @@ Serializers _$serializers = (new Serializers().toBuilder()
() => new ListBuilder<StreamItem>()))
.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

View File

@ -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'

125
test/content_item_test.dart Normal file
View File

@ -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
});
});
}

View File

@ -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<SearchPage> 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<SearchPage> searchNextPage(String nextpage, String q, SearchFilter filter) async
test('test searchNextPage', () async {
// TODO
});
});
}