This commit is contained in:
FireMasterK 2022-02-07 13:25:54 +00:00
parent a8612fdad7
commit 8097805f0e
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
9 changed files with 484 additions and 8 deletions

View File

@ -1,5 +1,4 @@
.gitignore
.openapi-generator-ignore
README.md
analysis_options.yaml
doc/ChannelInfo.md
@ -7,6 +6,7 @@ doc/ExceptionError.md
doc/Regions.md
doc/Stream.md
doc/StreamItem.md
doc/Subtitle.md
doc/UnauthenticatedApi.md
doc/VideoInfo.md
lib/piped_api.dart
@ -25,13 +25,7 @@ lib/src/model/exception_error.dart
lib/src/model/regions.dart
lib/src/model/stream.dart
lib/src/model/stream_item.dart
lib/src/model/subtitle.dart
lib/src/model/video_info.dart
lib/src/serializers.dart
pubspec.yaml
test/channel_info_test.dart
test/exception_error_test.dart
test/regions_test.dart
test/stream_item_test.dart
test/stream_test.dart
test/unauthenticated_api_test.dart
test/video_info_test.dart

View File

@ -79,6 +79,7 @@ Class | Method | HTTP request | Description
- [Regions](doc/Regions.md)
- [Stream](doc/Stream.md)
- [StreamItem](doc/StreamItem.md)
- [Subtitle](doc/Subtitle.md)
- [VideoInfo](doc/VideoInfo.md)

18
doc/Subtitle.md Normal file
View File

@ -0,0 +1,18 @@
# piped_api.model.Subtitle
## Load the model package
```dart
import 'package:piped_api/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**autoGenerated** | **bool** | Whether the subtitle is auto generated. | [optional]
**code** | **String** | The language code of the subtitle. | [optional]
**mimeType** | **String** | The mime type of the subtitle. | [optional]
**url** | **String** | The URL of the subtitle. | [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

@ -9,6 +9,24 @@ import 'package:piped_api/api.dart';
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**audioStreams** | [**BuiltList<Stream>**](Stream.md) | | [optional]
**videoStreams** | [**BuiltList<Stream>**](Stream.md) | | [optional]
**description** | **String** | The video's description. | [optional]
**dislikes** | **int** | The number of dislikes the video has. | [optional]
**duration** | **int** | The video's duration in seconds. | [optional]
**hls** | **String** | The stream of the video in a HLS manifest. | [optional]
**lbryId** | **String** | The LBRY ID of the video. | [optional]
**likes** | **int** | The number of likes the video has. | [optional]
**livestream** | **bool** | Whether the video is a livestream. | [optional]
**proxyUrl** | **String** | The base URL of the backend instance's proxy. | [optional]
**subtitles** | [**BuiltList<Subtitle>**](Subtitle.md) | | [optional]
**dash** | **String** | The URL of the DASH manifest. | [optional]
**thumbnailUrl** | **String** | The URL of the video's thumbnail. | [optional]
**title** | **String** | The video's title. | [optional]
**uploadDate** | **String** | The date the video was uploaded. | [optional]
**uploader** | **String** | The video's uploader. | [optional]
**uploaderAvatar** | **String** | The URL of the video's uploader's avatar. | [optional]
**uploaderUrl** | **String** | The relative URL of the video's uploader. | [optional]
**uploaderVerified** | **bool** | Whether the video's uploader is verified. | [optional]
**relatedStreams** | [**BuiltList<StreamItem>**](StreamItem.md) | | [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

@ -16,4 +16,5 @@ export 'package:piped_api/src/model/exception_error.dart';
export 'package:piped_api/src/model/regions.dart';
export 'package:piped_api/src/model/stream.dart';
export 'package:piped_api/src/model/stream_item.dart';
export 'package:piped_api/src/model/subtitle.dart';
export 'package:piped_api/src/model/video_info.dart';

120
lib/src/model/subtitle.dart Normal file
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 'subtitle.g.dart';
/// Subtitle
///
/// Properties:
/// * [autoGenerated] - Whether the subtitle is auto generated.
/// * [code] - The language code of the subtitle.
/// * [mimeType] - The mime type of the subtitle.
/// * [url] - The URL of the subtitle.
abstract class Subtitle implements Built<Subtitle, SubtitleBuilder> {
/// Whether the subtitle is auto generated.
@BuiltValueField(wireName: r'autoGenerated')
bool? get autoGenerated;
/// The language code of the subtitle.
@BuiltValueField(wireName: r'code')
String? get code;
/// The mime type of the subtitle.
@BuiltValueField(wireName: r'mimeType')
String? get mimeType;
/// The URL of the subtitle.
@BuiltValueField(wireName: r'url')
String? get url;
Subtitle._();
@BuiltValueHook(initializeBuilder: true)
static void _defaults(SubtitleBuilder b) => b;
factory Subtitle([void updates(SubtitleBuilder b)]) = _$Subtitle;
@BuiltValueSerializer(custom: true)
static Serializer<Subtitle> get serializer => _$SubtitleSerializer();
}
class _$SubtitleSerializer implements StructuredSerializer<Subtitle> {
@override
final Iterable<Type> types = const [Subtitle, _$Subtitle];
@override
final String wireName = r'Subtitle';
@override
Iterable<Object?> serialize(Serializers serializers, Subtitle object,
{FullType specifiedType = FullType.unspecified}) {
final result = <Object?>[];
if (object.autoGenerated != null) {
result
..add(r'autoGenerated')
..add(serializers.serialize(object.autoGenerated,
specifiedType: const FullType(bool)));
}
if (object.code != null) {
result
..add(r'code')
..add(serializers.serialize(object.code,
specifiedType: const FullType(String)));
}
if (object.mimeType != null) {
result
..add(r'mimeType')
..add(serializers.serialize(object.mimeType,
specifiedType: const FullType(String)));
}
if (object.url != null) {
result
..add(r'url')
..add(serializers.serialize(object.url,
specifiedType: const FullType(String)));
}
return result;
}
@override
Subtitle deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) {
final result = SubtitleBuilder();
final iterator = serialized.iterator;
while (iterator.moveNext()) {
final key = iterator.current as String;
iterator.moveNext();
final Object? value = iterator.current;
switch (key) {
case r'autoGenerated':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
result.autoGenerated = valueDes;
break;
case r'code':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.code = valueDes;
break;
case r'mimeType':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.mimeType = valueDes;
break;
case r'url':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.url = valueDes;
break;
}
}
return result.build();
}
}

View File

@ -5,6 +5,7 @@
import 'package:piped_api/src/model/stream_item.dart';
import 'package:built_collection/built_collection.dart';
import 'package:piped_api/src/model/stream.dart';
import 'package:piped_api/src/model/subtitle.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
@ -14,11 +15,99 @@ part 'video_info.g.dart';
///
/// Properties:
/// * [audioStreams]
/// * [videoStreams]
/// * [description] - The video's description.
/// * [dislikes] - The number of dislikes the video has.
/// * [duration] - The video's duration in seconds.
/// * [hls] - The stream of the video in a HLS manifest.
/// * [lbryId] - The LBRY ID of the video.
/// * [likes] - The number of likes the video has.
/// * [livestream] - Whether the video is a livestream.
/// * [proxyUrl] - The base URL of the backend instance's proxy.
/// * [subtitles]
/// * [dash] - The URL of the DASH manifest.
/// * [thumbnailUrl] - The URL of the video's thumbnail.
/// * [title] - The video's title.
/// * [uploadDate] - The date the video was uploaded.
/// * [uploader] - The video's uploader.
/// * [uploaderAvatar] - The URL of the video's uploader's avatar.
/// * [uploaderUrl] - The relative URL of the video's uploader.
/// * [uploaderVerified] - Whether the video's uploader is verified.
/// * [relatedStreams]
abstract class VideoInfo implements Built<VideoInfo, VideoInfoBuilder> {
@BuiltValueField(wireName: r'audioStreams')
BuiltList<Stream>? get audioStreams;
@BuiltValueField(wireName: r'videoStreams')
BuiltList<Stream>? get videoStreams;
/// The video's description.
@BuiltValueField(wireName: r'description')
String? get description;
/// The number of dislikes the video has.
@BuiltValueField(wireName: r'dislikes')
int? get dislikes;
/// The video's duration in seconds.
@BuiltValueField(wireName: r'duration')
int? get duration;
/// The stream of the video in a HLS manifest.
@BuiltValueField(wireName: r'hls')
String? get hls;
/// The LBRY ID of the video.
@BuiltValueField(wireName: r'lbryId')
String? get lbryId;
/// The number of likes the video has.
@BuiltValueField(wireName: r'likes')
int? get likes;
/// Whether the video is a livestream.
@BuiltValueField(wireName: r'livestream')
bool? get livestream;
/// The base URL of the backend instance's proxy.
@BuiltValueField(wireName: r'proxyUrl')
String? get proxyUrl;
@BuiltValueField(wireName: r'subtitles')
BuiltList<Subtitle>? get subtitles;
/// The URL of the DASH manifest.
@BuiltValueField(wireName: r'dash')
String? get dash;
/// The URL of the video's thumbnail.
@BuiltValueField(wireName: r'thumbnailUrl')
String? get thumbnailUrl;
/// The video's title.
@BuiltValueField(wireName: r'title')
String? get title;
/// The date the video was uploaded.
@BuiltValueField(wireName: r'uploadDate')
String? get uploadDate;
/// The video's uploader.
@BuiltValueField(wireName: r'uploader')
String? get uploader;
/// The URL of the video's uploader's avatar.
@BuiltValueField(wireName: r'uploaderAvatar')
String? get uploaderAvatar;
/// The relative URL of the video's uploader.
@BuiltValueField(wireName: r'uploaderUrl')
String? get uploaderUrl;
/// Whether the video's uploader is verified.
@BuiltValueField(wireName: r'uploaderVerified')
bool? get uploaderVerified;
@BuiltValueField(wireName: r'relatedStreams')
BuiltList<StreamItem>? get relatedStreams;
@ -50,6 +139,114 @@ class _$VideoInfoSerializer implements StructuredSerializer<VideoInfo> {
..add(serializers.serialize(object.audioStreams,
specifiedType: const FullType(BuiltList, [FullType(Stream)])));
}
if (object.videoStreams != null) {
result
..add(r'videoStreams')
..add(serializers.serialize(object.videoStreams,
specifiedType: const FullType(BuiltList, [FullType(Stream)])));
}
if (object.description != null) {
result
..add(r'description')
..add(serializers.serialize(object.description,
specifiedType: const FullType(String)));
}
if (object.dislikes != null) {
result
..add(r'dislikes')
..add(serializers.serialize(object.dislikes,
specifiedType: const FullType(int)));
}
if (object.duration != null) {
result
..add(r'duration')
..add(serializers.serialize(object.duration,
specifiedType: const FullType(int)));
}
if (object.hls != null) {
result
..add(r'hls')
..add(serializers.serialize(object.hls,
specifiedType: const FullType(String)));
}
if (object.lbryId != null) {
result
..add(r'lbryId')
..add(serializers.serialize(object.lbryId,
specifiedType: const FullType(String)));
}
if (object.likes != null) {
result
..add(r'likes')
..add(serializers.serialize(object.likes,
specifiedType: const FullType(int)));
}
if (object.livestream != null) {
result
..add(r'livestream')
..add(serializers.serialize(object.livestream,
specifiedType: const FullType(bool)));
}
if (object.proxyUrl != null) {
result
..add(r'proxyUrl')
..add(serializers.serialize(object.proxyUrl,
specifiedType: const FullType(String)));
}
if (object.subtitles != null) {
result
..add(r'subtitles')
..add(serializers.serialize(object.subtitles,
specifiedType: const FullType(BuiltList, [FullType(Subtitle)])));
}
if (object.dash != null) {
result
..add(r'dash')
..add(serializers.serialize(object.dash,
specifiedType: const FullType(String)));
}
if (object.thumbnailUrl != null) {
result
..add(r'thumbnailUrl')
..add(serializers.serialize(object.thumbnailUrl,
specifiedType: const FullType(String)));
}
if (object.title != null) {
result
..add(r'title')
..add(serializers.serialize(object.title,
specifiedType: const FullType(String)));
}
if (object.uploadDate != null) {
result
..add(r'uploadDate')
..add(serializers.serialize(object.uploadDate,
specifiedType: const FullType(String)));
}
if (object.uploader != null) {
result
..add(r'uploader')
..add(serializers.serialize(object.uploader,
specifiedType: const FullType(String)));
}
if (object.uploaderAvatar != null) {
result
..add(r'uploaderAvatar')
..add(serializers.serialize(object.uploaderAvatar,
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)));
}
if (object.relatedStreams != null) {
result
..add(r'relatedStreams')
@ -76,6 +273,96 @@ class _$VideoInfoSerializer implements StructuredSerializer<VideoInfo> {
specifiedType: const FullType(BuiltList, [FullType(Stream)])) as BuiltList<Stream>;
result.audioStreams.replace(valueDes);
break;
case r'videoStreams':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(BuiltList, [FullType(Stream)])) as BuiltList<Stream>;
result.videoStreams.replace(valueDes);
break;
case r'description':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.description = valueDes;
break;
case r'dislikes':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.dislikes = valueDes;
break;
case r'duration':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.duration = valueDes;
break;
case r'hls':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.hls = valueDes;
break;
case r'lbryId':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.lbryId = valueDes;
break;
case r'likes':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
result.likes = valueDes;
break;
case r'livestream':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
result.livestream = valueDes;
break;
case r'proxyUrl':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.proxyUrl = valueDes;
break;
case r'subtitles':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(BuiltList, [FullType(Subtitle)])) as BuiltList<Subtitle>;
result.subtitles.replace(valueDes);
break;
case r'dash':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.dash = valueDes;
break;
case r'thumbnailUrl':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.thumbnailUrl = valueDes;
break;
case r'title':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.title = valueDes;
break;
case r'uploadDate':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.uploadDate = valueDes;
break;
case r'uploader':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.uploader = valueDes;
break;
case r'uploaderAvatar':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
result.uploaderAvatar = 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'relatedStreams':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(BuiltList, [FullType(StreamItem)])) as BuiltList<StreamItem>;

View File

@ -17,6 +17,7 @@ import 'package:piped_api/src/model/exception_error.dart';
import 'package:piped_api/src/model/regions.dart';
import 'package:piped_api/src/model/stream.dart';
import 'package:piped_api/src/model/stream_item.dart';
import 'package:piped_api/src/model/subtitle.dart';
import 'package:piped_api/src/model/video_info.dart';
part 'serializers.g.dart';
@ -27,6 +28,7 @@ part 'serializers.g.dart';
Regions,
Stream,
StreamItem,
Subtitle,
VideoInfo,
])
Serializers serializers = (_$serializers.toBuilder()

35
test/subtitle_test.dart Normal file
View File

@ -0,0 +1,35 @@
import 'package:test/test.dart';
import 'package:piped_api/piped_api.dart';
// tests for Subtitle
void main() {
final instance = SubtitleBuilder();
// TODO add properties to the builder and call build()
group(Subtitle, () {
// Whether the subtitle is auto generated.
// bool autoGenerated
test('to test the property `autoGenerated`', () async {
// TODO
});
// The language code of the subtitle.
// String code
test('to test the property `code`', () async {
// TODO
});
// The mime type of the subtitle.
// String mimeType
test('to test the property `mimeType`', () async {
// TODO
});
// The URL of the subtitle.
// String url
test('to test the property `url`', () async {
// TODO
});
});
}