Implement support for searching.

This commit is contained in:
Kavin 2022-07-07 18:34:25 +01:00
parent abb6f6e71c
commit 45dcedf2ef
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
27 changed files with 2237 additions and 2 deletions

View file

@ -2,10 +2,15 @@
README.md
analysis_options.yaml
doc/ChannelInfo.md
doc/ChannelItem.md
doc/Comment.md
doc/CommentsPage.md
doc/ExceptionError.md
doc/PlaylistItem.md
doc/Regions.md
doc/SearchFilter.md
doc/SearchItem.md
doc/SearchPage.md
doc/Stream.md
doc/StreamItem.md
doc/StreamsPage.md
@ -23,11 +28,16 @@ lib/src/auth/bearer_auth.dart
lib/src/auth/oauth.dart
lib/src/date_serializer.dart
lib/src/model/channel_info.dart
lib/src/model/channel_item.dart
lib/src/model/comment.dart
lib/src/model/comments_page.dart
lib/src/model/date.dart
lib/src/model/exception_error.dart
lib/src/model/playlist_item.dart
lib/src/model/regions.dart
lib/src/model/search_filter.dart
lib/src/model/search_item.dart
lib/src/model/search_page.dart
lib/src/model/stream.dart
lib/src/model/stream_item.dart
lib/src/model/streams_page.dart
@ -35,5 +45,8 @@ lib/src/model/subtitle.dart
lib/src/model/video_info.dart
lib/src/serializers.dart
pubspec.yaml
test/comment_test.dart
test/comments_page_test.dart
test/channel_item_test.dart
test/playlist_item_test.dart
test/search_filter_test.dart
test/search_item_test.dart
test/search_page_test.dart

View file

@ -71,6 +71,8 @@ Class | Method | HTTP request | Description
[*UnauthenticatedApi*](doc/UnauthenticatedApi.md) | [**channelNextPage**](doc/UnauthenticatedApi.md#channelnextpage) | **GET** /nextpage/channel/{channelId} | Gets more channel videos
[*UnauthenticatedApi*](doc/UnauthenticatedApi.md) | [**comments**](doc/UnauthenticatedApi.md#comments) | **GET** /comments/{videoId} | Gets Comments
[*UnauthenticatedApi*](doc/UnauthenticatedApi.md) | [**commentsNextPage**](doc/UnauthenticatedApi.md#commentsnextpage) | **GET** /nextpage/comments/{videoId} | Gets more comments
[*UnauthenticatedApi*](doc/UnauthenticatedApi.md) | [**search**](doc/UnauthenticatedApi.md#search) | **GET** /search | Searches for videos, channels, and playlists.
[*UnauthenticatedApi*](doc/UnauthenticatedApi.md) | [**searchNextPage**](doc/UnauthenticatedApi.md#searchnextpage) | **GET** /nextpage/search | Gets more search results
[*UnauthenticatedApi*](doc/UnauthenticatedApi.md) | [**streamInfo**](doc/UnauthenticatedApi.md#streaminfo) | **GET** /streams/{videoId} | Gets Video Information
[*UnauthenticatedApi*](doc/UnauthenticatedApi.md) | [**trending**](doc/UnauthenticatedApi.md#trending) | **GET** /trending | Gets all Trending Videos
@ -78,10 +80,15 @@ Class | Method | HTTP request | Description
## Documentation For Models
- [ChannelInfo](doc/ChannelInfo.md)
- [ChannelItem](doc/ChannelItem.md)
- [Comment](doc/Comment.md)
- [CommentsPage](doc/CommentsPage.md)
- [ExceptionError](doc/ExceptionError.md)
- [PlaylistItem](doc/PlaylistItem.md)
- [Regions](doc/Regions.md)
- [SearchFilter](doc/SearchFilter.md)
- [SearchItem](doc/SearchItem.md)
- [SearchPage](doc/SearchPage.md)
- [Stream](doc/Stream.md)
- [StreamItem](doc/StreamItem.md)
- [StreamsPage](doc/StreamsPage.md)

21
doc/ChannelItem.md Normal file
View file

@ -0,0 +1,21 @@
# piped_api.model.ChannelItem
## Load the model package
```dart
import 'package:piped_api/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**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]
**thumbnail** | **String** | The thumbnail of the channel. | [optional]
**url** | **String** | The relative URL of the channel. | [optional]
**verified** | **bool** | Whether the channel is verified. | [optional]
**videos** | **int** | The number of videos the channel has. | [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)

18
doc/PlaylistItem.md Normal file
View file

@ -0,0 +1,18 @@
# piped_api.model.PlaylistItem
## Load the model package
```dart
import 'package:piped_api/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**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]
**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)

14
doc/SearchFilter.md Normal file
View file

@ -0,0 +1,14 @@
# piped_api.model.SearchFilter
## Load the model package
```dart
import 'package:piped_api/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

30
doc/SearchItem.md Normal file
View file

@ -0,0 +1,30 @@
# piped_api.model.SearchItem
## Load the model package
```dart
import 'package:piped_api/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**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]
**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)

18
doc/SearchPage.md Normal file
View file

@ -0,0 +1,18 @@
# piped_api.model.SearchPage
## Load the model package
```dart
import 'package:piped_api/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**corrected** | **bool** | Whether the search query was corrected. | [optional]
**items** | [**BuiltList<SearchItem>**](SearchItem.md) | | [optional]
**nextpage** | **String** | The parameter used to get the next page of this page. | [optional]
**suggestion** | **String** | The suggested search query. | [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

@ -15,6 +15,8 @@ Method | HTTP request | Description
[**channelNextPage**](UnauthenticatedApi.md#channelnextpage) | **GET** /nextpage/channel/{channelId} | Gets more channel videos
[**comments**](UnauthenticatedApi.md#comments) | **GET** /comments/{videoId} | Gets Comments
[**commentsNextPage**](UnauthenticatedApi.md#commentsnextpage) | **GET** /nextpage/comments/{videoId} | Gets more comments
[**search**](UnauthenticatedApi.md#search) | **GET** /search | Searches for videos, channels, and playlists.
[**searchNextPage**](UnauthenticatedApi.md#searchnextpage) | **GET** /nextpage/search | Gets more search results
[**streamInfo**](UnauthenticatedApi.md#streaminfo) | **GET** /streams/{videoId} | Gets Video Information
[**trending**](UnauthenticatedApi.md#trending) | **GET** /trending | Gets all Trending Videos
@ -281,6 +283,98 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **search**
> SearchPage search(q, filter)
Searches for videos, channels, and playlists.
Searches for videos, channels, and playlists.
### Example
```dart
import 'package:piped_api/api.dart';
final api = PipedApi().getUnauthenticatedApi();
final String q = Techlore; // String | The search query string.
final SearchFilter filter = ; // SearchFilter | The filter parameter specifies a filter query that restricts the results to items that match the filter.
try {
final response = api.search(q, filter);
print(response);
} catch on DioError (e) {
print('Exception when calling UnauthenticatedApi->search: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**q** | **String**| The search query string. |
**filter** | [**SearchFilter**](.md)| The filter parameter specifies a filter query that restricts the results to items that match the filter. |
### Return type
[**SearchPage**](SearchPage.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **searchNextPage**
> SearchPage searchNextPage(nextpage, q, filter)
Gets more search results
Gets more search results.
### Example
```dart
import 'package:piped_api/api.dart';
final api = PipedApi().getUnauthenticatedApi();
final String nextpage = nextpage_example; // String | The next page token to get more search results from.
final String q = Techlore; // String | The search query string.
final SearchFilter filter = ; // SearchFilter | The filter parameter specifies a filter query that restricts the results to items that match the filter.
try {
final response = api.searchNextPage(nextpage, q, filter);
print(response);
} catch on DioError (e) {
print('Exception when calling UnauthenticatedApi->searchNextPage: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**nextpage** | **String**| The next page token to get more search results from. |
**q** | **String**| The search query string. |
**filter** | [**SearchFilter**](.md)| The filter parameter specifies a filter query that restricts the results to items that match the filter. |
### Return type
[**SearchPage**](SearchPage.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **streamInfo**
> VideoInfo streamInfo(videoId)

View file

@ -12,10 +12,15 @@ export 'package:piped_api/src/model/date.dart';
export 'package:piped_api/src/api/unauthenticated_api.dart';
export 'package:piped_api/src/model/channel_info.dart';
export 'package:piped_api/src/model/channel_item.dart';
export 'package:piped_api/src/model/comment.dart';
export 'package:piped_api/src/model/comments_page.dart';
export 'package:piped_api/src/model/exception_error.dart';
export 'package:piped_api/src/model/playlist_item.dart';
export 'package:piped_api/src/model/regions.dart';
export 'package:piped_api/src/model/search_filter.dart';
export 'package:piped_api/src/model/search_item.dart';
export 'package:piped_api/src/model/search_page.dart';
export 'package:piped_api/src/model/stream.dart';
export 'package:piped_api/src/model/stream_item.dart';
export 'package:piped_api/src/model/streams_page.dart';

View file

@ -13,6 +13,8 @@ import 'package:piped_api/src/model/channel_info.dart';
import 'package:piped_api/src/model/comments_page.dart';
import 'package:piped_api/src/model/exception_error.dart';
import 'package:piped_api/src/model/regions.dart';
import 'package:piped_api/src/model/search_filter.dart';
import 'package:piped_api/src/model/search_page.dart';
import 'package:piped_api/src/model/stream_item.dart';
import 'package:piped_api/src/model/streams_page.dart';
import 'package:piped_api/src/model/video_info.dart';
@ -483,6 +485,173 @@ class UnauthenticatedApi {
);
}
/// Searches for videos, channels, and playlists.
/// Searches for videos, channels, and playlists.
///
/// Parameters:
/// * [q] - The search query string.
/// * [filter] - The filter parameter specifies a filter query that restricts the results to items that match the filter.
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
/// * [headers] - Can be used to add additional headers to the request
/// * [extras] - Can be used to add flags to the request
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
///
/// Returns a [Future] containing a [Response] with a [SearchPage] as data
/// Throws [DioError] if API call or serialization fails
Future<Response<SearchPage>> search({
required String q,
required SearchFilter filter,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/search';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
r'q': encodeQueryParameter(_serializers, q, const FullType(String)),
r'filter': encodeQueryParameter(_serializers, filter, const FullType(SearchFilter)),
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
SearchPage _responseData;
try {
const _responseType = FullType(SearchPage);
_responseData = _serializers.deserialize(
_response.data!,
specifiedType: _responseType,
) as SearchPage;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
response: _response,
type: DioErrorType.other,
error: error,
)..stackTrace = stackTrace;
}
return Response<SearchPage>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Gets more search results
/// Gets more search results.
///
/// Parameters:
/// * [nextpage] - The next page token to get more search results from.
/// * [q] - The search query string.
/// * [filter] - The filter parameter specifies a filter query that restricts the results to items that match the filter.
/// * [cancelToken] - A [CancelToken] that can be used to cancel the operation
/// * [headers] - Can be used to add additional headers to the request
/// * [extras] - Can be used to add flags to the request
/// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response
/// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress
/// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress
///
/// Returns a [Future] containing a [Response] with a [SearchPage] as data
/// Throws [DioError] if API call or serialization fails
Future<Response<SearchPage>> searchNextPage({
required String nextpage,
required String q,
required SearchFilter filter,
CancelToken? cancelToken,
Map<String, dynamic>? headers,
Map<String, dynamic>? extra,
ValidateStatus? validateStatus,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) async {
final _path = r'/nextpage/search';
final _options = Options(
method: r'GET',
headers: <String, dynamic>{
...?headers,
},
extra: <String, dynamic>{
'secure': <Map<String, String>>[],
...?extra,
},
validateStatus: validateStatus,
);
final _queryParameters = <String, dynamic>{
r'nextpage': encodeQueryParameter(_serializers, nextpage, const FullType(String)),
r'q': encodeQueryParameter(_serializers, q, const FullType(String)),
r'filter': encodeQueryParameter(_serializers, filter, const FullType(SearchFilter)),
};
final _response = await _dio.request<Object>(
_path,
options: _options,
queryParameters: _queryParameters,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
SearchPage _responseData;
try {
const _responseType = FullType(SearchPage);
_responseData = _serializers.deserialize(
_response.data!,
specifiedType: _responseType,
) as SearchPage;
} catch (error, stackTrace) {
throw DioError(
requestOptions: _response.requestOptions,
response: _response,
type: DioErrorType.other,
error: error,
)..stackTrace = stackTrace;
}
return Response<SearchPage>(
data: _responseData,
headers: _response.headers,
isRedirect: _response.isRedirect,
requestOptions: _response.requestOptions,
redirects: _response.redirects,
statusCode: _response.statusCode,
statusMessage: _response.statusMessage,
extra: _response.extra,
);
}
/// Gets Video Information
/// Gets all available Stream information about a video.
///

View file

@ -0,0 +1,168 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
part 'channel_item.g.dart';
/// ChannelItem
///
/// Properties:
/// * [description] - The description of the channel.
/// * [name] - The name of the channel.
/// * [subscribers] - The number of subscribers the channel has.
/// * [thumbnail] - The thumbnail of the channel.
/// * [url] - The relative URL of the channel.
/// * [verified] - Whether the channel is verified.
/// * [videos] - The number of videos the channel has.
abstract class ChannelItem implements Built<ChannelItem, ChannelItemBuilder> {
/// The description of the channel.
@BuiltValueField(wireName: r'description')
String? get description;
/// The name of the channel.
@BuiltValueField(wireName: r'name')
String? get name;
/// The number of subscribers the channel has.
@BuiltValueField(wireName: r'subscribers')
int? get subscribers;
/// The thumbnail of the channel.
@BuiltValueField(wireName: r'thumbnail')
String? get thumbnail;
/// The relative URL of the channel.
@BuiltValueField(wireName: r'url')
String? get url;
/// Whether the channel is verified.
@BuiltValueField(wireName: r'verified')
bool? get verified;
/// The number of videos the channel has.
@BuiltValueField(wireName: r'videos')
int? get videos;
ChannelItem._();
@BuiltValueHook(initializeBuilder: true)
static void _defaults(ChannelItemBuilder b) => b;
factory ChannelItem([void updates(ChannelItemBuilder b)]) = _$ChannelItem;
@BuiltValueSerializer(custom: true)
static Serializer<ChannelItem> get serializer => _$ChannelItemSerializer();
}
class _$ChannelItemSerializer implements StructuredSerializer<ChannelItem> {
@override
final Iterable<Type> types = const [ChannelItem, _$ChannelItem];
@override
final String wireName = r'ChannelItem';
@override
Iterable<Object?> serialize(Serializers serializers, ChannelItem object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[];
if (object.description != null) {
result
..add(r'description')
..add(serializers.serialize(object.description,
specifiedType: const FullType(String)));
}
if (object.name != null) {
result
..add(r'name')
..add(serializers.serialize(object.name,
specifiedType: const FullType(String)));
}
if (object.subscribers != null) {
result
..add(r'subscribers')
..add(serializers.serialize(object.subscribers,
specifiedType: const FullType(int)));
}
if (object.thumbnail != null) {
result
..add(r'thumbnail')
..add(serializers.serialize(object.thumbnail,
specifiedType: const FullType(String)));
}
if (object.url != null) {
result
..add(r'url')
..add(serializers.serialize(object.url,
specifiedType: const FullType(String)));
}
if (object.verified != null) {
result
..add(r'verified')
..add(serializers.serialize(object.verified,
specifiedType: const FullType(bool)));
}
if (object.videos != null) {
result
..add(r'videos')
..add(serializers.serialize(object.videos,
specifiedType: const FullType(int)));
}
return result;
}
@override
ChannelItem deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) {
final result = ChannelItemBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current as String;
iterator.moveNext();
final Object? value = iterator.current;
switch (key) {
case r'description':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.description = valueDes;
break;
case r'name':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.name = valueDes;
break;
case r'subscribers':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.subscribers = valueDes;
break;
case r'thumbnail':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.thumbnail = valueDes;
break;
case r'url':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.url = valueDes;
break;
case r'verified':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
result.verified = valueDes;
break;
case r'videos':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.videos = valueDes;
break;
}
}
return result.build();
}
}

View file

@ -0,0 +1,163 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'channel_item.dart';
// **************************************************************************
// BuiltValueGenerator
// **************************************************************************
class _$ChannelItem extends ChannelItem {
@override
final String? description;
@override
final String? name;
@override
final int? subscribers;
@override
final String? thumbnail;
@override
final String? url;
@override
final bool? verified;
@override
final int? videos;
factory _$ChannelItem([void Function(ChannelItemBuilder)? updates]) =>
(new ChannelItemBuilder()..update(updates)).build();
_$ChannelItem._(
{this.description,
this.name,
this.subscribers,
this.thumbnail,
this.url,
this.verified,
this.videos})
: super._();
@override
ChannelItem rebuild(void Function(ChannelItemBuilder) updates) =>
(toBuilder()..update(updates)).build();
@override
ChannelItemBuilder toBuilder() => new ChannelItemBuilder()..replace(this);
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is ChannelItem &&
description == other.description &&
name == other.name &&
subscribers == other.subscribers &&
thumbnail == other.thumbnail &&
url == other.url &&
verified == other.verified &&
videos == other.videos;
}
@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));
}
@override
String toString() {
return (newBuiltValueToStringHelper('ChannelItem')
..add('description', description)
..add('name', name)
..add('subscribers', subscribers)
..add('thumbnail', thumbnail)
..add('url', url)
..add('verified', verified)
..add('videos', videos))
.toString();
}
}
class ChannelItemBuilder implements Builder<ChannelItem, ChannelItemBuilder> {
_$ChannelItem? _$v;
String? _description;
String? get description => _$this._description;
set description(String? description) => _$this._description = description;
String? _name;
String? get name => _$this._name;
set name(String? name) => _$this._name = name;
int? _subscribers;
int? get subscribers => _$this._subscribers;
set subscribers(int? subscribers) => _$this._subscribers = subscribers;
String? _thumbnail;
String? get thumbnail => _$this._thumbnail;
set thumbnail(String? thumbnail) => _$this._thumbnail = thumbnail;
String? _url;
String? get url => _$this._url;
set url(String? url) => _$this._url = url;
bool? _verified;
bool? get verified => _$this._verified;
set verified(bool? verified) => _$this._verified = verified;
int? _videos;
int? get videos => _$this._videos;
set videos(int? videos) => _$this._videos = videos;
ChannelItemBuilder() {
ChannelItem._defaults(this);
}
ChannelItemBuilder get _$this {
final $v = _$v;
if ($v != null) {
_description = $v.description;
_name = $v.name;
_subscribers = $v.subscribers;
_thumbnail = $v.thumbnail;
_url = $v.url;
_verified = $v.verified;
_videos = $v.videos;
_$v = null;
}
return this;
}
@override
void replace(ChannelItem other) {
ArgumentError.checkNotNull(other, 'other');
_$v = other as _$ChannelItem;
}
@override
void update(void Function(ChannelItemBuilder)? updates) {
if (updates != null) updates(this);
}
@override
_$ChannelItem build() {
final _$result = _$v ??
new _$ChannelItem._(
description: description,
name: name,
subscribers: subscribers,
thumbnail: thumbnail,
url: url,
verified: verified,
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,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new

View file

@ -0,0 +1,120 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
part 'playlist_item.g.dart';
/// PlaylistItem
///
/// Properties:
/// * [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.
abstract class PlaylistItem implements Built<PlaylistItem, PlaylistItemBuilder> {
/// The name of the playlist.
@BuiltValueField(wireName: r'name')
String? get name;
/// The thumbnail of the playlist.
@BuiltValueField(wireName: r'thumbnail')
String? get thumbnail;
/// The relative URL of the playlist.
@BuiltValueField(wireName: r'url')
String? get url;
/// The number of videos in the playlist.
@BuiltValueField(wireName: r'videos')
int? get videos;
PlaylistItem._();
@BuiltValueHook(initializeBuilder: true)
static void _defaults(PlaylistItemBuilder b) => b;
factory PlaylistItem([void updates(PlaylistItemBuilder b)]) = _$PlaylistItem;
@BuiltValueSerializer(custom: true)
static Serializer<PlaylistItem> get serializer => _$PlaylistItemSerializer();
}
class _$PlaylistItemSerializer implements StructuredSerializer<PlaylistItem> {
@override
final Iterable<Type> types = const [PlaylistItem, _$PlaylistItem];
@override
final String wireName = r'PlaylistItem';
@override
Iterable<Object?> serialize(Serializers serializers, PlaylistItem object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[];
if (object.name != null) {
result
..add(r'name')
..add(serializers.serialize(object.name,
specifiedType: const FullType(String)));
}
if (object.thumbnail != null) {
result
..add(r'thumbnail')
..add(serializers.serialize(object.thumbnail,
specifiedType: const FullType(String)));
}
if (object.url != null) {
result
..add(r'url')
..add(serializers.serialize(object.url,
specifiedType: const FullType(String)));
}
if (object.videos != null) {
result
..add(r'videos')
..add(serializers.serialize(object.videos,
specifiedType: const FullType(int)));
}
return result;
}
@override
PlaylistItem deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) {
final result = PlaylistItemBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current as String;
iterator.moveNext();
final Object? value = iterator.current;
switch (key) {
case r'name':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.name = valueDes;
break;
case r'thumbnail':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.thumbnail = valueDes;
break;
case r'url':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.url = valueDes;
break;
case r'videos':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.videos = valueDes;
break;
}
}
return result.build();
}
}

View file

@ -0,0 +1,117 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'playlist_item.dart';
// **************************************************************************
// BuiltValueGenerator
// **************************************************************************
class _$PlaylistItem extends PlaylistItem {
@override
final String? name;
@override
final String? thumbnail;
@override
final String? url;
@override
final int? videos;
factory _$PlaylistItem([void Function(PlaylistItemBuilder)? updates]) =>
(new PlaylistItemBuilder()..update(updates)).build();
_$PlaylistItem._({this.name, this.thumbnail, this.url, this.videos})
: super._();
@override
PlaylistItem rebuild(void Function(PlaylistItemBuilder) updates) =>
(toBuilder()..update(updates)).build();
@override
PlaylistItemBuilder toBuilder() => new PlaylistItemBuilder()..replace(this);
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is PlaylistItem &&
name == other.name &&
thumbnail == other.thumbnail &&
url == other.url &&
videos == other.videos;
}
@override
int get hashCode {
return $jf($jc(
$jc($jc($jc(0, name.hashCode), thumbnail.hashCode), url.hashCode),
videos.hashCode));
}
@override
String toString() {
return (newBuiltValueToStringHelper('PlaylistItem')
..add('name', name)
..add('thumbnail', thumbnail)
..add('url', url)
..add('videos', videos))
.toString();
}
}
class PlaylistItemBuilder
implements Builder<PlaylistItem, PlaylistItemBuilder> {
_$PlaylistItem? _$v;
String? _name;
String? get name => _$this._name;
set name(String? name) => _$this._name = name;
String? _thumbnail;
String? get thumbnail => _$this._thumbnail;
set thumbnail(String? thumbnail) => _$this._thumbnail = thumbnail;
String? _url;
String? get url => _$this._url;
set url(String? url) => _$this._url = url;
int? _videos;
int? get videos => _$this._videos;
set videos(int? videos) => _$this._videos = videos;
PlaylistItemBuilder() {
PlaylistItem._defaults(this);
}
PlaylistItemBuilder get _$this {
final $v = _$v;
if ($v != null) {
_name = $v.name;
_thumbnail = $v.thumbnail;
_url = $v.url;
_videos = $v.videos;
_$v = null;
}
return this;
}
@override
void replace(PlaylistItem other) {
ArgumentError.checkNotNull(other, 'other');
_$v = other as _$PlaylistItem;
}
@override
void update(void Function(PlaylistItemBuilder)? updates) {
if (updates != null) updates(this);
}
@override
_$PlaylistItem build() {
final _$result = _$v ??
new _$PlaylistItem._(
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,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new

View file

@ -0,0 +1,45 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
part 'search_filter.g.dart';
class SearchFilter extends EnumClass {
@BuiltValueEnumConst(wireName: r'all')
static const SearchFilter all = _$all;
@BuiltValueEnumConst(wireName: r'videos')
static const SearchFilter videos = _$videos;
@BuiltValueEnumConst(wireName: r'channels')
static const SearchFilter channels = _$channels;
@BuiltValueEnumConst(wireName: r'playlists')
static const SearchFilter playlists = _$playlists;
@BuiltValueEnumConst(wireName: r'music_songs')
static const SearchFilter musicSongs = _$musicSongs;
@BuiltValueEnumConst(wireName: r'music_videos')
static const SearchFilter musicVideos = _$musicVideos;
@BuiltValueEnumConst(wireName: r'music_albums')
static const SearchFilter musicAlbums = _$musicAlbums;
@BuiltValueEnumConst(wireName: r'music_playlists')
static const SearchFilter musicPlaylists = _$musicPlaylists;
static Serializer<SearchFilter> get serializer => _$searchFilterSerializer;
const SearchFilter._(String name): super(name);
static BuiltSet<SearchFilter> get values => _$values;
static SearchFilter valueOf(String name) => _$valueOf(name);
}
/// Optionally, enum_class can generate a mixin to go with your enum for use
/// with Angular. It exposes your enum constants as getters. So, if you mix it
/// in to your Dart component class, the values become available to the
/// corresponding Angular template.
///
/// Trigger mixin generation by writing a line like this one next to your enum.
abstract class SearchFilterMixin = Object with _$SearchFilterMixin;

View file

@ -0,0 +1,114 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'search_filter.dart';
// **************************************************************************
// BuiltValueGenerator
// **************************************************************************
const SearchFilter _$all = const SearchFilter._('all');
const SearchFilter _$videos = const SearchFilter._('videos');
const SearchFilter _$channels = const SearchFilter._('channels');
const SearchFilter _$playlists = const SearchFilter._('playlists');
const SearchFilter _$musicSongs = const SearchFilter._('musicSongs');
const SearchFilter _$musicVideos = const SearchFilter._('musicVideos');
const SearchFilter _$musicAlbums = const SearchFilter._('musicAlbums');
const SearchFilter _$musicPlaylists = const SearchFilter._('musicPlaylists');
SearchFilter _$valueOf(String name) {
switch (name) {
case 'all':
return _$all;
case 'videos':
return _$videos;
case 'channels':
return _$channels;
case 'playlists':
return _$playlists;
case 'musicSongs':
return _$musicSongs;
case 'musicVideos':
return _$musicVideos;
case 'musicAlbums':
return _$musicAlbums;
case 'musicPlaylists':
return _$musicPlaylists;
default:
throw new ArgumentError(name);
}
}
final BuiltSet<SearchFilter> _$values =
new BuiltSet<SearchFilter>(const <SearchFilter>[
_$all,
_$videos,
_$channels,
_$playlists,
_$musicSongs,
_$musicVideos,
_$musicAlbums,
_$musicPlaylists,
]);
class _$SearchFilterMeta {
const _$SearchFilterMeta();
SearchFilter get all => _$all;
SearchFilter get videos => _$videos;
SearchFilter get channels => _$channels;
SearchFilter get playlists => _$playlists;
SearchFilter get musicSongs => _$musicSongs;
SearchFilter get musicVideos => _$musicVideos;
SearchFilter get musicAlbums => _$musicAlbums;
SearchFilter get musicPlaylists => _$musicPlaylists;
SearchFilter valueOf(String name) => _$valueOf(name);
BuiltSet<SearchFilter> get values => _$values;
}
abstract class _$SearchFilterMixin {
// ignore: non_constant_identifier_names
_$SearchFilterMeta get SearchFilter => const _$SearchFilterMeta();
}
Serializer<SearchFilter> _$searchFilterSerializer =
new _$SearchFilterSerializer();
class _$SearchFilterSerializer implements PrimitiveSerializer<SearchFilter> {
static const Map<String, Object> _toWire = const <String, Object>{
'all': 'all',
'videos': 'videos',
'channels': 'channels',
'playlists': 'playlists',
'musicSongs': 'music_songs',
'musicVideos': 'music_videos',
'musicAlbums': 'music_albums',
'musicPlaylists': 'music_playlists',
};
static const Map<Object, String> _fromWire = const <Object, String>{
'all': 'all',
'videos': 'videos',
'channels': 'channels',
'playlists': 'playlists',
'music_songs': 'musicSongs',
'music_videos': 'musicVideos',
'music_albums': 'musicAlbums',
'music_playlists': 'musicPlaylists',
};
@override
final Iterable<Type> types = const <Type>[SearchFilter];
@override
final String wireName = 'SearchFilter';
@override
Object serialize(Serializers serializers, SearchFilter object,
{FullType specifiedType = FullType.unspecified}) =>
_toWire[object.name] ?? object.name;
@override
SearchFilter deserialize(Serializers serializers, Object serialized,
{FullType specifiedType = FullType.unspecified}) =>
SearchFilter.valueOf(
_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,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new

View file

@ -0,0 +1,309 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
import 'package:piped_api/src/model/stream_item.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';
part 'search_item.g.dart';
/// SearchItem
///
/// Properties:
/// * [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.
/// * [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.
abstract class SearchItem implements Built<SearchItem, SearchItemBuilder> {
/// The duration of the video in seconds.
@BuiltValueField(wireName: r'duration')
int get duration;
/// The thumbnail of the playlist.
@BuiltValueField(wireName: r'thumbnail')
String get thumbnail;
/// The title of the video.
@BuiltValueField(wireName: r'title')
String get title;
/// The date in unix epoch the video was uploaded.
@BuiltValueField(wireName: r'uploaded')
int? get uploaded;
/// The relative date the video was uploaded on.
@BuiltValueField(wireName: r'uploadedDate')
String? get uploadedDate;
/// The avatar of the channel of the video.
@BuiltValueField(wireName: r'uploaderAvatar')
String? get uploaderAvatar;
/// The name of the channel of the video.
@BuiltValueField(wireName: r'uploaderName')
String? get uploaderName;
/// The relative URL of the channel of the video.
@BuiltValueField(wireName: r'uploaderUrl')
String? get uploaderUrl;
/// Whether or not the channel has a verified badge.
@BuiltValueField(wireName: r'uploaderVerified')
bool? get uploaderVerified;
/// The relative URL of the playlist.
@BuiltValueField(wireName: r'url')
String get url;
/// The number of views the video has.
@BuiltValueField(wireName: r'views')
int? get views;
/// The description of the channel.
@BuiltValueField(wireName: r'description')
String? get description;
/// The name of the playlist.
@BuiltValueField(wireName: r'name')
String? get name;
/// The number of subscribers the channel has.
@BuiltValueField(wireName: r'subscribers')
int? get subscribers;
/// Whether the channel is verified.
@BuiltValueField(wireName: r'verified')
bool? get verified;
/// The number of videos in the playlist.
@BuiltValueField(wireName: r'videos')
int? get videos;
SearchItem._();
@BuiltValueHook(initializeBuilder: true)
static void _defaults(SearchItemBuilder b) => b;
factory SearchItem([void updates(SearchItemBuilder b)]) = _$SearchItem;
@BuiltValueSerializer(custom: true)
static Serializer<SearchItem> get serializer => _$SearchItemSerializer();
}
class _$SearchItemSerializer implements StructuredSerializer<SearchItem> {
@override
final Iterable<Type> types = const [SearchItem, _$SearchItem];
@override
final String wireName = r'SearchItem';
@override
Iterable<Object?> serialize(Serializers serializers, SearchItem object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[];
result
..add(r'duration')
..add(serializers.serialize(object.duration,
specifiedType: const FullType(int)));
result
..add(r'thumbnail')
..add(serializers.serialize(object.thumbnail,
specifiedType: const FullType(String)));
result
..add(r'title')
..add(serializers.serialize(object.title,
specifiedType: const FullType(String)));
if (object.uploaded != null) {
result
..add(r'uploaded')
..add(serializers.serialize(object.uploaded,
specifiedType: const FullType(int)));
}
if (object.uploadedDate != null) {
result
..add(r'uploadedDate')
..add(serializers.serialize(object.uploadedDate,
specifiedType: const FullType.nullable(String)));
}
if (object.uploaderAvatar != null) {
result
..add(r'uploaderAvatar')
..add(serializers.serialize(object.uploaderAvatar,
specifiedType: const FullType.nullable(String)));
}
if (object.uploaderName != null) {
result
..add(r'uploaderName')
..add(serializers.serialize(object.uploaderName,
specifiedType: const FullType(String)));
}
if (object.uploaderUrl != null) {
result
..add(r'uploaderUrl')
..add(serializers.serialize(object.uploaderUrl,
specifiedType: const FullType(String)));
}
if (object.uploaderVerified != null) {
result
..add(r'uploaderVerified')
..add(serializers.serialize(object.uploaderVerified,
specifiedType: const FullType(bool)));
}
result
..add(r'url')
..add(serializers.serialize(object.url,
specifiedType: const FullType(String)));
if (object.views != null) {
result
..add(r'views')
..add(serializers.serialize(object.views,
specifiedType: const FullType(int)));
}
if (object.description != null) {
result
..add(r'description')
..add(serializers.serialize(object.description,
specifiedType: const FullType(String)));
}
if (object.name != null) {
result
..add(r'name')
..add(serializers.serialize(object.name,
specifiedType: const FullType(String)));
}
if (object.subscribers != null) {
result
..add(r'subscribers')
..add(serializers.serialize(object.subscribers,
specifiedType: const FullType(int)));
}
if (object.verified != null) {
result
..add(r'verified')
..add(serializers.serialize(object.verified,
specifiedType: const FullType(bool)));
}
if (object.videos != null) {
result
..add(r'videos')
..add(serializers.serialize(object.videos,
specifiedType: const FullType(int)));
}
return result;
}
@override
SearchItem deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) {
final result = SearchItemBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current as String;
iterator.moveNext();
final Object? value = iterator.current;
switch (key) {
case r'duration':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.duration = valueDes;
break;
case r'thumbnail':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.thumbnail = valueDes;
break;
case r'title':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.title = valueDes;
break;
case r'uploaded':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.uploaded = valueDes;
break;
case r'uploadedDate':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType.nullable(String)) as String?;
if (valueDes == null) continue;
result.uploadedDate = valueDes;
break;
case r'uploaderAvatar':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType.nullable(String)) as String?;
if (valueDes == null) continue;
result.uploaderAvatar = valueDes;
break;
case r'uploaderName':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.uploaderName = valueDes;
break;
case r'uploaderUrl':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.uploaderUrl = valueDes;
break;
case r'uploaderVerified':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
result.uploaderVerified = valueDes;
break;
case r'url':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.url = valueDes;
break;
case r'views':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.views = valueDes;
break;
case r'description':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.description = valueDes;
break;
case r'name':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.name = valueDes;
break;
case r'subscribers':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.subscribers = valueDes;
break;
case r'verified':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
result.verified = valueDes;
break;
case r'videos':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.videos = valueDes;
break;
}
}
return result.build();
}
}

View file

@ -0,0 +1,298 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'search_item.dart';
// **************************************************************************
// BuiltValueGenerator
// **************************************************************************
class _$SearchItem extends SearchItem {
@override
final int duration;
@override
final String thumbnail;
@override
final String title;
@override
final int? uploaded;
@override
final String? uploadedDate;
@override
final String? uploaderAvatar;
@override
final String? uploaderName;
@override
final String? uploaderUrl;
@override
final bool? uploaderVerified;
@override
final String url;
@override
final int? views;
@override
final String? description;
@override
final String? name;
@override
final int? subscribers;
@override
final bool? verified;
@override
final int? videos;
factory _$SearchItem([void Function(SearchItemBuilder)? updates]) =>
(new SearchItemBuilder()..update(updates)).build();
_$SearchItem._(
{required this.duration,
required this.thumbnail,
required this.title,
this.uploaded,
this.uploadedDate,
this.uploaderAvatar,
this.uploaderName,
this.uploaderUrl,
this.uploaderVerified,
required this.url,
this.views,
this.description,
this.name,
this.subscribers,
this.verified,
this.videos})
: super._() {
BuiltValueNullFieldError.checkNotNull(duration, 'SearchItem', 'duration');
BuiltValueNullFieldError.checkNotNull(thumbnail, 'SearchItem', 'thumbnail');
BuiltValueNullFieldError.checkNotNull(title, 'SearchItem', 'title');
BuiltValueNullFieldError.checkNotNull(url, 'SearchItem', 'url');
}
@override
SearchItem rebuild(void Function(SearchItemBuilder) updates) =>
(toBuilder()..update(updates)).build();
@override
SearchItemBuilder toBuilder() => new SearchItemBuilder()..replace(this);
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is SearchItem &&
duration == other.duration &&
thumbnail == other.thumbnail &&
title == other.title &&
uploaded == other.uploaded &&
uploadedDate == other.uploadedDate &&
uploaderAvatar == other.uploaderAvatar &&
uploaderName == other.uploaderName &&
uploaderUrl == other.uploaderUrl &&
uploaderVerified == other.uploaderVerified &&
url == other.url &&
views == other.views &&
description == other.description &&
name == other.name &&
subscribers == other.subscribers &&
verified == other.verified &&
videos == other.videos;
}
@override
int get hashCode {
return $jf($jc(
$jc(
$jc(
$jc(
$jc(
$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),
description.hashCode),
name.hashCode),
subscribers.hashCode),
verified.hashCode),
videos.hashCode));
}
@override
String toString() {
return (newBuiltValueToStringHelper('SearchItem')
..add('duration', duration)
..add('thumbnail', thumbnail)
..add('title', title)
..add('uploaded', uploaded)
..add('uploadedDate', uploadedDate)
..add('uploaderAvatar', uploaderAvatar)
..add('uploaderName', uploaderName)
..add('uploaderUrl', uploaderUrl)
..add('uploaderVerified', uploaderVerified)
..add('url', url)
..add('views', views)
..add('description', description)
..add('name', name)
..add('subscribers', subscribers)
..add('verified', verified)
..add('videos', videos))
.toString();
}
}
class SearchItemBuilder implements Builder<SearchItem, SearchItemBuilder> {
_$SearchItem? _$v;
int? _duration;
int? get duration => _$this._duration;
set duration(int? duration) => _$this._duration = duration;
String? _thumbnail;
String? get thumbnail => _$this._thumbnail;
set thumbnail(String? thumbnail) => _$this._thumbnail = thumbnail;
String? _title;
String? get title => _$this._title;
set title(String? title) => _$this._title = title;
int? _uploaded;
int? get uploaded => _$this._uploaded;
set uploaded(int? uploaded) => _$this._uploaded = uploaded;
String? _uploadedDate;
String? get uploadedDate => _$this._uploadedDate;
set uploadedDate(String? uploadedDate) => _$this._uploadedDate = uploadedDate;
String? _uploaderAvatar;
String? get uploaderAvatar => _$this._uploaderAvatar;
set uploaderAvatar(String? uploaderAvatar) =>
_$this._uploaderAvatar = uploaderAvatar;
String? _uploaderName;
String? get uploaderName => _$this._uploaderName;
set uploaderName(String? uploaderName) => _$this._uploaderName = uploaderName;
String? _uploaderUrl;
String? get uploaderUrl => _$this._uploaderUrl;
set uploaderUrl(String? uploaderUrl) => _$this._uploaderUrl = uploaderUrl;
bool? _uploaderVerified;
bool? get uploaderVerified => _$this._uploaderVerified;
set uploaderVerified(bool? uploaderVerified) =>
_$this._uploaderVerified = uploaderVerified;
String? _url;
String? get url => _$this._url;
set url(String? url) => _$this._url = url;
int? _views;
int? get views => _$this._views;
set views(int? views) => _$this._views = views;
String? _description;
String? get description => _$this._description;
set description(String? description) => _$this._description = description;
String? _name;
String? get name => _$this._name;
set name(String? name) => _$this._name = name;
int? _subscribers;
int? get subscribers => _$this._subscribers;
set subscribers(int? subscribers) => _$this._subscribers = subscribers;
bool? _verified;
bool? get verified => _$this._verified;
set verified(bool? verified) => _$this._verified = verified;
int? _videos;
int? get videos => _$this._videos;
set videos(int? videos) => _$this._videos = videos;
SearchItemBuilder() {
SearchItem._defaults(this);
}
SearchItemBuilder get _$this {
final $v = _$v;
if ($v != null) {
_duration = $v.duration;
_thumbnail = $v.thumbnail;
_title = $v.title;
_uploaded = $v.uploaded;
_uploadedDate = $v.uploadedDate;
_uploaderAvatar = $v.uploaderAvatar;
_uploaderName = $v.uploaderName;
_uploaderUrl = $v.uploaderUrl;
_uploaderVerified = $v.uploaderVerified;
_url = $v.url;
_views = $v.views;
_description = $v.description;
_name = $v.name;
_subscribers = $v.subscribers;
_verified = $v.verified;
_videos = $v.videos;
_$v = null;
}
return this;
}
@override
void replace(SearchItem other) {
ArgumentError.checkNotNull(other, 'other');
_$v = other as _$SearchItem;
}
@override
void update(void Function(SearchItemBuilder)? updates) {
if (updates != null) updates(this);
}
@override
_$SearchItem build() {
final _$result = _$v ??
new _$SearchItem._(
duration: BuiltValueNullFieldError.checkNotNull(
duration, 'SearchItem', 'duration'),
thumbnail: BuiltValueNullFieldError.checkNotNull(
thumbnail, 'SearchItem', 'thumbnail'),
title: BuiltValueNullFieldError.checkNotNull(
title, 'SearchItem', 'title'),
uploaded: uploaded,
uploadedDate: uploadedDate,
uploaderAvatar: uploaderAvatar,
uploaderName: uploaderName,
uploaderUrl: uploaderUrl,
uploaderVerified: uploaderVerified,
url:
BuiltValueNullFieldError.checkNotNull(url, 'SearchItem', 'url'),
views: views,
description: description,
name: name,
subscribers: subscribers,
verified: verified,
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,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new

View file

@ -0,0 +1,123 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
import 'package:built_collection/built_collection.dart';
import 'package:piped_api/src/model/search_item.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
part 'search_page.g.dart';
/// SearchPage
///
/// Properties:
/// * [corrected] - Whether the search query was corrected.
/// * [items]
/// * [nextpage] - The parameter used to get the next page of this page.
/// * [suggestion] - The suggested search query.
abstract class SearchPage implements Built<SearchPage, SearchPageBuilder> {
/// Whether the search query was corrected.
@BuiltValueField(wireName: r'corrected')
bool? get corrected;
@BuiltValueField(wireName: r'items')
BuiltList<SearchItem>? get items;
/// The parameter used to get the next page of this page.
@BuiltValueField(wireName: r'nextpage')
String? get nextpage;
/// The suggested search query.
@BuiltValueField(wireName: r'suggestion')
String? get suggestion;
SearchPage._();
@BuiltValueHook(initializeBuilder: true)
static void _defaults(SearchPageBuilder b) => b;
factory SearchPage([void updates(SearchPageBuilder b)]) = _$SearchPage;
@BuiltValueSerializer(custom: true)
static Serializer<SearchPage> get serializer => _$SearchPageSerializer();
}
class _$SearchPageSerializer implements StructuredSerializer<SearchPage> {
@override
final Iterable<Type> types = const [SearchPage, _$SearchPage];
@override
final String wireName = r'SearchPage';
@override
Iterable<Object?> serialize(Serializers serializers, SearchPage object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[];
if (object.corrected != null) {
result
..add(r'corrected')
..add(serializers.serialize(object.corrected,
specifiedType: const FullType(bool)));
}
if (object.items != null) {
result
..add(r'items')
..add(serializers.serialize(object.items,
specifiedType: const FullType(BuiltList, [FullType(SearchItem)])));
}
if (object.nextpage != null) {
result
..add(r'nextpage')
..add(serializers.serialize(object.nextpage,
specifiedType: const FullType.nullable(String)));
}
if (object.suggestion != null) {
result
..add(r'suggestion')
..add(serializers.serialize(object.suggestion,
specifiedType: const FullType.nullable(String)));
}
return result;
}
@override
SearchPage deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) {
final result = SearchPageBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current as String;
iterator.moveNext();
final Object? value = iterator.current;
switch (key) {
case r'corrected':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
result.corrected = valueDes;
break;
case r'items':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(BuiltList, [FullType(SearchItem)])) as BuiltList<SearchItem>;
result.items.replace(valueDes);
break;
case r'nextpage':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType.nullable(String)) as String?;
if (valueDes == null) continue;
result.nextpage = valueDes;
break;
case r'suggestion':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType.nullable(String)) as String?;
if (valueDes == null) continue;
result.suggestion = valueDes;
break;
}
}
return result.build();
}
}

View file

@ -0,0 +1,133 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'search_page.dart';
// **************************************************************************
// BuiltValueGenerator
// **************************************************************************
class _$SearchPage extends SearchPage {
@override
final bool? corrected;
@override
final BuiltList<SearchItem>? items;
@override
final String? nextpage;
@override
final String? suggestion;
factory _$SearchPage([void Function(SearchPageBuilder)? updates]) =>
(new SearchPageBuilder()..update(updates)).build();
_$SearchPage._({this.corrected, this.items, this.nextpage, this.suggestion})
: super._();
@override
SearchPage rebuild(void Function(SearchPageBuilder) updates) =>
(toBuilder()..update(updates)).build();
@override
SearchPageBuilder toBuilder() => new SearchPageBuilder()..replace(this);
@override
bool operator ==(Object other) {
if (identical(other, this)) return true;
return other is SearchPage &&
corrected == other.corrected &&
items == other.items &&
nextpage == other.nextpage &&
suggestion == other.suggestion;
}
@override
int get hashCode {
return $jf($jc(
$jc($jc($jc(0, corrected.hashCode), items.hashCode), nextpage.hashCode),
suggestion.hashCode));
}
@override
String toString() {
return (newBuiltValueToStringHelper('SearchPage')
..add('corrected', corrected)
..add('items', items)
..add('nextpage', nextpage)
..add('suggestion', suggestion))
.toString();
}
}
class SearchPageBuilder implements Builder<SearchPage, SearchPageBuilder> {
_$SearchPage? _$v;
bool? _corrected;
bool? get corrected => _$this._corrected;
set corrected(bool? corrected) => _$this._corrected = corrected;
ListBuilder<SearchItem>? _items;
ListBuilder<SearchItem> get items =>
_$this._items ??= new ListBuilder<SearchItem>();
set items(ListBuilder<SearchItem>? items) => _$this._items = items;
String? _nextpage;
String? get nextpage => _$this._nextpage;
set nextpage(String? nextpage) => _$this._nextpage = nextpage;
String? _suggestion;
String? get suggestion => _$this._suggestion;
set suggestion(String? suggestion) => _$this._suggestion = suggestion;
SearchPageBuilder() {
SearchPage._defaults(this);
}
SearchPageBuilder get _$this {
final $v = _$v;
if ($v != null) {
_corrected = $v.corrected;
_items = $v.items?.toBuilder();
_nextpage = $v.nextpage;
_suggestion = $v.suggestion;
_$v = null;
}
return this;
}
@override
void replace(SearchPage other) {
ArgumentError.checkNotNull(other, 'other');
_$v = other as _$SearchPage;
}
@override
void update(void Function(SearchPageBuilder)? updates) {
if (updates != null) updates(this);
}
@override
_$SearchPage build() {
_$SearchPage _$result;
try {
_$result = _$v ??
new _$SearchPage._(
corrected: corrected,
items: _items?.build(),
nextpage: nextpage,
suggestion: suggestion);
} catch (_) {
late String _$failedField;
try {
_$failedField = 'items';
_items?.build();
} catch (e) {
throw new BuiltValueNestedFieldError(
'SearchPage', _$failedField, e.toString());
}
rethrow;
}
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,omit_local_variable_types,prefer_expression_function_bodies,sort_constructors_first,test_types_in_equals,unnecessary_const,unnecessary_new

View file

@ -13,10 +13,15 @@ import 'package:piped_api/src/date_serializer.dart';
import 'package:piped_api/src/model/date.dart';
import 'package:piped_api/src/model/channel_info.dart';
import 'package:piped_api/src/model/channel_item.dart';
import 'package:piped_api/src/model/comment.dart';
import 'package:piped_api/src/model/comments_page.dart';
import 'package:piped_api/src/model/exception_error.dart';
import 'package:piped_api/src/model/playlist_item.dart';
import 'package:piped_api/src/model/regions.dart';
import 'package:piped_api/src/model/search_filter.dart';
import 'package:piped_api/src/model/search_item.dart';
import 'package:piped_api/src/model/search_page.dart';
import 'package:piped_api/src/model/stream.dart';
import 'package:piped_api/src/model/stream_item.dart';
import 'package:piped_api/src/model/streams_page.dart';
@ -27,10 +32,15 @@ part 'serializers.g.dart';
@SerializersFor([
ChannelInfo,
ChannelItem,
Comment,
CommentsPage,
ExceptionError,
PlaylistItem,
Regions,
SearchFilter,
SearchItem,
SearchPage,
Stream,
StreamItem,
StreamsPage,

View file

@ -8,10 +8,15 @@ part of 'serializers.dart';
Serializers _$serializers = (new Serializers().toBuilder()
..add(ChannelInfo.serializer)
..add(ChannelItem.serializer)
..add(Comment.serializer)
..add(CommentsPage.serializer)
..add(ExceptionError.serializer)
..add(PlaylistItem.serializer)
..add(Regions.serializer)
..add(SearchFilter.serializer)
..add(SearchItem.serializer)
..add(SearchPage.serializer)
..add(Stream.serializer)
..add(StreamFormatEnum.serializer)
..add(StreamItem.serializer)
@ -21,6 +26,9 @@ Serializers _$serializers = (new Serializers().toBuilder()
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(Comment)]),
() => new ListBuilder<Comment>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(SearchItem)]),
() => new ListBuilder<SearchItem>())
..addBuilderFactory(
const FullType(BuiltList, const [const FullType(Stream)]),
() => new ListBuilder<Stream>())

View file

@ -0,0 +1,53 @@
import 'package:test/test.dart';
import 'package:piped_api/piped_api.dart';
// tests for ChannelItem
void main() {
final instance = ChannelItemBuilder();
// TODO add properties to the builder and call build()
group(ChannelItem, () {
// The description of the channel.
// String description
test('to test the property `description`', () async {
// TODO
});
// The name of the channel.
// 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
});
// The thumbnail of the channel.
// String thumbnail
test('to test the property `thumbnail`', () async {
// TODO
});
// The relative URL of the channel.
// String url
test('to test the property `url`', () async {
// TODO
});
// Whether the channel is verified.
// bool verified
test('to test the property `verified`', () async {
// TODO
});
// The number of videos the channel has.
// int videos
test('to test the property `videos`', () async {
// TODO
});
});
}

View file

@ -0,0 +1,35 @@
import 'package:test/test.dart';
import 'package:piped_api/piped_api.dart';
// tests for PlaylistItem
void main() {
final instance = PlaylistItemBuilder();
// TODO add properties to the builder and call build()
group(PlaylistItem, () {
// The name of the playlist.
// String name
test('to test the property `name`', () async {
// TODO
});
// The thumbnail of the playlist.
// String thumbnail
test('to test the property `thumbnail`', () async {
// TODO
});
// The relative URL of the playlist.
// String url
test('to test the property `url`', () async {
// TODO
});
// The number of videos in the playlist.
// int videos
test('to test the property `videos`', () async {
// TODO
});
});
}

View file

@ -0,0 +1,9 @@
import 'package:test/test.dart';
import 'package:piped_api/piped_api.dart';
// tests for SearchFilter
void main() {
group(SearchFilter, () {
});
}

107
test/search_item_test.dart Normal file
View file

@ -0,0 +1,107 @@
import 'package:test/test.dart';
import 'package:piped_api/piped_api.dart';
// tests for SearchItem
void main() {
final instance = SearchItemBuilder();
// TODO add properties to the builder and call build()
group(SearchItem, () {
// 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
});
// 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

@ -0,0 +1,34 @@
import 'package:test/test.dart';
import 'package:piped_api/piped_api.dart';
// tests for SearchPage
void main() {
final instance = SearchPageBuilder();
// TODO add properties to the builder and call build()
group(SearchPage, () {
// Whether the search query was corrected.
// bool corrected
test('to test the property `corrected`', () async {
// TODO
});
// BuiltList<SearchItem> items
test('to test the property `items`', () async {
// TODO
});
// The parameter used to get the next page of this page.
// String nextpage
test('to test the property `nextpage`', () async {
// TODO
});
// The suggested search query.
// String suggestion
test('to test the property `suggestion`', () async {
// TODO
});
});
}