// // 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/comments_page.dart'; import 'package:piped_api/src/model/exception_error.dart'; import 'package:piped_api/src/model/regions.dart'; import 'package:piped_api/src/model/search_filter.dart'; import 'package:piped_api/src/model/search_page.dart'; import 'package:piped_api/src/model/stream_item.dart'; import 'package:piped_api/src/model/streams_page.dart'; import 'package:piped_api/src/model/video_info.dart'; class UnauthenticatedApi { final Dio _dio; final Serializers _serializers; const UnauthenticatedApi(this._dio, this._serializers); /// Gets Channel Information from ID. /// 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 { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(ChannelInfo), ) as ChannelInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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 from name. /// 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 { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(ChannelInfo), ) as ChannelInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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 from username. /// 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 { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(ChannelInfo), ) as ChannelInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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 more channel videos /// Gets more channel videos. /// /// Parameters: /// * [channelId] - The channel ID of the YouTube channel you want to get more videos from. /// * [nextpage] - The next page token to get more 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 [StreamsPage] as data /// Throws [DioError] if API call or serialization fails Future> channelNextPage({ required String channelId, required String nextpage, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/nextpage/channel/{channelId}'.replaceAll('{' r'channelId' '}', channelId.toString()); final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'nextpage': encodeQueryParameter(_serializers, nextpage, const FullType(String)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); StreamsPage? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(StreamsPage), ) as StreamsPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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 Comments /// Gets the comments for a video. /// /// Parameters: /// * [videoId] - The video ID of the YouTube video you want to get comments 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 [CommentsPage] as data /// Throws [DioError] if API call or serialization fails Future> comments({ required String videoId, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/comments/{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, ); CommentsPage? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(CommentsPage), ) as CommentsPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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 more comments /// Gets more comments. /// /// Parameters: /// * [videoId] - The video ID of the YouTube video you want to get more comments from. /// * [nextpage] - The next page token to get more comments 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 [CommentsPage] as data /// Throws [DioError] if API call or serialization fails Future> commentsNextPage({ required String videoId, required String nextpage, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/nextpage/comments/{videoId}'.replaceAll('{' r'videoId' '}', videoId.toString()); final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'nextpage': encodeQueryParameter(_serializers, nextpage, const FullType(String)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); CommentsPage? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(CommentsPage), ) as CommentsPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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, ); } /// Generate a feed while unauthenticated, from a list of channelIds. /// Generates a user feed while unauthenticated. /// /// Parameters: /// * [channels] - A list of channelIds to generate a feed 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>> feedUnauthenticated({ required BuiltList channels, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/feed/unauthenticated'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'channels': encodeCollectionQueryParameter(_serializers, channels, const FullType(BuiltList, [FullType(String)]), format: ListFormat.csv,), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); BuiltList? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(BuiltList, [FullType(StreamItem)]), ) as BuiltList; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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, ); } /// Searches for videos, channels, and playlists. /// Searches for videos, channels, and playlists. /// /// Parameters: /// * [q] - The search query string. /// * [filter] - The filter parameter specifies a filter query that restricts the results to items that match the filter. /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// /// Returns a [Future] containing a [Response] with a [SearchPage] as data /// Throws [DioError] if API call or serialization fails Future> search({ required String q, required SearchFilter filter, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/search'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'q': encodeQueryParameter(_serializers, q, const FullType(String)), r'filter': encodeQueryParameter(_serializers, filter, const FullType(SearchFilter)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); SearchPage? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(SearchPage), ) as SearchPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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 more search results /// Gets more search results. /// /// Parameters: /// * [nextpage] - The next page token to get more search results from. /// * [q] - The search query string. /// * [filter] - The filter parameter specifies a filter query that restricts the results to items that match the filter. /// * [cancelToken] - A [CancelToken] that can be used to cancel the operation /// * [headers] - Can be used to add additional headers to the request /// * [extras] - Can be used to add flags to the request /// * [validateStatus] - A [ValidateStatus] callback that can be used to determine request success based on the HTTP status of the response /// * [onSendProgress] - A [ProgressCallback] that can be used to get the send progress /// * [onReceiveProgress] - A [ProgressCallback] that can be used to get the receive progress /// /// Returns a [Future] containing a [Response] with a [SearchPage] as data /// Throws [DioError] if API call or serialization fails Future> searchNextPage({ required String nextpage, required String q, required SearchFilter filter, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/nextpage/search'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { r'nextpage': encodeQueryParameter(_serializers, nextpage, const FullType(String)), r'q': encodeQueryParameter(_serializers, q, const FullType(String)), r'filter': encodeQueryParameter(_serializers, filter, const FullType(SearchFilter)), }; final _response = await _dio.request( _path, options: _options, queryParameters: _queryParameters, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); SearchPage? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(SearchPage), ) as SearchPage; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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 { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(VideoInfo), ) as VideoInfo; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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 { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(BuiltList, [FullType(StreamItem)]), ) as BuiltList; } catch (error, stackTrace) { throw DioError( requestOptions: _response.requestOptions, response: _response, type: DioErrorType.unknown, 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, ); } }