// // 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> channelInfoId({ required String channelId, CancelToken? cancelToken, Map? headers, Map? 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: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _response = await _dio.request( _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( 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> channelInfoName({ required String name, CancelToken? cancelToken, Map? headers, Map? 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: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _response = await _dio.request( _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( 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> channelInfoUsername({ required String username, CancelToken? cancelToken, Map? headers, Map? 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: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _response = await _dio.request( _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( 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> streamInfo({ required String videoId, CancelToken? cancelToken, Map? headers, Map? 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: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _response = await _dio.request( _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( 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] as data /// Throws [DioError] if API call or serialization fails Future>> trending({ required Regions region, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/trending'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'region': encodeQueryParameter(_serializers, region, const FullType(Regions)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); BuiltList _responseData; try { const _responseType = FullType(BuiltList, [FullType(StreamItem)]); _responseData = _serializers.deserialize( _response.data!, specifiedType: _responseType, ) as BuiltList; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.other, error: error, )..stackTrace = stackTrace; } return Response>( data: _responseData, headers: _response.headers, isRedirect: _response.isRedirect, requestOptions: _response.requestOptions, redirects: _response.redirects, statusCode: _response.statusCode, statusMessage: _response.statusMessage, extra: _response.extra, ); } }