mirror of
https://github.com/TeamPiped/piped_dart.git
synced 2024-08-14 22:27:49 +00:00
Initial commit.
This commit is contained in:
commit
d0203d7c63
39 changed files with 2880 additions and 0 deletions
41
.gitignore
vendored
Normal file
41
.gitignore
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# See https://dart.dev/guides/libraries/private-files
|
||||||
|
|
||||||
|
# Files and directories created by pub
|
||||||
|
.dart_tool/
|
||||||
|
.buildlog
|
||||||
|
.packages
|
||||||
|
.project
|
||||||
|
.pub/
|
||||||
|
build/
|
||||||
|
**/packages/
|
||||||
|
|
||||||
|
# Files created by dart2js
|
||||||
|
# (Most Dart developers will use pub build to compile Dart, use/modify these
|
||||||
|
# rules if you intend to use dart2js directly
|
||||||
|
# Convention is to use extension '.dart.js' for Dart compiled to Javascript to
|
||||||
|
# differentiate from explicit Javascript files)
|
||||||
|
*.dart.js
|
||||||
|
*.part.js
|
||||||
|
*.js.deps
|
||||||
|
*.js.map
|
||||||
|
*.info.json
|
||||||
|
|
||||||
|
# Directory created by dartdoc
|
||||||
|
doc/api/
|
||||||
|
|
||||||
|
# Don't commit pubspec lock file
|
||||||
|
# (Library packages only! Remove pattern if developing an application package)
|
||||||
|
pubspec.lock
|
||||||
|
|
||||||
|
# Don’t commit files and directories created by other development environments.
|
||||||
|
# For example, if your development environment creates any of the following files,
|
||||||
|
# consider putting them in a global ignore file:
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Mac
|
||||||
|
.DS_Store
|
23
.openapi-generator-ignore
Normal file
23
.openapi-generator-ignore
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# OpenAPI Generator Ignore
|
||||||
|
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
37
.openapi-generator/FILES
Normal file
37
.openapi-generator/FILES
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
.gitignore
|
||||||
|
.openapi-generator-ignore
|
||||||
|
README.md
|
||||||
|
analysis_options.yaml
|
||||||
|
doc/ChannelInfo.md
|
||||||
|
doc/ExceptionError.md
|
||||||
|
doc/Regions.md
|
||||||
|
doc/Stream.md
|
||||||
|
doc/StreamItem.md
|
||||||
|
doc/UnauthenticatedApi.md
|
||||||
|
doc/VideoInfo.md
|
||||||
|
lib/piped_api.dart
|
||||||
|
lib/src/api.dart
|
||||||
|
lib/src/api/unauthenticated_api.dart
|
||||||
|
lib/src/api_util.dart
|
||||||
|
lib/src/auth/api_key_auth.dart
|
||||||
|
lib/src/auth/auth.dart
|
||||||
|
lib/src/auth/basic_auth.dart
|
||||||
|
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/date.dart
|
||||||
|
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/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
|
1
.openapi-generator/VERSION
Normal file
1
.openapi-generator/VERSION
Normal file
|
@ -0,0 +1 @@
|
||||||
|
5.3.1
|
93
README.md
Normal file
93
README.md
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
# piped_api (EXPERIMENTAL)
|
||||||
|
This is an API specification for Piped API instances.
|
||||||
|
|
||||||
|
This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||||
|
|
||||||
|
- API version: 1.0.0
|
||||||
|
- Build package: org.openapitools.codegen.languages.DartDioNextClientCodegen
|
||||||
|
For more information, please visit [https://github.com/TeamPiped/Piped/issues](https://github.com/TeamPiped/Piped/issues)
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
* Dart 2.12.0 or later OR Flutter 1.26.0 or later
|
||||||
|
* Dio 4.0.0+
|
||||||
|
|
||||||
|
## Installation & Usage
|
||||||
|
|
||||||
|
### pub.dev
|
||||||
|
To use the package from [pub.dev](https://pub.dev), please include the following in pubspec.yaml
|
||||||
|
```yaml
|
||||||
|
dependencies:
|
||||||
|
piped_api: 1.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
### Github
|
||||||
|
If this Dart package is published to Github, please include the following in pubspec.yaml
|
||||||
|
```yaml
|
||||||
|
dependencies:
|
||||||
|
piped_api:
|
||||||
|
git:
|
||||||
|
url: https://github.com/GIT_USER_ID/GIT_REPO_ID.git
|
||||||
|
#ref: main
|
||||||
|
```
|
||||||
|
|
||||||
|
### Local development
|
||||||
|
To use the package from your local drive, please include the following in pubspec.yaml
|
||||||
|
```yaml
|
||||||
|
dependencies:
|
||||||
|
piped_api:
|
||||||
|
path: /path/to/piped_api
|
||||||
|
```
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Please follow the [installation procedure](#installation--usage) and then run the following:
|
||||||
|
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/piped_api.dart';
|
||||||
|
|
||||||
|
|
||||||
|
final api = PipedApi().getUnauthenticatedApi();
|
||||||
|
final String channelId = UCs6KfncB4OV6Vug4o_bzijg; // String | The channel ID of the YouTube channel you want to get information about.
|
||||||
|
|
||||||
|
try {
|
||||||
|
final response = await api.channelInfoId(channelId);
|
||||||
|
print(response);
|
||||||
|
} catch on DioError (e) {
|
||||||
|
print("Exception when calling UnauthenticatedApi->channelInfoId: $e\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *https://pipedapi.kavin.rocks*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
[*UnauthenticatedApi*](doc/UnauthenticatedApi.md) | [**channelInfoId**](doc/UnauthenticatedApi.md#channelinfoid) | **GET** /channel/{channelId} | Gets Channel Information
|
||||||
|
[*UnauthenticatedApi*](doc/UnauthenticatedApi.md) | [**channelInfoName**](doc/UnauthenticatedApi.md#channelinfoname) | **GET** /c/{name} | Gets Channel Information
|
||||||
|
[*UnauthenticatedApi*](doc/UnauthenticatedApi.md) | [**channelInfoUsername**](doc/UnauthenticatedApi.md#channelinfousername) | **GET** /user/{username} | Gets Channel Information
|
||||||
|
[*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
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation For Models
|
||||||
|
|
||||||
|
- [ChannelInfo](doc/ChannelInfo.md)
|
||||||
|
- [ExceptionError](doc/ExceptionError.md)
|
||||||
|
- [Regions](doc/Regions.md)
|
||||||
|
- [Stream](doc/Stream.md)
|
||||||
|
- [StreamItem](doc/StreamItem.md)
|
||||||
|
- [VideoInfo](doc/VideoInfo.md)
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation For Authorization
|
||||||
|
|
||||||
|
All endpoints do not require authorization.
|
||||||
|
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
kavin@kavin.rocks
|
||||||
|
|
9
analysis_options.yaml
Normal file
9
analysis_options.yaml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
analyzer:
|
||||||
|
language:
|
||||||
|
strict-inference: true
|
||||||
|
strict-raw-types: true
|
||||||
|
strong-mode:
|
||||||
|
implicit-dynamic: false
|
||||||
|
implicit-casts: false
|
||||||
|
exclude:
|
||||||
|
- test/*.dart
|
23
doc/ChannelInfo.md
Normal file
23
doc/ChannelInfo.md
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# piped_api.model.ChannelInfo
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**avatarUrl** | **String** | The URL of the channel's avatar. | [optional]
|
||||||
|
**bannerUrl** | **String** | The URL of the channel's banner. | [optional]
|
||||||
|
**description** | **String** | The channel's description. | [optional]
|
||||||
|
**id** | **String** | The ID of the channel. | [optional]
|
||||||
|
**name** | **String** | The name of the channel. | [optional]
|
||||||
|
**nextpage** | **String** | The parameter used to get the next page of related videos. | [optional]
|
||||||
|
**relatedStreams** | [**BuiltList<StreamItem>**](StreamItem.md) | | [optional]
|
||||||
|
**subscriberCount** | **int** | The number of subscribers the channel has. | [optional]
|
||||||
|
**verified** | **bool** | Whether the channel is verified. | [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)
|
||||||
|
|
||||||
|
|
16
doc/ExceptionError.md
Normal file
16
doc/ExceptionError.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# piped_api.model.ExceptionError
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**error** | **String** | The stacktrace provided by the server. |
|
||||||
|
**message** | **String** | The error message from the stacktrace. |
|
||||||
|
|
||||||
|
[[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/Regions.md
Normal file
14
doc/Regions.md
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# piped_api.model.Regions
|
||||||
|
|
||||||
|
## 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)
|
||||||
|
|
||||||
|
|
28
doc/Stream.md
Normal file
28
doc/Stream.md
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
# piped_api.model.Stream
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**url** | **String** | The URL of the stream. | [optional]
|
||||||
|
**format** | **String** | The format of the stream. | [optional]
|
||||||
|
**quality** | **String** | The quality of the stream. | [optional]
|
||||||
|
**mimeType** | **String** | The mime type of the stream. | [optional]
|
||||||
|
**codec** | **String** | The codec of the stream. | [optional]
|
||||||
|
**videoOnly** | **bool** | | [optional]
|
||||||
|
**bitrate** | **int** | | [optional]
|
||||||
|
**initStart** | **int** | | [optional]
|
||||||
|
**initEnd** | **int** | | [optional]
|
||||||
|
**indexStart** | **int** | | [optional]
|
||||||
|
**indexEnd** | **int** | | [optional]
|
||||||
|
**width** | **int** | | [optional]
|
||||||
|
**height** | **int** | | [optional]
|
||||||
|
**fps** | **int** | | [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)
|
||||||
|
|
||||||
|
|
24
doc/StreamItem.md
Normal file
24
doc/StreamItem.md
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# piped_api.model.StreamItem
|
||||||
|
|
||||||
|
## 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 video. |
|
||||||
|
**title** | **String** | The title of the video. |
|
||||||
|
**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 to the video. |
|
||||||
|
**views** | **int** | The number of views the video 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)
|
||||||
|
|
||||||
|
|
233
doc/UnauthenticatedApi.md
Normal file
233
doc/UnauthenticatedApi.md
Normal file
|
@ -0,0 +1,233 @@
|
||||||
|
# piped_api.api.UnauthenticatedApi
|
||||||
|
|
||||||
|
## Load the API package
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
All URIs are relative to *https://pipedapi.kavin.rocks*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**channelInfoId**](UnauthenticatedApi.md#channelinfoid) | **GET** /channel/{channelId} | Gets Channel Information
|
||||||
|
[**channelInfoName**](UnauthenticatedApi.md#channelinfoname) | **GET** /c/{name} | Gets Channel Information
|
||||||
|
[**channelInfoUsername**](UnauthenticatedApi.md#channelinfousername) | **GET** /user/{username} | Gets Channel Information
|
||||||
|
[**streamInfo**](UnauthenticatedApi.md#streaminfo) | **GET** /streams/{videoId} | Gets Video Information
|
||||||
|
[**trending**](UnauthenticatedApi.md#trending) | **GET** /trending | Gets all Trending Videos
|
||||||
|
|
||||||
|
|
||||||
|
# **channelInfoId**
|
||||||
|
> ChannelInfo channelInfoId(channelId)
|
||||||
|
|
||||||
|
Gets Channel Information
|
||||||
|
|
||||||
|
Gets all available Channel information about a channel.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/api.dart';
|
||||||
|
|
||||||
|
final api = PipedApi().getUnauthenticatedApi();
|
||||||
|
final String channelId = UCs6KfncB4OV6Vug4o_bzijg; // String | The channel ID of the YouTube channel you want to get information about.
|
||||||
|
|
||||||
|
try {
|
||||||
|
final response = api.channelInfoId(channelId);
|
||||||
|
print(response);
|
||||||
|
} catch on DioError (e) {
|
||||||
|
print('Exception when calling UnauthenticatedApi->channelInfoId: $e\n');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**channelId** | **String**| The channel ID of the YouTube channel you want to get information about. |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ChannelInfo**](ChannelInfo.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)
|
||||||
|
|
||||||
|
# **channelInfoName**
|
||||||
|
> ChannelInfo channelInfoName(name)
|
||||||
|
|
||||||
|
Gets Channel Information
|
||||||
|
|
||||||
|
Gets all available Channel information about a channel.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/api.dart';
|
||||||
|
|
||||||
|
final api = PipedApi().getUnauthenticatedApi();
|
||||||
|
final String name = Dream; // String | The name of the YouTube channel you want to get information about.
|
||||||
|
|
||||||
|
try {
|
||||||
|
final response = api.channelInfoName(name);
|
||||||
|
print(response);
|
||||||
|
} catch on DioError (e) {
|
||||||
|
print('Exception when calling UnauthenticatedApi->channelInfoName: $e\n');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**name** | **String**| The name of the YouTube channel you want to get information about. |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ChannelInfo**](ChannelInfo.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)
|
||||||
|
|
||||||
|
# **channelInfoUsername**
|
||||||
|
> ChannelInfo channelInfoUsername(username)
|
||||||
|
|
||||||
|
Gets Channel Information
|
||||||
|
|
||||||
|
Gets all available Channel information about a channel.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/api.dart';
|
||||||
|
|
||||||
|
final api = PipedApi().getUnauthenticatedApi();
|
||||||
|
final String username = DreamTraps; // String | The username of the YouTube channel you want to get information about.
|
||||||
|
|
||||||
|
try {
|
||||||
|
final response = api.channelInfoUsername(username);
|
||||||
|
print(response);
|
||||||
|
} catch on DioError (e) {
|
||||||
|
print('Exception when calling UnauthenticatedApi->channelInfoUsername: $e\n');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**username** | **String**| The username of the YouTube channel you want to get information about. |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**ChannelInfo**](ChannelInfo.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)
|
||||||
|
|
||||||
|
Gets Video Information
|
||||||
|
|
||||||
|
Gets all available Stream information about a video.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/api.dart';
|
||||||
|
|
||||||
|
final api = PipedApi().getUnauthenticatedApi();
|
||||||
|
final String videoId = dQw4w9WgXcQ; // String | The video ID of the YouTube video you want to get information about.
|
||||||
|
|
||||||
|
try {
|
||||||
|
final response = api.streamInfo(videoId);
|
||||||
|
print(response);
|
||||||
|
} catch on DioError (e) {
|
||||||
|
print('Exception when calling UnauthenticatedApi->streamInfo: $e\n');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**videoId** | **String**| The video ID of the YouTube video you want to get information about. |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**VideoInfo**](VideoInfo.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)
|
||||||
|
|
||||||
|
# **trending**
|
||||||
|
> BuiltList<StreamItem> trending(region)
|
||||||
|
|
||||||
|
Gets all Trending Videos
|
||||||
|
|
||||||
|
Gets all Trending Videos in the requested country.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/api.dart';
|
||||||
|
|
||||||
|
final api = PipedApi().getUnauthenticatedApi();
|
||||||
|
final Regions region = US; // Regions | The Region to get trending videos from.
|
||||||
|
|
||||||
|
try {
|
||||||
|
final response = api.trending(region);
|
||||||
|
print(response);
|
||||||
|
} catch on DioError (e) {
|
||||||
|
print('Exception when calling UnauthenticatedApi->trending: $e\n');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**region** | [**Regions**](.md)| The Region to get trending videos from. |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**BuiltList<StreamItem>**](StreamItem.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)
|
||||||
|
|
16
doc/VideoInfo.md
Normal file
16
doc/VideoInfo.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# piped_api.model.VideoInfo
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```dart
|
||||||
|
import 'package:piped_api/api.dart';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**audioStreams** | [**BuiltList<Stream>**](Stream.md) | | [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)
|
||||||
|
|
||||||
|
|
19
lib/piped_api.dart
Normal file
19
lib/piped_api.dart
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
export 'package:piped_api/src/api.dart';
|
||||||
|
export 'package:piped_api/src/auth/api_key_auth.dart';
|
||||||
|
export 'package:piped_api/src/auth/basic_auth.dart';
|
||||||
|
export 'package:piped_api/src/auth/oauth.dart';
|
||||||
|
export 'package:piped_api/src/serializers.dart';
|
||||||
|
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/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/video_info.dart';
|
73
lib/src/api.dart
Normal file
73
lib/src/api.dart
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
import 'package:piped_api/src/serializers.dart';
|
||||||
|
import 'package:piped_api/src/auth/api_key_auth.dart';
|
||||||
|
import 'package:piped_api/src/auth/basic_auth.dart';
|
||||||
|
import 'package:piped_api/src/auth/bearer_auth.dart';
|
||||||
|
import 'package:piped_api/src/auth/oauth.dart';
|
||||||
|
import 'package:piped_api/src/api/unauthenticated_api.dart';
|
||||||
|
|
||||||
|
class PipedApi {
|
||||||
|
static const String basePath = r'https://pipedapi.kavin.rocks';
|
||||||
|
|
||||||
|
final Dio dio;
|
||||||
|
final Serializers serializers;
|
||||||
|
|
||||||
|
PipedApi({
|
||||||
|
Dio? dio,
|
||||||
|
Serializers? serializers,
|
||||||
|
String? basePathOverride,
|
||||||
|
List<Interceptor>? interceptors,
|
||||||
|
}) : this.serializers = serializers ?? standardSerializers,
|
||||||
|
this.dio = dio ??
|
||||||
|
Dio(BaseOptions(
|
||||||
|
baseUrl: basePathOverride ?? basePath,
|
||||||
|
connectTimeout: 5000,
|
||||||
|
receiveTimeout: 3000,
|
||||||
|
)) {
|
||||||
|
if (interceptors == null) {
|
||||||
|
this.dio.interceptors.addAll([
|
||||||
|
OAuthInterceptor(),
|
||||||
|
BasicAuthInterceptor(),
|
||||||
|
BearerAuthInterceptor(),
|
||||||
|
ApiKeyAuthInterceptor(),
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
this.dio.interceptors.addAll(interceptors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setOAuthToken(String name, String token) {
|
||||||
|
if (this.dio.interceptors.any((i) => i is OAuthInterceptor)) {
|
||||||
|
(this.dio.interceptors.firstWhere((i) => i is OAuthInterceptor) as OAuthInterceptor).tokens[name] = token;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBearerAuth(String name, String token) {
|
||||||
|
if (this.dio.interceptors.any((i) => i is BearerAuthInterceptor)) {
|
||||||
|
(this.dio.interceptors.firstWhere((i) => i is BearerAuthInterceptor) as BearerAuthInterceptor).tokens[name] = token;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBasicAuth(String name, String username, String password) {
|
||||||
|
if (this.dio.interceptors.any((i) => i is BasicAuthInterceptor)) {
|
||||||
|
(this.dio.interceptors.firstWhere((i) => i is BasicAuthInterceptor) as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setApiKey(String name, String apiKey) {
|
||||||
|
if (this.dio.interceptors.any((i) => i is ApiKeyAuthInterceptor)) {
|
||||||
|
(this.dio.interceptors.firstWhere((element) => element is ApiKeyAuthInterceptor) as ApiKeyAuthInterceptor).apiKeys[name] = apiKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get UnauthenticatedApi instance, base route and serializer can be overridden by a given but be careful,
|
||||||
|
/// by doing that all interceptors will not be executed
|
||||||
|
UnauthenticatedApi getUnauthenticatedApi() {
|
||||||
|
return UnauthenticatedApi(dio, serializers);
|
||||||
|
}
|
||||||
|
}
|
401
lib/src/api/unauthenticated_api.dart
Normal file
401
lib/src/api/unauthenticated_api.dart
Normal file
|
@ -0,0 +1,401 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
|
||||||
|
import 'package:built_collection/built_collection.dart';
|
||||||
|
import 'package:piped_api/src/api_util.dart';
|
||||||
|
import 'package:piped_api/src/model/channel_info.dart';
|
||||||
|
import 'package:piped_api/src/model/exception_error.dart';
|
||||||
|
import 'package:piped_api/src/model/regions.dart';
|
||||||
|
import 'package:piped_api/src/model/stream_item.dart';
|
||||||
|
import 'package:piped_api/src/model/video_info.dart';
|
||||||
|
|
||||||
|
class UnauthenticatedApi {
|
||||||
|
|
||||||
|
final Dio _dio;
|
||||||
|
|
||||||
|
final Serializers _serializers;
|
||||||
|
|
||||||
|
const UnauthenticatedApi(this._dio, this._serializers);
|
||||||
|
|
||||||
|
/// Gets Channel Information
|
||||||
|
/// Gets all available Channel information about a channel.
|
||||||
|
///
|
||||||
|
/// Parameters:
|
||||||
|
/// * [channelId] - The channel ID of the YouTube channel you want to get information about.
|
||||||
|
/// * [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 [ChannelInfo] as data
|
||||||
|
/// Throws [DioError] if API call or serialization fails
|
||||||
|
Future<Response<ChannelInfo>> channelInfoId({
|
||||||
|
required String channelId,
|
||||||
|
CancelToken? cancelToken,
|
||||||
|
Map<String, dynamic>? headers,
|
||||||
|
Map<String, dynamic>? extra,
|
||||||
|
ValidateStatus? validateStatus,
|
||||||
|
ProgressCallback? onSendProgress,
|
||||||
|
ProgressCallback? onReceiveProgress,
|
||||||
|
}) async {
|
||||||
|
final _path = r'/channel/{channelId}'.replaceAll('{' r'channelId' '}', channelId.toString());
|
||||||
|
final _options = Options(
|
||||||
|
method: r'GET',
|
||||||
|
headers: <String, dynamic>{
|
||||||
|
...?headers,
|
||||||
|
},
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
'secure': <Map<String, String>>[],
|
||||||
|
...?extra,
|
||||||
|
},
|
||||||
|
validateStatus: validateStatus,
|
||||||
|
);
|
||||||
|
|
||||||
|
final _response = await _dio.request<Object>(
|
||||||
|
_path,
|
||||||
|
options: _options,
|
||||||
|
cancelToken: cancelToken,
|
||||||
|
onSendProgress: onSendProgress,
|
||||||
|
onReceiveProgress: onReceiveProgress,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChannelInfo _responseData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const _responseType = FullType(ChannelInfo);
|
||||||
|
_responseData = _serializers.deserialize(
|
||||||
|
_response.data!,
|
||||||
|
specifiedType: _responseType,
|
||||||
|
) as ChannelInfo;
|
||||||
|
|
||||||
|
} catch (error, stackTrace) {
|
||||||
|
throw DioError(
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
response: _response,
|
||||||
|
type: DioErrorType.other,
|
||||||
|
error: error,
|
||||||
|
)..stackTrace = stackTrace;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response<ChannelInfo>(
|
||||||
|
data: _responseData,
|
||||||
|
headers: _response.headers,
|
||||||
|
isRedirect: _response.isRedirect,
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
redirects: _response.redirects,
|
||||||
|
statusCode: _response.statusCode,
|
||||||
|
statusMessage: _response.statusMessage,
|
||||||
|
extra: _response.extra,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets Channel Information
|
||||||
|
/// Gets all available Channel information about a channel.
|
||||||
|
///
|
||||||
|
/// Parameters:
|
||||||
|
/// * [name] - The name of the YouTube channel you want to get information about.
|
||||||
|
/// * [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 [ChannelInfo] as data
|
||||||
|
/// Throws [DioError] if API call or serialization fails
|
||||||
|
Future<Response<ChannelInfo>> channelInfoName({
|
||||||
|
required String name,
|
||||||
|
CancelToken? cancelToken,
|
||||||
|
Map<String, dynamic>? headers,
|
||||||
|
Map<String, dynamic>? extra,
|
||||||
|
ValidateStatus? validateStatus,
|
||||||
|
ProgressCallback? onSendProgress,
|
||||||
|
ProgressCallback? onReceiveProgress,
|
||||||
|
}) async {
|
||||||
|
final _path = r'/c/{name}'.replaceAll('{' r'name' '}', name.toString());
|
||||||
|
final _options = Options(
|
||||||
|
method: r'GET',
|
||||||
|
headers: <String, dynamic>{
|
||||||
|
...?headers,
|
||||||
|
},
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
'secure': <Map<String, String>>[],
|
||||||
|
...?extra,
|
||||||
|
},
|
||||||
|
validateStatus: validateStatus,
|
||||||
|
);
|
||||||
|
|
||||||
|
final _response = await _dio.request<Object>(
|
||||||
|
_path,
|
||||||
|
options: _options,
|
||||||
|
cancelToken: cancelToken,
|
||||||
|
onSendProgress: onSendProgress,
|
||||||
|
onReceiveProgress: onReceiveProgress,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChannelInfo _responseData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const _responseType = FullType(ChannelInfo);
|
||||||
|
_responseData = _serializers.deserialize(
|
||||||
|
_response.data!,
|
||||||
|
specifiedType: _responseType,
|
||||||
|
) as ChannelInfo;
|
||||||
|
|
||||||
|
} catch (error, stackTrace) {
|
||||||
|
throw DioError(
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
response: _response,
|
||||||
|
type: DioErrorType.other,
|
||||||
|
error: error,
|
||||||
|
)..stackTrace = stackTrace;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response<ChannelInfo>(
|
||||||
|
data: _responseData,
|
||||||
|
headers: _response.headers,
|
||||||
|
isRedirect: _response.isRedirect,
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
redirects: _response.redirects,
|
||||||
|
statusCode: _response.statusCode,
|
||||||
|
statusMessage: _response.statusMessage,
|
||||||
|
extra: _response.extra,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets Channel Information
|
||||||
|
/// Gets all available Channel information about a channel.
|
||||||
|
///
|
||||||
|
/// Parameters:
|
||||||
|
/// * [username] - The username of the YouTube channel you want to get information about.
|
||||||
|
/// * [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 [ChannelInfo] as data
|
||||||
|
/// Throws [DioError] if API call or serialization fails
|
||||||
|
Future<Response<ChannelInfo>> channelInfoUsername({
|
||||||
|
required String username,
|
||||||
|
CancelToken? cancelToken,
|
||||||
|
Map<String, dynamic>? headers,
|
||||||
|
Map<String, dynamic>? extra,
|
||||||
|
ValidateStatus? validateStatus,
|
||||||
|
ProgressCallback? onSendProgress,
|
||||||
|
ProgressCallback? onReceiveProgress,
|
||||||
|
}) async {
|
||||||
|
final _path = r'/user/{username}'.replaceAll('{' r'username' '}', username.toString());
|
||||||
|
final _options = Options(
|
||||||
|
method: r'GET',
|
||||||
|
headers: <String, dynamic>{
|
||||||
|
...?headers,
|
||||||
|
},
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
'secure': <Map<String, String>>[],
|
||||||
|
...?extra,
|
||||||
|
},
|
||||||
|
validateStatus: validateStatus,
|
||||||
|
);
|
||||||
|
|
||||||
|
final _response = await _dio.request<Object>(
|
||||||
|
_path,
|
||||||
|
options: _options,
|
||||||
|
cancelToken: cancelToken,
|
||||||
|
onSendProgress: onSendProgress,
|
||||||
|
onReceiveProgress: onReceiveProgress,
|
||||||
|
);
|
||||||
|
|
||||||
|
ChannelInfo _responseData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const _responseType = FullType(ChannelInfo);
|
||||||
|
_responseData = _serializers.deserialize(
|
||||||
|
_response.data!,
|
||||||
|
specifiedType: _responseType,
|
||||||
|
) as ChannelInfo;
|
||||||
|
|
||||||
|
} catch (error, stackTrace) {
|
||||||
|
throw DioError(
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
response: _response,
|
||||||
|
type: DioErrorType.other,
|
||||||
|
error: error,
|
||||||
|
)..stackTrace = stackTrace;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response<ChannelInfo>(
|
||||||
|
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.
|
||||||
|
///
|
||||||
|
/// Parameters:
|
||||||
|
/// * [videoId] - The video ID of the YouTube video you want to get information about.
|
||||||
|
/// * [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 [VideoInfo] as data
|
||||||
|
/// Throws [DioError] if API call or serialization fails
|
||||||
|
Future<Response<VideoInfo>> streamInfo({
|
||||||
|
required String videoId,
|
||||||
|
CancelToken? cancelToken,
|
||||||
|
Map<String, dynamic>? headers,
|
||||||
|
Map<String, dynamic>? extra,
|
||||||
|
ValidateStatus? validateStatus,
|
||||||
|
ProgressCallback? onSendProgress,
|
||||||
|
ProgressCallback? onReceiveProgress,
|
||||||
|
}) async {
|
||||||
|
final _path = r'/streams/{videoId}'.replaceAll('{' r'videoId' '}', videoId.toString());
|
||||||
|
final _options = Options(
|
||||||
|
method: r'GET',
|
||||||
|
headers: <String, dynamic>{
|
||||||
|
...?headers,
|
||||||
|
},
|
||||||
|
extra: <String, dynamic>{
|
||||||
|
'secure': <Map<String, String>>[],
|
||||||
|
...?extra,
|
||||||
|
},
|
||||||
|
validateStatus: validateStatus,
|
||||||
|
);
|
||||||
|
|
||||||
|
final _response = await _dio.request<Object>(
|
||||||
|
_path,
|
||||||
|
options: _options,
|
||||||
|
cancelToken: cancelToken,
|
||||||
|
onSendProgress: onSendProgress,
|
||||||
|
onReceiveProgress: onReceiveProgress,
|
||||||
|
);
|
||||||
|
|
||||||
|
VideoInfo _responseData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const _responseType = FullType(VideoInfo);
|
||||||
|
_responseData = _serializers.deserialize(
|
||||||
|
_response.data!,
|
||||||
|
specifiedType: _responseType,
|
||||||
|
) as VideoInfo;
|
||||||
|
|
||||||
|
} catch (error, stackTrace) {
|
||||||
|
throw DioError(
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
response: _response,
|
||||||
|
type: DioErrorType.other,
|
||||||
|
error: error,
|
||||||
|
)..stackTrace = stackTrace;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response<VideoInfo>(
|
||||||
|
data: _responseData,
|
||||||
|
headers: _response.headers,
|
||||||
|
isRedirect: _response.isRedirect,
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
redirects: _response.redirects,
|
||||||
|
statusCode: _response.statusCode,
|
||||||
|
statusMessage: _response.statusMessage,
|
||||||
|
extra: _response.extra,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Gets all Trending Videos
|
||||||
|
/// Gets all Trending Videos in the requested country.
|
||||||
|
///
|
||||||
|
/// Parameters:
|
||||||
|
/// * [region] - The Region to get trending videos from.
|
||||||
|
/// * [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 [BuiltList<StreamItem>] as data
|
||||||
|
/// Throws [DioError] if API call or serialization fails
|
||||||
|
Future<Response<BuiltList<StreamItem>>> trending({
|
||||||
|
required Regions region,
|
||||||
|
CancelToken? cancelToken,
|
||||||
|
Map<String, dynamic>? headers,
|
||||||
|
Map<String, dynamic>? extra,
|
||||||
|
ValidateStatus? validateStatus,
|
||||||
|
ProgressCallback? onSendProgress,
|
||||||
|
ProgressCallback? onReceiveProgress,
|
||||||
|
}) async {
|
||||||
|
final _path = r'/trending';
|
||||||
|
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'region': encodeQueryParameter(_serializers, region, const FullType(Regions)),
|
||||||
|
};
|
||||||
|
|
||||||
|
final _response = await _dio.request<Object>(
|
||||||
|
_path,
|
||||||
|
options: _options,
|
||||||
|
queryParameters: _queryParameters,
|
||||||
|
cancelToken: cancelToken,
|
||||||
|
onSendProgress: onSendProgress,
|
||||||
|
onReceiveProgress: onReceiveProgress,
|
||||||
|
);
|
||||||
|
|
||||||
|
BuiltList<StreamItem> _responseData;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const _responseType = FullType(BuiltList, [FullType(StreamItem)]);
|
||||||
|
_responseData = _serializers.deserialize(
|
||||||
|
_response.data!,
|
||||||
|
specifiedType: _responseType,
|
||||||
|
) as BuiltList<StreamItem>;
|
||||||
|
|
||||||
|
} catch (error, stackTrace) {
|
||||||
|
throw DioError(
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
response: _response,
|
||||||
|
type: DioErrorType.other,
|
||||||
|
error: error,
|
||||||
|
)..stackTrace = stackTrace;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response<BuiltList<StreamItem>>(
|
||||||
|
data: _responseData,
|
||||||
|
headers: _response.headers,
|
||||||
|
isRedirect: _response.isRedirect,
|
||||||
|
requestOptions: _response.requestOptions,
|
||||||
|
redirects: _response.redirects,
|
||||||
|
statusCode: _response.statusCode,
|
||||||
|
statusMessage: _response.statusMessage,
|
||||||
|
extra: _response.extra,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
78
lib/src/api_util.dart
Normal file
78
lib/src/api_util.dart
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:built_collection/built_collection.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:dio/src/parameter.dart';
|
||||||
|
|
||||||
|
/// Format the given form parameter object into something that Dio can handle.
|
||||||
|
/// Returns primitive or String.
|
||||||
|
/// Returns List/Map if the value is BuildList/BuiltMap.
|
||||||
|
dynamic encodeFormParameter(Serializers serializers, dynamic value, FullType type) {
|
||||||
|
if (value == null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (value is String || value is num || value is bool) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
final serialized = serializers.serialize(
|
||||||
|
value as Object,
|
||||||
|
specifiedType: type,
|
||||||
|
);
|
||||||
|
if (serialized is String) {
|
||||||
|
return serialized;
|
||||||
|
}
|
||||||
|
if (value is BuiltList || value is BuiltSet || value is BuiltMap) {
|
||||||
|
return serialized;
|
||||||
|
}
|
||||||
|
return json.encode(serialized);
|
||||||
|
}
|
||||||
|
|
||||||
|
dynamic encodeQueryParameter(
|
||||||
|
Serializers serializers,
|
||||||
|
dynamic value,
|
||||||
|
FullType type,
|
||||||
|
) {
|
||||||
|
if (value == null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (value is String || value is num || value is bool) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
if (value is Uint8List) {
|
||||||
|
// Currently not sure how to serialize this
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
final serialized = serializers.serialize(
|
||||||
|
value as Object,
|
||||||
|
specifiedType: type,
|
||||||
|
);
|
||||||
|
if (serialized == null) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (serialized is String) {
|
||||||
|
return serialized;
|
||||||
|
}
|
||||||
|
return serialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
ListParam<T> encodeCollectionQueryParameter<T>(
|
||||||
|
Serializers serializers,
|
||||||
|
dynamic value,
|
||||||
|
FullType type, {
|
||||||
|
ListFormat format = ListFormat.multi,
|
||||||
|
}) {
|
||||||
|
final serialized = serializers.serialize(
|
||||||
|
value as Object,
|
||||||
|
specifiedType: type,
|
||||||
|
);
|
||||||
|
if (value is BuiltList<T> || value is BuiltSet<T>) {
|
||||||
|
return ListParam(List.of((serialized as Iterable<Object?>).cast()), format);
|
||||||
|
}
|
||||||
|
throw ArgumentError('Invalid value passed to encodeCollectionQueryParameter');
|
||||||
|
}
|
30
lib/src/auth/api_key_auth.dart
Normal file
30
lib/src/auth/api_key_auth.dart
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:piped_api/src/auth/auth.dart';
|
||||||
|
|
||||||
|
class ApiKeyAuthInterceptor extends AuthInterceptor {
|
||||||
|
final Map<String, String> apiKeys = {};
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
||||||
|
final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'apiKey');
|
||||||
|
for (final info in authInfo) {
|
||||||
|
final authName = info['name'] as String;
|
||||||
|
final authKeyName = info['keyName'] as String;
|
||||||
|
final authWhere = info['where'] as String;
|
||||||
|
final apiKey = apiKeys[authName];
|
||||||
|
if (apiKey != null) {
|
||||||
|
if (authWhere == 'query') {
|
||||||
|
options.queryParameters[authKeyName] = apiKey;
|
||||||
|
} else {
|
||||||
|
options.headers[authKeyName] = apiKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onRequest(options, handler);
|
||||||
|
}
|
||||||
|
}
|
18
lib/src/auth/auth.dart
Normal file
18
lib/src/auth/auth.dart
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
|
||||||
|
abstract class AuthInterceptor extends Interceptor {
|
||||||
|
/// Get auth information on given route for the given type.
|
||||||
|
/// Can return an empty list if type is not present on auth data or
|
||||||
|
/// if route doesn't need authentication.
|
||||||
|
List<Map<String, String>> getAuthInfo(RequestOptions route, bool Function(Map<String, String> secure) handles) {
|
||||||
|
if (route.extra.containsKey('secure')) {
|
||||||
|
final auth = route.extra['secure'] as List<Map<String, String>>;
|
||||||
|
return auth.where((secure) => handles(secure)).toList();
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
37
lib/src/auth/basic_auth.dart
Normal file
37
lib/src/auth/basic_auth.dart
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:piped_api/src/auth/auth.dart';
|
||||||
|
|
||||||
|
class BasicAuthInfo {
|
||||||
|
final String username;
|
||||||
|
final String password;
|
||||||
|
|
||||||
|
const BasicAuthInfo(this.username, this.password);
|
||||||
|
}
|
||||||
|
|
||||||
|
class BasicAuthInterceptor extends AuthInterceptor {
|
||||||
|
final Map<String, BasicAuthInfo> authInfo = {};
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onRequest(
|
||||||
|
RequestOptions options,
|
||||||
|
RequestInterceptorHandler handler,
|
||||||
|
) {
|
||||||
|
final metadataAuthInfo = getAuthInfo(options, (secure) => (secure['type'] == 'http' && secure['scheme'] == 'basic') || secure['type'] == 'basic');
|
||||||
|
for (final info in metadataAuthInfo) {
|
||||||
|
final authName = info['name'] as String;
|
||||||
|
final basicAuthInfo = authInfo[authName];
|
||||||
|
if (basicAuthInfo != null) {
|
||||||
|
final basicAuth = 'Basic ${base64Encode(utf8.encode('${basicAuthInfo.username}:${basicAuthInfo.password}'))}';
|
||||||
|
options.headers['Authorization'] = basicAuth;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onRequest(options, handler);
|
||||||
|
}
|
||||||
|
}
|
26
lib/src/auth/bearer_auth.dart
Normal file
26
lib/src/auth/bearer_auth.dart
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:piped_api/src/auth/auth.dart';
|
||||||
|
|
||||||
|
class BearerAuthInterceptor extends AuthInterceptor {
|
||||||
|
final Map<String, String> tokens = {};
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onRequest(
|
||||||
|
RequestOptions options,
|
||||||
|
RequestInterceptorHandler handler,
|
||||||
|
) {
|
||||||
|
final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'http' && secure['scheme'] == 'bearer');
|
||||||
|
for (final info in authInfo) {
|
||||||
|
final token = tokens[info['name']];
|
||||||
|
if (token != null) {
|
||||||
|
options.headers['Authorization'] = 'Bearer ${token}';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onRequest(options, handler);
|
||||||
|
}
|
||||||
|
}
|
26
lib/src/auth/oauth.dart
Normal file
26
lib/src/auth/oauth.dart
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:piped_api/src/auth/auth.dart';
|
||||||
|
|
||||||
|
class OAuthInterceptor extends AuthInterceptor {
|
||||||
|
final Map<String, String> tokens = {};
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onRequest(
|
||||||
|
RequestOptions options,
|
||||||
|
RequestInterceptorHandler handler,
|
||||||
|
) {
|
||||||
|
final authInfo = getAuthInfo(options, (secure) => secure['type'] == 'oauth' || secure['type'] == 'oauth2');
|
||||||
|
for (final info in authInfo) {
|
||||||
|
final token = tokens[info['name']];
|
||||||
|
if (token != null) {
|
||||||
|
options.headers['Authorization'] = 'Bearer ${token}';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.onRequest(options, handler);
|
||||||
|
}
|
||||||
|
}
|
31
lib/src/date_serializer.dart
Normal file
31
lib/src/date_serializer.dart
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'package:built_collection/built_collection.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
import 'package:piped_api/src/model/date.dart';
|
||||||
|
|
||||||
|
class DateSerializer implements PrimitiveSerializer<Date> {
|
||||||
|
|
||||||
|
const DateSerializer();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Iterable<Type> get types => BuiltList.of([Date]);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get wireName => 'Date';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Date deserialize(Serializers serializers, Object serialized,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
final parsed = DateTime.parse(serialized as String);
|
||||||
|
return Date(parsed.year, parsed.month, parsed.day);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Object serialize(Serializers serializers, Date date,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
return date.toString();
|
||||||
|
}
|
||||||
|
}
|
201
lib/src/model/channel_info.dart
Normal file
201
lib/src/model/channel_info.dart
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'package:piped_api/src/model/stream_item.dart';
|
||||||
|
import 'package:built_collection/built_collection.dart';
|
||||||
|
import 'package:built_value/built_value.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
|
||||||
|
part 'channel_info.g.dart';
|
||||||
|
|
||||||
|
/// ChannelInfo
|
||||||
|
///
|
||||||
|
/// Properties:
|
||||||
|
/// * [avatarUrl] - The URL of the channel's avatar.
|
||||||
|
/// * [bannerUrl] - The URL of the channel's banner.
|
||||||
|
/// * [description] - The channel's description.
|
||||||
|
/// * [id] - The ID of the channel.
|
||||||
|
/// * [name] - The name of the channel.
|
||||||
|
/// * [nextpage] - The parameter used to get the next page of related videos.
|
||||||
|
/// * [relatedStreams]
|
||||||
|
/// * [subscriberCount] - The number of subscribers the channel has.
|
||||||
|
/// * [verified] - Whether the channel is verified.
|
||||||
|
abstract class ChannelInfo implements Built<ChannelInfo, ChannelInfoBuilder> {
|
||||||
|
/// The URL of the channel's avatar.
|
||||||
|
@BuiltValueField(wireName: r'avatarUrl')
|
||||||
|
String? get avatarUrl;
|
||||||
|
|
||||||
|
/// The URL of the channel's banner.
|
||||||
|
@BuiltValueField(wireName: r'bannerUrl')
|
||||||
|
String? get bannerUrl;
|
||||||
|
|
||||||
|
/// The channel's description.
|
||||||
|
@BuiltValueField(wireName: r'description')
|
||||||
|
String? get description;
|
||||||
|
|
||||||
|
/// The ID of the channel.
|
||||||
|
@BuiltValueField(wireName: r'id')
|
||||||
|
String? get id;
|
||||||
|
|
||||||
|
/// The name of the channel.
|
||||||
|
@BuiltValueField(wireName: r'name')
|
||||||
|
String? get name;
|
||||||
|
|
||||||
|
/// The parameter used to get the next page of related videos.
|
||||||
|
@BuiltValueField(wireName: r'nextpage')
|
||||||
|
String? get nextpage;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'relatedStreams')
|
||||||
|
BuiltList<StreamItem>? get relatedStreams;
|
||||||
|
|
||||||
|
/// The number of subscribers the channel has.
|
||||||
|
@BuiltValueField(wireName: r'subscriberCount')
|
||||||
|
int? get subscriberCount;
|
||||||
|
|
||||||
|
/// Whether the channel is verified.
|
||||||
|
@BuiltValueField(wireName: r'verified')
|
||||||
|
bool? get verified;
|
||||||
|
|
||||||
|
ChannelInfo._();
|
||||||
|
|
||||||
|
@BuiltValueHook(initializeBuilder: true)
|
||||||
|
static void _defaults(ChannelInfoBuilder b) => b;
|
||||||
|
|
||||||
|
factory ChannelInfo([void updates(ChannelInfoBuilder b)]) = _$ChannelInfo;
|
||||||
|
|
||||||
|
@BuiltValueSerializer(custom: true)
|
||||||
|
static Serializer<ChannelInfo> get serializer => _$ChannelInfoSerializer();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _$ChannelInfoSerializer implements StructuredSerializer<ChannelInfo> {
|
||||||
|
@override
|
||||||
|
final Iterable<Type> types = const [ChannelInfo, _$ChannelInfo];
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String wireName = r'ChannelInfo';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Iterable<Object?> serialize(Serializers serializers, ChannelInfo object,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
final result = <Object?>[];
|
||||||
|
if (object.avatarUrl != null) {
|
||||||
|
result
|
||||||
|
..add(r'avatarUrl')
|
||||||
|
..add(serializers.serialize(object.avatarUrl,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.bannerUrl != null) {
|
||||||
|
result
|
||||||
|
..add(r'bannerUrl')
|
||||||
|
..add(serializers.serialize(object.bannerUrl,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.description != null) {
|
||||||
|
result
|
||||||
|
..add(r'description')
|
||||||
|
..add(serializers.serialize(object.description,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.id != null) {
|
||||||
|
result
|
||||||
|
..add(r'id')
|
||||||
|
..add(serializers.serialize(object.id,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.name != null) {
|
||||||
|
result
|
||||||
|
..add(r'name')
|
||||||
|
..add(serializers.serialize(object.name,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.nextpage != null) {
|
||||||
|
result
|
||||||
|
..add(r'nextpage')
|
||||||
|
..add(serializers.serialize(object.nextpage,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.relatedStreams != null) {
|
||||||
|
result
|
||||||
|
..add(r'relatedStreams')
|
||||||
|
..add(serializers.serialize(object.relatedStreams,
|
||||||
|
specifiedType: const FullType(BuiltList, [FullType(StreamItem)])));
|
||||||
|
}
|
||||||
|
if (object.subscriberCount != null) {
|
||||||
|
result
|
||||||
|
..add(r'subscriberCount')
|
||||||
|
..add(serializers.serialize(object.subscriberCount,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
|
if (object.verified != null) {
|
||||||
|
result
|
||||||
|
..add(r'verified')
|
||||||
|
..add(serializers.serialize(object.verified,
|
||||||
|
specifiedType: const FullType(bool)));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
ChannelInfo deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
final result = ChannelInfoBuilder();
|
||||||
|
|
||||||
|
final iterator = serialized.iterator;
|
||||||
|
while (iterator.moveNext()) {
|
||||||
|
final key = iterator.current as String;
|
||||||
|
iterator.moveNext();
|
||||||
|
final Object? value = iterator.current;
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case r'avatarUrl':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.avatarUrl = valueDes;
|
||||||
|
break;
|
||||||
|
case r'bannerUrl':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.bannerUrl = valueDes;
|
||||||
|
break;
|
||||||
|
case r'description':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.description = valueDes;
|
||||||
|
break;
|
||||||
|
case r'id':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.id = valueDes;
|
||||||
|
break;
|
||||||
|
case r'name':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.name = valueDes;
|
||||||
|
break;
|
||||||
|
case r'nextpage':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.nextpage = valueDes;
|
||||||
|
break;
|
||||||
|
case r'relatedStreams':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(BuiltList, [FullType(StreamItem)])) as BuiltList<StreamItem>;
|
||||||
|
result.relatedStreams.replace(valueDes);
|
||||||
|
break;
|
||||||
|
case r'subscriberCount':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
result.subscriberCount = valueDes;
|
||||||
|
break;
|
||||||
|
case r'verified':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(bool)) as bool;
|
||||||
|
result.verified = valueDes;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
70
lib/src/model/date.dart
Normal file
70
lib/src/model/date.dart
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
/// A gregorian calendar date generated by
|
||||||
|
/// OpenAPI generator to differentiate
|
||||||
|
/// between [DateTime] and [Date] formats.
|
||||||
|
class Date implements Comparable<Date> {
|
||||||
|
final int year;
|
||||||
|
|
||||||
|
/// January is 1.
|
||||||
|
final int month;
|
||||||
|
|
||||||
|
/// First day is 1.
|
||||||
|
final int day;
|
||||||
|
|
||||||
|
Date(this.year, this.month, this.day);
|
||||||
|
|
||||||
|
/// The current date
|
||||||
|
static Date now({bool utc = false}) {
|
||||||
|
var now = DateTime.now();
|
||||||
|
if (utc) {
|
||||||
|
now = now.toUtc();
|
||||||
|
}
|
||||||
|
return now.toDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert to a [DateTime].
|
||||||
|
DateTime toDateTime({bool utc = false}) {
|
||||||
|
if (utc) {
|
||||||
|
return DateTime.utc(year, month, day);
|
||||||
|
} else {
|
||||||
|
return DateTime(year, month, day);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int compareTo(Date other) {
|
||||||
|
int d = year.compareTo(other.year);
|
||||||
|
if (d != 0) {
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
d = month.compareTo(other.month);
|
||||||
|
if (d != 0) {
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
return day.compareTo(other.day);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is Date &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
year == other.year &&
|
||||||
|
month == other.month &&
|
||||||
|
day == other.day;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => year.hashCode ^ month.hashCode ^ day.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
final yyyy = year.toString();
|
||||||
|
final mm = month.toString().padLeft(2, '0');
|
||||||
|
final dd = day.toString().padLeft(2, '0');
|
||||||
|
|
||||||
|
return '$yyyy-$mm-$dd';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension DateTimeToDate on DateTime {
|
||||||
|
Date toDate() => Date(year, month, day);
|
||||||
|
}
|
84
lib/src/model/exception_error.dart
Normal file
84
lib/src/model/exception_error.dart
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'package:built_value/built_value.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
|
||||||
|
part 'exception_error.g.dart';
|
||||||
|
|
||||||
|
/// When a server-side exception takes place.
|
||||||
|
///
|
||||||
|
/// Properties:
|
||||||
|
/// * [error] - The stacktrace provided by the server.
|
||||||
|
/// * [message] - The error message from the stacktrace.
|
||||||
|
abstract class ExceptionError implements Built<ExceptionError, ExceptionErrorBuilder> {
|
||||||
|
/// The stacktrace provided by the server.
|
||||||
|
@BuiltValueField(wireName: r'error')
|
||||||
|
String get error;
|
||||||
|
|
||||||
|
/// The error message from the stacktrace.
|
||||||
|
@BuiltValueField(wireName: r'message')
|
||||||
|
String get message;
|
||||||
|
|
||||||
|
ExceptionError._();
|
||||||
|
|
||||||
|
@BuiltValueHook(initializeBuilder: true)
|
||||||
|
static void _defaults(ExceptionErrorBuilder b) => b;
|
||||||
|
|
||||||
|
factory ExceptionError([void updates(ExceptionErrorBuilder b)]) = _$ExceptionError;
|
||||||
|
|
||||||
|
@BuiltValueSerializer(custom: true)
|
||||||
|
static Serializer<ExceptionError> get serializer => _$ExceptionErrorSerializer();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _$ExceptionErrorSerializer implements StructuredSerializer<ExceptionError> {
|
||||||
|
@override
|
||||||
|
final Iterable<Type> types = const [ExceptionError, _$ExceptionError];
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String wireName = r'ExceptionError';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Iterable<Object?> serialize(Serializers serializers, ExceptionError object,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
final result = <Object?>[];
|
||||||
|
result
|
||||||
|
..add(r'error')
|
||||||
|
..add(serializers.serialize(object.error,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
result
|
||||||
|
..add(r'message')
|
||||||
|
..add(serializers.serialize(object.message,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
ExceptionError deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
final result = ExceptionErrorBuilder();
|
||||||
|
|
||||||
|
final iterator = serialized.iterator;
|
||||||
|
while (iterator.moveNext()) {
|
||||||
|
final key = iterator.current as String;
|
||||||
|
iterator.moveNext();
|
||||||
|
final Object? value = iterator.current;
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case r'error':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.error = valueDes;
|
||||||
|
break;
|
||||||
|
case r'message':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.message = valueDes;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
243
lib/src/model/regions.dart
Normal file
243
lib/src/model/regions.dart
Normal file
|
@ -0,0 +1,243 @@
|
||||||
|
//
|
||||||
|
// 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 'regions.g.dart';
|
||||||
|
|
||||||
|
class Regions extends EnumClass {
|
||||||
|
|
||||||
|
@BuiltValueEnumConst(wireName: r'DZ')
|
||||||
|
static const Regions DZ = _$DZ;
|
||||||
|
@BuiltValueEnumConst(wireName: r'AR')
|
||||||
|
static const Regions AR = _$AR;
|
||||||
|
@BuiltValueEnumConst(wireName: r'AU')
|
||||||
|
static const Regions AU = _$AU;
|
||||||
|
@BuiltValueEnumConst(wireName: r'AT')
|
||||||
|
static const Regions AT = _$AT;
|
||||||
|
@BuiltValueEnumConst(wireName: r'AZ')
|
||||||
|
static const Regions AZ = _$AZ;
|
||||||
|
@BuiltValueEnumConst(wireName: r'BH')
|
||||||
|
static const Regions BH = _$BH;
|
||||||
|
@BuiltValueEnumConst(wireName: r'BD')
|
||||||
|
static const Regions BD = _$BD;
|
||||||
|
@BuiltValueEnumConst(wireName: r'BY')
|
||||||
|
static const Regions BY = _$BY;
|
||||||
|
@BuiltValueEnumConst(wireName: r'BE')
|
||||||
|
static const Regions BE = _$BE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'BO')
|
||||||
|
static const Regions BO = _$BO;
|
||||||
|
@BuiltValueEnumConst(wireName: r'BA')
|
||||||
|
static const Regions BA = _$BA;
|
||||||
|
@BuiltValueEnumConst(wireName: r'BR')
|
||||||
|
static const Regions BR = _$BR;
|
||||||
|
@BuiltValueEnumConst(wireName: r'BG')
|
||||||
|
static const Regions BG = _$BG;
|
||||||
|
@BuiltValueEnumConst(wireName: r'CA')
|
||||||
|
static const Regions CA = _$CA;
|
||||||
|
@BuiltValueEnumConst(wireName: r'CL')
|
||||||
|
static const Regions CL = _$CL;
|
||||||
|
@BuiltValueEnumConst(wireName: r'CO')
|
||||||
|
static const Regions CO = _$CO;
|
||||||
|
@BuiltValueEnumConst(wireName: r'CR')
|
||||||
|
static const Regions CR = _$CR;
|
||||||
|
@BuiltValueEnumConst(wireName: r'HR')
|
||||||
|
static const Regions HR = _$HR;
|
||||||
|
@BuiltValueEnumConst(wireName: r'CY')
|
||||||
|
static const Regions CY = _$CY;
|
||||||
|
@BuiltValueEnumConst(wireName: r'CZ')
|
||||||
|
static const Regions CZ = _$CZ;
|
||||||
|
@BuiltValueEnumConst(wireName: r'DK')
|
||||||
|
static const Regions DK = _$DK;
|
||||||
|
@BuiltValueEnumConst(wireName: r'DO')
|
||||||
|
static const Regions DO = _$DO;
|
||||||
|
@BuiltValueEnumConst(wireName: r'EC')
|
||||||
|
static const Regions EC = _$EC;
|
||||||
|
@BuiltValueEnumConst(wireName: r'EG')
|
||||||
|
static const Regions EG = _$EG;
|
||||||
|
@BuiltValueEnumConst(wireName: r'SV')
|
||||||
|
static const Regions SV = _$SV;
|
||||||
|
@BuiltValueEnumConst(wireName: r'EE')
|
||||||
|
static const Regions EE = _$EE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'FI')
|
||||||
|
static const Regions FI = _$FI;
|
||||||
|
@BuiltValueEnumConst(wireName: r'FR')
|
||||||
|
static const Regions FR = _$FR;
|
||||||
|
@BuiltValueEnumConst(wireName: r'GE')
|
||||||
|
static const Regions GE = _$GE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'DE')
|
||||||
|
static const Regions DE = _$DE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'GH')
|
||||||
|
static const Regions GH = _$GH;
|
||||||
|
@BuiltValueEnumConst(wireName: r'GR')
|
||||||
|
static const Regions GR = _$GR;
|
||||||
|
@BuiltValueEnumConst(wireName: r'GT')
|
||||||
|
static const Regions GT = _$GT;
|
||||||
|
@BuiltValueEnumConst(wireName: r'HN')
|
||||||
|
static const Regions HN = _$HN;
|
||||||
|
@BuiltValueEnumConst(wireName: r'HK')
|
||||||
|
static const Regions HK = _$HK;
|
||||||
|
@BuiltValueEnumConst(wireName: r'HU')
|
||||||
|
static const Regions HU = _$HU;
|
||||||
|
@BuiltValueEnumConst(wireName: r'IS')
|
||||||
|
static const Regions IS = _$IS;
|
||||||
|
@BuiltValueEnumConst(wireName: r'IN')
|
||||||
|
static const Regions IN = _$IN;
|
||||||
|
@BuiltValueEnumConst(wireName: r'ID')
|
||||||
|
static const Regions ID = _$ID;
|
||||||
|
@BuiltValueEnumConst(wireName: r'IQ')
|
||||||
|
static const Regions IQ = _$IQ;
|
||||||
|
@BuiltValueEnumConst(wireName: r'IE')
|
||||||
|
static const Regions IE = _$IE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'IL')
|
||||||
|
static const Regions IL = _$IL;
|
||||||
|
@BuiltValueEnumConst(wireName: r'IT')
|
||||||
|
static const Regions IT = _$IT;
|
||||||
|
@BuiltValueEnumConst(wireName: r'JM')
|
||||||
|
static const Regions JM = _$JM;
|
||||||
|
@BuiltValueEnumConst(wireName: r'JP')
|
||||||
|
static const Regions JP = _$JP;
|
||||||
|
@BuiltValueEnumConst(wireName: r'JO')
|
||||||
|
static const Regions JO = _$JO;
|
||||||
|
@BuiltValueEnumConst(wireName: r'KZ')
|
||||||
|
static const Regions KZ = _$KZ;
|
||||||
|
@BuiltValueEnumConst(wireName: r'KE')
|
||||||
|
static const Regions KE = _$KE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'KW')
|
||||||
|
static const Regions KW = _$KW;
|
||||||
|
@BuiltValueEnumConst(wireName: r'LV')
|
||||||
|
static const Regions LV = _$LV;
|
||||||
|
@BuiltValueEnumConst(wireName: r'LB')
|
||||||
|
static const Regions LB = _$LB;
|
||||||
|
@BuiltValueEnumConst(wireName: r'LY')
|
||||||
|
static const Regions LY = _$LY;
|
||||||
|
@BuiltValueEnumConst(wireName: r'LI')
|
||||||
|
static const Regions LI = _$LI;
|
||||||
|
@BuiltValueEnumConst(wireName: r'LT')
|
||||||
|
static const Regions LT = _$LT;
|
||||||
|
@BuiltValueEnumConst(wireName: r'LU')
|
||||||
|
static const Regions LU = _$LU;
|
||||||
|
@BuiltValueEnumConst(wireName: r'MY')
|
||||||
|
static const Regions MY = _$MY;
|
||||||
|
@BuiltValueEnumConst(wireName: r'MT')
|
||||||
|
static const Regions MT = _$MT;
|
||||||
|
@BuiltValueEnumConst(wireName: r'MX')
|
||||||
|
static const Regions MX = _$MX;
|
||||||
|
@BuiltValueEnumConst(wireName: r'ME')
|
||||||
|
static const Regions ME = _$ME;
|
||||||
|
@BuiltValueEnumConst(wireName: r'MA')
|
||||||
|
static const Regions MA = _$MA;
|
||||||
|
@BuiltValueEnumConst(wireName: r'NP')
|
||||||
|
static const Regions NP = _$NP;
|
||||||
|
@BuiltValueEnumConst(wireName: r'NL')
|
||||||
|
static const Regions NL = _$NL;
|
||||||
|
@BuiltValueEnumConst(wireName: r'NZ')
|
||||||
|
static const Regions NZ = _$NZ;
|
||||||
|
@BuiltValueEnumConst(wireName: r'NI')
|
||||||
|
static const Regions NI = _$NI;
|
||||||
|
@BuiltValueEnumConst(wireName: r'NG')
|
||||||
|
static const Regions NG = _$NG;
|
||||||
|
@BuiltValueEnumConst(wireName: r'MK')
|
||||||
|
static const Regions MK = _$MK;
|
||||||
|
@BuiltValueEnumConst(wireName: r'NO')
|
||||||
|
static const Regions NO = _$NO;
|
||||||
|
@BuiltValueEnumConst(wireName: r'OM')
|
||||||
|
static const Regions OM = _$OM;
|
||||||
|
@BuiltValueEnumConst(wireName: r'PK')
|
||||||
|
static const Regions PK = _$PK;
|
||||||
|
@BuiltValueEnumConst(wireName: r'PA')
|
||||||
|
static const Regions PA = _$PA;
|
||||||
|
@BuiltValueEnumConst(wireName: r'PG')
|
||||||
|
static const Regions PG = _$PG;
|
||||||
|
@BuiltValueEnumConst(wireName: r'PY')
|
||||||
|
static const Regions PY = _$PY;
|
||||||
|
@BuiltValueEnumConst(wireName: r'PE')
|
||||||
|
static const Regions PE = _$PE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'PH')
|
||||||
|
static const Regions PH = _$PH;
|
||||||
|
@BuiltValueEnumConst(wireName: r'PL')
|
||||||
|
static const Regions PL = _$PL;
|
||||||
|
@BuiltValueEnumConst(wireName: r'PT')
|
||||||
|
static const Regions PT = _$PT;
|
||||||
|
@BuiltValueEnumConst(wireName: r'PR')
|
||||||
|
static const Regions PR = _$PR;
|
||||||
|
@BuiltValueEnumConst(wireName: r'QA')
|
||||||
|
static const Regions QA = _$QA;
|
||||||
|
@BuiltValueEnumConst(wireName: r'RO')
|
||||||
|
static const Regions RO = _$RO;
|
||||||
|
@BuiltValueEnumConst(wireName: r'RU')
|
||||||
|
static const Regions RU = _$RU;
|
||||||
|
@BuiltValueEnumConst(wireName: r'SA')
|
||||||
|
static const Regions SA = _$SA;
|
||||||
|
@BuiltValueEnumConst(wireName: r'SN')
|
||||||
|
static const Regions SN = _$SN;
|
||||||
|
@BuiltValueEnumConst(wireName: r'RS')
|
||||||
|
static const Regions RS = _$RS;
|
||||||
|
@BuiltValueEnumConst(wireName: r'SG')
|
||||||
|
static const Regions SG = _$SG;
|
||||||
|
@BuiltValueEnumConst(wireName: r'SK')
|
||||||
|
static const Regions SK = _$SK;
|
||||||
|
@BuiltValueEnumConst(wireName: r'SI')
|
||||||
|
static const Regions SI = _$SI;
|
||||||
|
@BuiltValueEnumConst(wireName: r'ZA')
|
||||||
|
static const Regions ZA = _$ZA;
|
||||||
|
@BuiltValueEnumConst(wireName: r'KR')
|
||||||
|
static const Regions KR = _$KR;
|
||||||
|
@BuiltValueEnumConst(wireName: r'ES')
|
||||||
|
static const Regions ES = _$ES;
|
||||||
|
@BuiltValueEnumConst(wireName: r'LK')
|
||||||
|
static const Regions LK = _$LK;
|
||||||
|
@BuiltValueEnumConst(wireName: r'SE')
|
||||||
|
static const Regions SE = _$SE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'CH')
|
||||||
|
static const Regions CH = _$CH;
|
||||||
|
@BuiltValueEnumConst(wireName: r'TW')
|
||||||
|
static const Regions TW = _$TW;
|
||||||
|
@BuiltValueEnumConst(wireName: r'TZ')
|
||||||
|
static const Regions TZ = _$TZ;
|
||||||
|
@BuiltValueEnumConst(wireName: r'TH')
|
||||||
|
static const Regions TH = _$TH;
|
||||||
|
@BuiltValueEnumConst(wireName: r'TN')
|
||||||
|
static const Regions TN = _$TN;
|
||||||
|
@BuiltValueEnumConst(wireName: r'TR')
|
||||||
|
static const Regions TR = _$TR;
|
||||||
|
@BuiltValueEnumConst(wireName: r'UG')
|
||||||
|
static const Regions UG = _$UG;
|
||||||
|
@BuiltValueEnumConst(wireName: r'UA')
|
||||||
|
static const Regions UA = _$UA;
|
||||||
|
@BuiltValueEnumConst(wireName: r'AE')
|
||||||
|
static const Regions AE = _$AE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'GB')
|
||||||
|
static const Regions GB = _$GB;
|
||||||
|
@BuiltValueEnumConst(wireName: r'US')
|
||||||
|
static const Regions US = _$US;
|
||||||
|
@BuiltValueEnumConst(wireName: r'UY')
|
||||||
|
static const Regions UY = _$UY;
|
||||||
|
@BuiltValueEnumConst(wireName: r'VE')
|
||||||
|
static const Regions VE = _$VE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'VN')
|
||||||
|
static const Regions VN = _$VN;
|
||||||
|
@BuiltValueEnumConst(wireName: r'YE')
|
||||||
|
static const Regions YE = _$YE;
|
||||||
|
@BuiltValueEnumConst(wireName: r'ZW')
|
||||||
|
static const Regions ZW = _$ZW;
|
||||||
|
|
||||||
|
static Serializer<Regions> get serializer => _$regionsSerializer;
|
||||||
|
|
||||||
|
const Regions._(String name): super(name);
|
||||||
|
|
||||||
|
static BuiltSet<Regions> get values => _$values;
|
||||||
|
static Regions 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 RegionsMixin = Object with _$RegionsMixin;
|
||||||
|
|
299
lib/src/model/stream.dart
Normal file
299
lib/src/model/stream.dart
Normal file
|
@ -0,0 +1,299 @@
|
||||||
|
//
|
||||||
|
// 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 'stream.g.dart';
|
||||||
|
|
||||||
|
/// Stream
|
||||||
|
///
|
||||||
|
/// Properties:
|
||||||
|
/// * [url] - The URL of the stream.
|
||||||
|
/// * [format] - The format of the stream.
|
||||||
|
/// * [quality] - The quality of the stream.
|
||||||
|
/// * [mimeType] - The mime type of the stream.
|
||||||
|
/// * [codec] - The codec of the stream.
|
||||||
|
/// * [videoOnly]
|
||||||
|
/// * [bitrate]
|
||||||
|
/// * [initStart]
|
||||||
|
/// * [initEnd]
|
||||||
|
/// * [indexStart]
|
||||||
|
/// * [indexEnd]
|
||||||
|
/// * [width]
|
||||||
|
/// * [height]
|
||||||
|
/// * [fps]
|
||||||
|
abstract class Stream implements Built<Stream, StreamBuilder> {
|
||||||
|
/// The URL of the stream.
|
||||||
|
@BuiltValueField(wireName: r'url')
|
||||||
|
String? get url;
|
||||||
|
|
||||||
|
/// The format of the stream.
|
||||||
|
@BuiltValueField(wireName: r'format')
|
||||||
|
StreamFormatEnum? get format;
|
||||||
|
// enum formatEnum { MPEG_4, v3GPP, WEBM, M4A, WEBMA_OPUS, };
|
||||||
|
|
||||||
|
/// The quality of the stream.
|
||||||
|
@BuiltValueField(wireName: r'quality')
|
||||||
|
String? get quality;
|
||||||
|
|
||||||
|
/// The mime type of the stream.
|
||||||
|
@BuiltValueField(wireName: r'mimeType')
|
||||||
|
String? get mimeType;
|
||||||
|
|
||||||
|
/// The codec of the stream.
|
||||||
|
@BuiltValueField(wireName: r'codec')
|
||||||
|
String? get codec;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'videoOnly')
|
||||||
|
bool? get videoOnly;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'bitrate')
|
||||||
|
int? get bitrate;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'initStart')
|
||||||
|
int? get initStart;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'initEnd')
|
||||||
|
int? get initEnd;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'indexStart')
|
||||||
|
int? get indexStart;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'indexEnd')
|
||||||
|
int? get indexEnd;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'width')
|
||||||
|
int? get width;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'height')
|
||||||
|
int? get height;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'fps')
|
||||||
|
int? get fps;
|
||||||
|
|
||||||
|
Stream._();
|
||||||
|
|
||||||
|
@BuiltValueHook(initializeBuilder: true)
|
||||||
|
static void _defaults(StreamBuilder b) => b;
|
||||||
|
|
||||||
|
factory Stream([void updates(StreamBuilder b)]) = _$Stream;
|
||||||
|
|
||||||
|
@BuiltValueSerializer(custom: true)
|
||||||
|
static Serializer<Stream> get serializer => _$StreamSerializer();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _$StreamSerializer implements StructuredSerializer<Stream> {
|
||||||
|
@override
|
||||||
|
final Iterable<Type> types = const [Stream, _$Stream];
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String wireName = r'Stream';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Iterable<Object?> serialize(Serializers serializers, Stream object,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
final result = <Object?>[];
|
||||||
|
if (object.url != null) {
|
||||||
|
result
|
||||||
|
..add(r'url')
|
||||||
|
..add(serializers.serialize(object.url,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.format != null) {
|
||||||
|
result
|
||||||
|
..add(r'format')
|
||||||
|
..add(serializers.serialize(object.format,
|
||||||
|
specifiedType: const FullType(StreamFormatEnum)));
|
||||||
|
}
|
||||||
|
if (object.quality != null) {
|
||||||
|
result
|
||||||
|
..add(r'quality')
|
||||||
|
..add(serializers.serialize(object.quality,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.mimeType != null) {
|
||||||
|
result
|
||||||
|
..add(r'mimeType')
|
||||||
|
..add(serializers.serialize(object.mimeType,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.codec != null) {
|
||||||
|
result
|
||||||
|
..add(r'codec')
|
||||||
|
..add(serializers.serialize(object.codec,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.videoOnly != null) {
|
||||||
|
result
|
||||||
|
..add(r'videoOnly')
|
||||||
|
..add(serializers.serialize(object.videoOnly,
|
||||||
|
specifiedType: const FullType(bool)));
|
||||||
|
}
|
||||||
|
if (object.bitrate != null) {
|
||||||
|
result
|
||||||
|
..add(r'bitrate')
|
||||||
|
..add(serializers.serialize(object.bitrate,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
|
if (object.initStart != null) {
|
||||||
|
result
|
||||||
|
..add(r'initStart')
|
||||||
|
..add(serializers.serialize(object.initStart,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
|
if (object.initEnd != null) {
|
||||||
|
result
|
||||||
|
..add(r'initEnd')
|
||||||
|
..add(serializers.serialize(object.initEnd,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
|
if (object.indexStart != null) {
|
||||||
|
result
|
||||||
|
..add(r'indexStart')
|
||||||
|
..add(serializers.serialize(object.indexStart,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
|
if (object.indexEnd != null) {
|
||||||
|
result
|
||||||
|
..add(r'indexEnd')
|
||||||
|
..add(serializers.serialize(object.indexEnd,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
|
if (object.width != null) {
|
||||||
|
result
|
||||||
|
..add(r'width')
|
||||||
|
..add(serializers.serialize(object.width,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
|
if (object.height != null) {
|
||||||
|
result
|
||||||
|
..add(r'height')
|
||||||
|
..add(serializers.serialize(object.height,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
|
if (object.fps != null) {
|
||||||
|
result
|
||||||
|
..add(r'fps')
|
||||||
|
..add(serializers.serialize(object.fps,
|
||||||
|
specifiedType: const FullType(int)));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Stream deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
final result = StreamBuilder();
|
||||||
|
|
||||||
|
final iterator = serialized.iterator;
|
||||||
|
while (iterator.moveNext()) {
|
||||||
|
final key = iterator.current as String;
|
||||||
|
iterator.moveNext();
|
||||||
|
final Object? value = iterator.current;
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case r'url':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.url = valueDes;
|
||||||
|
break;
|
||||||
|
case r'format':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(StreamFormatEnum)) as StreamFormatEnum;
|
||||||
|
result.format = valueDes;
|
||||||
|
break;
|
||||||
|
case r'quality':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.quality = valueDes;
|
||||||
|
break;
|
||||||
|
case r'mimeType':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.mimeType = valueDes;
|
||||||
|
break;
|
||||||
|
case r'codec':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.codec = valueDes;
|
||||||
|
break;
|
||||||
|
case r'videoOnly':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(bool)) as bool;
|
||||||
|
result.videoOnly = valueDes;
|
||||||
|
break;
|
||||||
|
case r'bitrate':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
result.bitrate = valueDes;
|
||||||
|
break;
|
||||||
|
case r'initStart':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
result.initStart = valueDes;
|
||||||
|
break;
|
||||||
|
case r'initEnd':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
result.initEnd = valueDes;
|
||||||
|
break;
|
||||||
|
case r'indexStart':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
result.indexStart = valueDes;
|
||||||
|
break;
|
||||||
|
case r'indexEnd':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
result.indexEnd = valueDes;
|
||||||
|
break;
|
||||||
|
case r'width':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
result.width = valueDes;
|
||||||
|
break;
|
||||||
|
case r'height':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
result.height = valueDes;
|
||||||
|
break;
|
||||||
|
case r'fps':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(int)) as int;
|
||||||
|
result.fps = valueDes;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class StreamFormatEnum extends EnumClass {
|
||||||
|
|
||||||
|
/// The format of the stream.
|
||||||
|
@BuiltValueEnumConst(wireName: r'MPEG_4')
|
||||||
|
static const StreamFormatEnum mPEG4 = _$streamFormatEnum_mPEG4;
|
||||||
|
/// The format of the stream.
|
||||||
|
@BuiltValueEnumConst(wireName: r'v3GPP')
|
||||||
|
static const StreamFormatEnum v3GPP = _$streamFormatEnum_v3GPP;
|
||||||
|
/// The format of the stream.
|
||||||
|
@BuiltValueEnumConst(wireName: r'WEBM')
|
||||||
|
static const StreamFormatEnum WEBM = _$streamFormatEnum_WEBM;
|
||||||
|
/// The format of the stream.
|
||||||
|
@BuiltValueEnumConst(wireName: r'M4A')
|
||||||
|
static const StreamFormatEnum m4A = _$streamFormatEnum_m4A;
|
||||||
|
/// The format of the stream.
|
||||||
|
@BuiltValueEnumConst(wireName: r'WEBMA_OPUS')
|
||||||
|
static const StreamFormatEnum WEBMA_OPUS = _$streamFormatEnum_WEBMA_OPUS;
|
||||||
|
|
||||||
|
static Serializer<StreamFormatEnum> get serializer => _$streamFormatEnumSerializer;
|
||||||
|
|
||||||
|
const StreamFormatEnum._(String name): super(name);
|
||||||
|
|
||||||
|
static BuiltSet<StreamFormatEnum> get values => _$streamFormatEnumValues;
|
||||||
|
static StreamFormatEnum valueOf(String name) => _$streamFormatEnumValueOf(name);
|
||||||
|
}
|
||||||
|
|
208
lib/src/model/stream_item.dart
Normal file
208
lib/src/model/stream_item.dart
Normal file
|
@ -0,0 +1,208 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
import 'package:built_value/built_value.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
|
||||||
|
part 'stream_item.g.dart';
|
||||||
|
|
||||||
|
/// StreamItem
|
||||||
|
///
|
||||||
|
/// Properties:
|
||||||
|
/// * [duration] - The duration of the video in seconds.
|
||||||
|
/// * [thumbnail] - The thumbnail of the video.
|
||||||
|
/// * [title] - The title of the video.
|
||||||
|
/// * [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 to the video.
|
||||||
|
/// * [views] - The number of views the video has.
|
||||||
|
abstract class StreamItem implements Built<StreamItem, StreamItemBuilder> {
|
||||||
|
/// The duration of the video in seconds.
|
||||||
|
@BuiltValueField(wireName: r'duration')
|
||||||
|
int get duration;
|
||||||
|
|
||||||
|
/// The thumbnail of the video.
|
||||||
|
@BuiltValueField(wireName: r'thumbnail')
|
||||||
|
String get thumbnail;
|
||||||
|
|
||||||
|
/// The title of the video.
|
||||||
|
@BuiltValueField(wireName: r'title')
|
||||||
|
String get title;
|
||||||
|
|
||||||
|
/// 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 to the video.
|
||||||
|
@BuiltValueField(wireName: r'url')
|
||||||
|
String get url;
|
||||||
|
|
||||||
|
/// The number of views the video has.
|
||||||
|
@BuiltValueField(wireName: r'views')
|
||||||
|
int? get views;
|
||||||
|
|
||||||
|
StreamItem._();
|
||||||
|
|
||||||
|
@BuiltValueHook(initializeBuilder: true)
|
||||||
|
static void _defaults(StreamItemBuilder b) => b;
|
||||||
|
|
||||||
|
factory StreamItem([void updates(StreamItemBuilder b)]) = _$StreamItem;
|
||||||
|
|
||||||
|
@BuiltValueSerializer(custom: true)
|
||||||
|
static Serializer<StreamItem> get serializer => _$StreamItemSerializer();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _$StreamItemSerializer implements StructuredSerializer<StreamItem> {
|
||||||
|
@override
|
||||||
|
final Iterable<Type> types = const [StreamItem, _$StreamItem];
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String wireName = r'StreamItem';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Iterable<Object?> serialize(Serializers serializers, StreamItem 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.uploadedDate != null) {
|
||||||
|
result
|
||||||
|
..add(r'uploadedDate')
|
||||||
|
..add(serializers.serialize(object.uploadedDate,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
|
if (object.uploaderAvatar != null) {
|
||||||
|
result
|
||||||
|
..add(r'uploaderAvatar')
|
||||||
|
..add(serializers.serialize(object.uploaderAvatar,
|
||||||
|
specifiedType: const FullType(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)));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
StreamItem deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
final result = StreamItemBuilder();
|
||||||
|
|
||||||
|
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'uploadedDate':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
result.uploadedDate = valueDes;
|
||||||
|
break;
|
||||||
|
case r'uploaderAvatar':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
89
lib/src/model/video_info.dart
Normal file
89
lib/src/model/video_info.dart
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
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:built_value/built_value.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
|
||||||
|
part 'video_info.g.dart';
|
||||||
|
|
||||||
|
/// VideoInfo
|
||||||
|
///
|
||||||
|
/// Properties:
|
||||||
|
/// * [audioStreams]
|
||||||
|
/// * [relatedStreams]
|
||||||
|
abstract class VideoInfo implements Built<VideoInfo, VideoInfoBuilder> {
|
||||||
|
@BuiltValueField(wireName: r'audioStreams')
|
||||||
|
BuiltList<Stream>? get audioStreams;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: r'relatedStreams')
|
||||||
|
BuiltList<StreamItem>? get relatedStreams;
|
||||||
|
|
||||||
|
VideoInfo._();
|
||||||
|
|
||||||
|
@BuiltValueHook(initializeBuilder: true)
|
||||||
|
static void _defaults(VideoInfoBuilder b) => b;
|
||||||
|
|
||||||
|
factory VideoInfo([void updates(VideoInfoBuilder b)]) = _$VideoInfo;
|
||||||
|
|
||||||
|
@BuiltValueSerializer(custom: true)
|
||||||
|
static Serializer<VideoInfo> get serializer => _$VideoInfoSerializer();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _$VideoInfoSerializer implements StructuredSerializer<VideoInfo> {
|
||||||
|
@override
|
||||||
|
final Iterable<Type> types = const [VideoInfo, _$VideoInfo];
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String wireName = r'VideoInfo';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Iterable<Object?> serialize(Serializers serializers, VideoInfo object,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
final result = <Object?>[];
|
||||||
|
if (object.audioStreams != null) {
|
||||||
|
result
|
||||||
|
..add(r'audioStreams')
|
||||||
|
..add(serializers.serialize(object.audioStreams,
|
||||||
|
specifiedType: const FullType(BuiltList, [FullType(Stream)])));
|
||||||
|
}
|
||||||
|
if (object.relatedStreams != null) {
|
||||||
|
result
|
||||||
|
..add(r'relatedStreams')
|
||||||
|
..add(serializers.serialize(object.relatedStreams,
|
||||||
|
specifiedType: const FullType(BuiltList, [FullType(StreamItem)])));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
VideoInfo deserialize(Serializers serializers, Iterable<Object?> serialized,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) {
|
||||||
|
final result = VideoInfoBuilder();
|
||||||
|
|
||||||
|
final iterator = serialized.iterator;
|
||||||
|
while (iterator.moveNext()) {
|
||||||
|
final key = iterator.current as String;
|
||||||
|
iterator.moveNext();
|
||||||
|
final Object? value = iterator.current;
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case r'audioStreams':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(BuiltList, [FullType(Stream)])) as BuiltList<Stream>;
|
||||||
|
result.audioStreams.replace(valueDes);
|
||||||
|
break;
|
||||||
|
case r'relatedStreams':
|
||||||
|
final valueDes = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(BuiltList, [FullType(StreamItem)])) as BuiltList<StreamItem>;
|
||||||
|
result.relatedStreams.replace(valueDes);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
42
lib/src/serializers.dart
Normal file
42
lib/src/serializers.dart
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
//
|
||||||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||||
|
//
|
||||||
|
|
||||||
|
// ignore_for_file: unused_import
|
||||||
|
|
||||||
|
import 'package:built_collection/built_collection.dart';
|
||||||
|
import 'package:built_value/json_object.dart';
|
||||||
|
import 'package:built_value/serializer.dart';
|
||||||
|
import 'package:built_value/standard_json_plugin.dart';
|
||||||
|
import 'package:built_value/iso_8601_date_time_serializer.dart';
|
||||||
|
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/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/video_info.dart';
|
||||||
|
|
||||||
|
part 'serializers.g.dart';
|
||||||
|
|
||||||
|
@SerializersFor([
|
||||||
|
ChannelInfo,
|
||||||
|
ExceptionError,
|
||||||
|
Regions,
|
||||||
|
Stream,
|
||||||
|
StreamItem,
|
||||||
|
VideoInfo,
|
||||||
|
])
|
||||||
|
Serializers serializers = (_$serializers.toBuilder()
|
||||||
|
..addBuilderFactory(
|
||||||
|
const FullType(BuiltList, [FullType(StreamItem)]),
|
||||||
|
() => ListBuilder<StreamItem>(),
|
||||||
|
)
|
||||||
|
..add(const DateSerializer())
|
||||||
|
..add(Iso8601DateTimeSerializer()))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Serializers standardSerializers =
|
||||||
|
(serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build();
|
17
pubspec.yaml
Normal file
17
pubspec.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
name: piped_api
|
||||||
|
version: 1.0.0
|
||||||
|
description: Automatically generated OpenAPI bindings for Piped.
|
||||||
|
homepage: homepage
|
||||||
|
|
||||||
|
environment:
|
||||||
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
dio: '>=4.0.0 <5.0.0'
|
||||||
|
built_value: '>=8.1.0 <9.0.0'
|
||||||
|
built_collection: '>=5.1.0 <6.0.0'
|
||||||
|
|
||||||
|
dev_dependencies:
|
||||||
|
built_value_generator: '>=8.1.0 <9.0.0'
|
||||||
|
build_runner: any
|
||||||
|
test: '>=1.16.0 <1.17.0'
|
64
test/channel_info_test.dart
Normal file
64
test/channel_info_test.dart
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:piped_api/piped_api.dart';
|
||||||
|
|
||||||
|
// tests for ChannelInfo
|
||||||
|
void main() {
|
||||||
|
final instance = ChannelInfoBuilder();
|
||||||
|
// TODO add properties to the builder and call build()
|
||||||
|
|
||||||
|
group(ChannelInfo, () {
|
||||||
|
// The URL of the channel's avatar.
|
||||||
|
// String avatarUrl
|
||||||
|
test('to test the property `avatarUrl`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The URL of the channel's banner.
|
||||||
|
// String bannerUrl
|
||||||
|
test('to test the property `bannerUrl`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The channel's description.
|
||||||
|
// String description
|
||||||
|
test('to test the property `description`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The ID of the channel.
|
||||||
|
// String id
|
||||||
|
test('to test the property `id`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The name of the channel.
|
||||||
|
// String name
|
||||||
|
test('to test the property `name`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The parameter used to get the next page of related videos.
|
||||||
|
// String nextpage
|
||||||
|
test('to test the property `nextpage`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// BuiltList<StreamItem> relatedStreams
|
||||||
|
test('to test the property `relatedStreams`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The number of subscribers the channel has.
|
||||||
|
// int subscriberCount
|
||||||
|
test('to test the property `subscriberCount`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// Whether the channel is verified.
|
||||||
|
// bool verified
|
||||||
|
test('to test the property `verified`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
23
test/exception_error_test.dart
Normal file
23
test/exception_error_test.dart
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:piped_api/piped_api.dart';
|
||||||
|
|
||||||
|
// tests for ExceptionError
|
||||||
|
void main() {
|
||||||
|
final instance = ExceptionErrorBuilder();
|
||||||
|
// TODO add properties to the builder and call build()
|
||||||
|
|
||||||
|
group(ExceptionError, () {
|
||||||
|
// The stacktrace provided by the server.
|
||||||
|
// String error
|
||||||
|
test('to test the property `error`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The error message from the stacktrace.
|
||||||
|
// String message
|
||||||
|
test('to test the property `message`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
9
test/regions_test.dart
Normal file
9
test/regions_test.dart
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:piped_api/piped_api.dart';
|
||||||
|
|
||||||
|
// tests for Regions
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
group(Regions, () {
|
||||||
|
});
|
||||||
|
}
|
71
test/stream_item_test.dart
Normal file
71
test/stream_item_test.dart
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:piped_api/piped_api.dart';
|
||||||
|
|
||||||
|
// tests for StreamItem
|
||||||
|
void main() {
|
||||||
|
final instance = StreamItemBuilder();
|
||||||
|
// TODO add properties to the builder and call build()
|
||||||
|
|
||||||
|
group(StreamItem, () {
|
||||||
|
// The duration of the video in seconds.
|
||||||
|
// int duration
|
||||||
|
test('to test the property `duration`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The thumbnail of the video.
|
||||||
|
// 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 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 to the video.
|
||||||
|
// 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
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
86
test/stream_test.dart
Normal file
86
test/stream_test.dart
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:piped_api/piped_api.dart';
|
||||||
|
|
||||||
|
// tests for Stream
|
||||||
|
void main() {
|
||||||
|
final instance = StreamBuilder();
|
||||||
|
// TODO add properties to the builder and call build()
|
||||||
|
|
||||||
|
group(Stream, () {
|
||||||
|
// The URL of the stream.
|
||||||
|
// String url
|
||||||
|
test('to test the property `url`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The format of the stream.
|
||||||
|
// String format
|
||||||
|
test('to test the property `format`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The quality of the stream.
|
||||||
|
// String quality
|
||||||
|
test('to test the property `quality`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The mime type of the stream.
|
||||||
|
// String mimeType
|
||||||
|
test('to test the property `mimeType`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// The codec of the stream.
|
||||||
|
// String codec
|
||||||
|
test('to test the property `codec`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// bool videoOnly
|
||||||
|
test('to test the property `videoOnly`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// int bitrate
|
||||||
|
test('to test the property `bitrate`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// int initStart
|
||||||
|
test('to test the property `initStart`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// int initEnd
|
||||||
|
test('to test the property `initEnd`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// int indexStart
|
||||||
|
test('to test the property `indexStart`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// int indexEnd
|
||||||
|
test('to test the property `indexEnd`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// int width
|
||||||
|
test('to test the property `width`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// int height
|
||||||
|
test('to test the property `height`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// int fps
|
||||||
|
test('to test the property `fps`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
56
test/unauthenticated_api_test.dart
Normal file
56
test/unauthenticated_api_test.dart
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:piped_api/piped_api.dart';
|
||||||
|
|
||||||
|
|
||||||
|
/// tests for UnauthenticatedApi
|
||||||
|
void main() {
|
||||||
|
final instance = PipedApi().getUnauthenticatedApi();
|
||||||
|
|
||||||
|
group(UnauthenticatedApi, () {
|
||||||
|
// Gets Channel Information
|
||||||
|
//
|
||||||
|
// Gets all available Channel information about a channel.
|
||||||
|
//
|
||||||
|
//Future<ChannelInfo> channelInfoId(String channelId) async
|
||||||
|
test('test channelInfoId', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// Gets Channel Information
|
||||||
|
//
|
||||||
|
// Gets all available Channel information about a channel.
|
||||||
|
//
|
||||||
|
//Future<ChannelInfo> channelInfoName(String name) async
|
||||||
|
test('test channelInfoName', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// Gets Channel Information
|
||||||
|
//
|
||||||
|
// Gets all available Channel information about a channel.
|
||||||
|
//
|
||||||
|
//Future<ChannelInfo> channelInfoUsername(String username) async
|
||||||
|
test('test channelInfoUsername', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// Gets Video Information
|
||||||
|
//
|
||||||
|
// Gets all available Stream information about a video.
|
||||||
|
//
|
||||||
|
//Future<VideoInfo> streamInfo(String videoId) async
|
||||||
|
test('test streamInfo', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// Gets all Trending Videos
|
||||||
|
//
|
||||||
|
// Gets all Trending Videos in the requested country.
|
||||||
|
//
|
||||||
|
//Future<BuiltList<StreamItem>> trending(Regions region) async
|
||||||
|
test('test trending', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
21
test/video_info_test.dart
Normal file
21
test/video_info_test.dart
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import 'package:test/test.dart';
|
||||||
|
import 'package:piped_api/piped_api.dart';
|
||||||
|
|
||||||
|
// tests for VideoInfo
|
||||||
|
void main() {
|
||||||
|
final instance = VideoInfoBuilder();
|
||||||
|
// TODO add properties to the builder and call build()
|
||||||
|
|
||||||
|
group(VideoInfo, () {
|
||||||
|
// BuiltList<Stream> audioStreams
|
||||||
|
test('to test the property `audioStreams`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
// BuiltList<StreamItem> relatedStreams
|
||||||
|
test('to test the property `relatedStreams`', () async {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in a new issue