mirror of
https://github.com/TeamPiped/piped_dart.git
synced 2024-08-14 22:27:49 +00:00
306 lines
8.4 KiB
Dart
306 lines
8.4 KiB
Dart
|
//
|
||
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||
|
//
|
||
|
// @dart=2.7
|
||
|
|
||
|
// ignore_for_file: unused_import
|
||
|
|
||
|
import 'dart:async';
|
||
|
import 'package:dio/dio.dart';
|
||
|
import 'package:built_value/serializer.dart';
|
||
|
|
||
|
import 'package:built_collection/built_collection.dart';
|
||
|
import 'package:piped_api/model/channel_info.dart';
|
||
|
import 'package:piped_api/model/exception_error.dart';
|
||
|
import 'package:piped_api/model/regions.dart';
|
||
|
import 'package:piped_api/model/stream_item.dart';
|
||
|
import 'package:piped_api/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.
|
||
|
Future<Response<ChannelInfo>> channelInfoId(
|
||
|
String channelId, {
|
||
|
CancelToken cancelToken,
|
||
|
Map<String, dynamic> headers,
|
||
|
Map<String, dynamic> extra,
|
||
|
ValidateStatus validateStatus,
|
||
|
ProgressCallback onSendProgress,
|
||
|
ProgressCallback onReceiveProgress,
|
||
|
}) async {
|
||
|
final _request = RequestOptions(
|
||
|
path: r'/channel/{channelId}'.replaceAll('{' r'channelId' '}', channelId.toString()),
|
||
|
method: 'GET',
|
||
|
headers: <String, dynamic>{
|
||
|
...?headers,
|
||
|
},
|
||
|
extra: <String, dynamic>{
|
||
|
'secure': <Map<String, String>>[],
|
||
|
...?extra,
|
||
|
},
|
||
|
validateStatus: validateStatus,
|
||
|
contentType: 'application/json',
|
||
|
cancelToken: cancelToken,
|
||
|
onSendProgress: onSendProgress,
|
||
|
onReceiveProgress: onReceiveProgress,
|
||
|
);
|
||
|
|
||
|
dynamic _bodyData;
|
||
|
|
||
|
final _response = await _dio.request<dynamic>(
|
||
|
_request.path,
|
||
|
data: _bodyData,
|
||
|
options: _request,
|
||
|
);
|
||
|
|
||
|
const _responseType = FullType(ChannelInfo);
|
||
|
final _responseData = _serializers.deserialize(
|
||
|
_response.data,
|
||
|
specifiedType: _responseType,
|
||
|
) as ChannelInfo;
|
||
|
|
||
|
return Response<ChannelInfo>(
|
||
|
data: _responseData,
|
||
|
headers: _response.headers,
|
||
|
isRedirect: _response.isRedirect,
|
||
|
request: _response.request,
|
||
|
redirects: _response.redirects,
|
||
|
statusCode: _response.statusCode,
|
||
|
statusMessage: _response.statusMessage,
|
||
|
extra: _response.extra,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/// Gets Channel Information
|
||
|
///
|
||
|
/// Gets all available Channel information about a channel.
|
||
|
Future<Response<ChannelInfo>> channelInfoName(
|
||
|
String name, {
|
||
|
CancelToken cancelToken,
|
||
|
Map<String, dynamic> headers,
|
||
|
Map<String, dynamic> extra,
|
||
|
ValidateStatus validateStatus,
|
||
|
ProgressCallback onSendProgress,
|
||
|
ProgressCallback onReceiveProgress,
|
||
|
}) async {
|
||
|
final _request = RequestOptions(
|
||
|
path: r'/c/{name}'.replaceAll('{' r'name' '}', name.toString()),
|
||
|
method: 'GET',
|
||
|
headers: <String, dynamic>{
|
||
|
...?headers,
|
||
|
},
|
||
|
extra: <String, dynamic>{
|
||
|
'secure': <Map<String, String>>[],
|
||
|
...?extra,
|
||
|
},
|
||
|
validateStatus: validateStatus,
|
||
|
contentType: 'application/json',
|
||
|
cancelToken: cancelToken,
|
||
|
onSendProgress: onSendProgress,
|
||
|
onReceiveProgress: onReceiveProgress,
|
||
|
);
|
||
|
|
||
|
dynamic _bodyData;
|
||
|
|
||
|
final _response = await _dio.request<dynamic>(
|
||
|
_request.path,
|
||
|
data: _bodyData,
|
||
|
options: _request,
|
||
|
);
|
||
|
|
||
|
const _responseType = FullType(ChannelInfo);
|
||
|
final _responseData = _serializers.deserialize(
|
||
|
_response.data,
|
||
|
specifiedType: _responseType,
|
||
|
) as ChannelInfo;
|
||
|
|
||
|
return Response<ChannelInfo>(
|
||
|
data: _responseData,
|
||
|
headers: _response.headers,
|
||
|
isRedirect: _response.isRedirect,
|
||
|
request: _response.request,
|
||
|
redirects: _response.redirects,
|
||
|
statusCode: _response.statusCode,
|
||
|
statusMessage: _response.statusMessage,
|
||
|
extra: _response.extra,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/// Gets Channel Information
|
||
|
///
|
||
|
/// Gets all available Channel information about a channel.
|
||
|
Future<Response<ChannelInfo>> channelInfoUsername(
|
||
|
String username, {
|
||
|
CancelToken cancelToken,
|
||
|
Map<String, dynamic> headers,
|
||
|
Map<String, dynamic> extra,
|
||
|
ValidateStatus validateStatus,
|
||
|
ProgressCallback onSendProgress,
|
||
|
ProgressCallback onReceiveProgress,
|
||
|
}) async {
|
||
|
final _request = RequestOptions(
|
||
|
path: r'/user/{username}'.replaceAll('{' r'username' '}', username.toString()),
|
||
|
method: 'GET',
|
||
|
headers: <String, dynamic>{
|
||
|
...?headers,
|
||
|
},
|
||
|
extra: <String, dynamic>{
|
||
|
'secure': <Map<String, String>>[],
|
||
|
...?extra,
|
||
|
},
|
||
|
validateStatus: validateStatus,
|
||
|
contentType: 'application/json',
|
||
|
cancelToken: cancelToken,
|
||
|
onSendProgress: onSendProgress,
|
||
|
onReceiveProgress: onReceiveProgress,
|
||
|
);
|
||
|
|
||
|
dynamic _bodyData;
|
||
|
|
||
|
final _response = await _dio.request<dynamic>(
|
||
|
_request.path,
|
||
|
data: _bodyData,
|
||
|
options: _request,
|
||
|
);
|
||
|
|
||
|
const _responseType = FullType(ChannelInfo);
|
||
|
final _responseData = _serializers.deserialize(
|
||
|
_response.data,
|
||
|
specifiedType: _responseType,
|
||
|
) as ChannelInfo;
|
||
|
|
||
|
return Response<ChannelInfo>(
|
||
|
data: _responseData,
|
||
|
headers: _response.headers,
|
||
|
isRedirect: _response.isRedirect,
|
||
|
request: _response.request,
|
||
|
redirects: _response.redirects,
|
||
|
statusCode: _response.statusCode,
|
||
|
statusMessage: _response.statusMessage,
|
||
|
extra: _response.extra,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/// Gets Video Information
|
||
|
///
|
||
|
/// Gets all available Stream information about a video.
|
||
|
Future<Response<VideoInfo>> streamInfo(
|
||
|
String videoId, {
|
||
|
CancelToken cancelToken,
|
||
|
Map<String, dynamic> headers,
|
||
|
Map<String, dynamic> extra,
|
||
|
ValidateStatus validateStatus,
|
||
|
ProgressCallback onSendProgress,
|
||
|
ProgressCallback onReceiveProgress,
|
||
|
}) async {
|
||
|
final _request = RequestOptions(
|
||
|
path: r'/streams/{videoId}'.replaceAll('{' r'videoId' '}', videoId.toString()),
|
||
|
method: 'GET',
|
||
|
headers: <String, dynamic>{
|
||
|
...?headers,
|
||
|
},
|
||
|
extra: <String, dynamic>{
|
||
|
'secure': <Map<String, String>>[],
|
||
|
...?extra,
|
||
|
},
|
||
|
validateStatus: validateStatus,
|
||
|
contentType: 'application/json',
|
||
|
cancelToken: cancelToken,
|
||
|
onSendProgress: onSendProgress,
|
||
|
onReceiveProgress: onReceiveProgress,
|
||
|
);
|
||
|
|
||
|
dynamic _bodyData;
|
||
|
|
||
|
final _response = await _dio.request<dynamic>(
|
||
|
_request.path,
|
||
|
data: _bodyData,
|
||
|
options: _request,
|
||
|
);
|
||
|
|
||
|
const _responseType = FullType(VideoInfo);
|
||
|
final _responseData = _serializers.deserialize(
|
||
|
_response.data,
|
||
|
specifiedType: _responseType,
|
||
|
) as VideoInfo;
|
||
|
|
||
|
return Response<VideoInfo>(
|
||
|
data: _responseData,
|
||
|
headers: _response.headers,
|
||
|
isRedirect: _response.isRedirect,
|
||
|
request: _response.request,
|
||
|
redirects: _response.redirects,
|
||
|
statusCode: _response.statusCode,
|
||
|
statusMessage: _response.statusMessage,
|
||
|
extra: _response.extra,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/// Gets all Trending Videos
|
||
|
///
|
||
|
/// Gets all Trending Videos in the requested country.
|
||
|
Future<Response<BuiltList<StreamItem>>> trending(
|
||
|
Regions region, {
|
||
|
CancelToken cancelToken,
|
||
|
Map<String, dynamic> headers,
|
||
|
Map<String, dynamic> extra,
|
||
|
ValidateStatus validateStatus,
|
||
|
ProgressCallback onSendProgress,
|
||
|
ProgressCallback onReceiveProgress,
|
||
|
}) async {
|
||
|
final _request = RequestOptions(
|
||
|
path: r'/trending',
|
||
|
method: 'GET',
|
||
|
headers: <String, dynamic>{
|
||
|
...?headers,
|
||
|
},
|
||
|
queryParameters: <String, dynamic>{
|
||
|
r'region': region,
|
||
|
},
|
||
|
extra: <String, dynamic>{
|
||
|
'secure': <Map<String, String>>[],
|
||
|
...?extra,
|
||
|
},
|
||
|
validateStatus: validateStatus,
|
||
|
contentType: 'application/json',
|
||
|
cancelToken: cancelToken,
|
||
|
onSendProgress: onSendProgress,
|
||
|
onReceiveProgress: onReceiveProgress,
|
||
|
);
|
||
|
|
||
|
dynamic _bodyData;
|
||
|
|
||
|
final _response = await _dio.request<dynamic>(
|
||
|
_request.path,
|
||
|
data: _bodyData,
|
||
|
options: _request,
|
||
|
);
|
||
|
|
||
|
const _responseType = FullType(BuiltList, [FullType(StreamItem)]);
|
||
|
final BuiltList<StreamItem> _responseData = _serializers.deserialize(
|
||
|
_response.data,
|
||
|
specifiedType: _responseType,
|
||
|
) as BuiltList<StreamItem>;
|
||
|
|
||
|
return Response<BuiltList<StreamItem>>(
|
||
|
data: _responseData,
|
||
|
headers: _response.headers,
|
||
|
isRedirect: _response.isRedirect,
|
||
|
request: _response.request,
|
||
|
redirects: _response.redirects,
|
||
|
statusCode: _response.statusCode,
|
||
|
statusMessage: _response.statusMessage,
|
||
|
extra: _response.extra,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
}
|