// // 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:openapi/src/api_util.dart'; import 'package:openapi/src/model/create_library_dto.dart'; import 'package:openapi/src/model/library_response_dto.dart'; import 'package:openapi/src/model/library_stats_response_dto.dart'; import 'package:openapi/src/model/library_type.dart'; import 'package:openapi/src/model/scan_library_dto.dart'; import 'package:openapi/src/model/update_library_dto.dart'; import 'package:openapi/src/model/validate_library_dto.dart'; import 'package:openapi/src/model/validate_library_response_dto.dart'; class LibraryApi { final Dio _dio; final Serializers _serializers; const LibraryApi(this._dio, this._serializers); /// createLibrary /// /// /// Parameters: /// * [createLibraryDto] /// * [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 [LibraryResponseDto] as data /// Throws [DioException] if API call or serialization fails Future> createLibrary({ required CreateLibraryDto createLibraryDto, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/library'; final _options = Options( method: r'POST', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'cookie', 'keyName': 'immich_access_token', 'where': '', },{ 'type': 'apiKey', 'name': 'api_key', 'keyName': 'x-api-key', 'where': 'header', },{ 'type': 'http', 'scheme': 'Bearer', 'name': 'bearer', }, ], ...?extra, }, contentType: 'application/json', validateStatus: validateStatus, ); dynamic _bodyData; try { const _type = FullType(CreateLibraryDto); _bodyData = _serializers.serialize(createLibraryDto, specifiedType: _type); } catch(error, stackTrace) { throw DioException( requestOptions: _options.compose( _dio.options, _path, ), type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } final _response = await _dio.request( _path, data: _bodyData, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); LibraryResponseDto? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(LibraryResponseDto), ) as LibraryResponseDto; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.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, ); } /// deleteLibrary /// /// /// Parameters: /// * [id] /// * [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] /// Throws [DioException] if API call or serialization fails Future> deleteLibrary({ required String id, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/library/{id}'.replaceAll('{' r'id' '}', encodeQueryParameter(_serializers, id, const FullType(String)).toString()); final _options = Options( method: r'DELETE', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'cookie', 'keyName': 'immich_access_token', 'where': '', },{ 'type': 'apiKey', 'name': 'api_key', 'keyName': 'x-api-key', 'where': 'header', },{ 'type': 'http', 'scheme': 'Bearer', 'name': 'bearer', }, ], ...?extra, }, validateStatus: validateStatus, ); final _response = await _dio.request( _path, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); return _response; } /// getAllLibraries /// /// /// Parameters: /// * [type] /// * [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 [DioException] if API call or serialization fails Future>> getAllLibraries({ LibraryType? type, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/library'; final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'cookie', 'keyName': 'immich_access_token', 'where': '', },{ 'type': 'apiKey', 'name': 'api_key', 'keyName': 'x-api-key', 'where': 'header', },{ 'type': 'http', 'scheme': 'Bearer', 'name': 'bearer', }, ], ...?extra, }, validateStatus: validateStatus, ); final _queryParameters = { if (type != null) r'type': encodeQueryParameter(_serializers, type, const FullType(LibraryType)), }; 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(LibraryResponseDto)]), ) as BuiltList; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.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, ); } /// getLibrary /// /// /// Parameters: /// * [id] /// * [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 [LibraryResponseDto] as data /// Throws [DioException] if API call or serialization fails Future> getLibrary({ required String id, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/library/{id}'.replaceAll('{' r'id' '}', encodeQueryParameter(_serializers, id, const FullType(String)).toString()); final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'cookie', 'keyName': 'immich_access_token', 'where': '', },{ 'type': 'apiKey', 'name': 'api_key', 'keyName': 'x-api-key', 'where': 'header', },{ 'type': 'http', 'scheme': 'Bearer', 'name': 'bearer', }, ], ...?extra, }, validateStatus: validateStatus, ); final _response = await _dio.request( _path, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); LibraryResponseDto? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(LibraryResponseDto), ) as LibraryResponseDto; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.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, ); } /// getLibraryStatistics /// /// /// Parameters: /// * [id] /// * [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 [LibraryStatsResponseDto] as data /// Throws [DioException] if API call or serialization fails Future> getLibraryStatistics({ required String id, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/library/{id}/statistics'.replaceAll('{' r'id' '}', encodeQueryParameter(_serializers, id, const FullType(String)).toString()); final _options = Options( method: r'GET', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'cookie', 'keyName': 'immich_access_token', 'where': '', },{ 'type': 'apiKey', 'name': 'api_key', 'keyName': 'x-api-key', 'where': 'header', },{ 'type': 'http', 'scheme': 'Bearer', 'name': 'bearer', }, ], ...?extra, }, validateStatus: validateStatus, ); final _response = await _dio.request( _path, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); LibraryStatsResponseDto? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(LibraryStatsResponseDto), ) as LibraryStatsResponseDto; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.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, ); } /// removeOfflineFiles /// /// /// Parameters: /// * [id] /// * [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] /// Throws [DioException] if API call or serialization fails Future> removeOfflineFiles({ required String id, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/library/{id}/removeOffline'.replaceAll('{' r'id' '}', encodeQueryParameter(_serializers, id, const FullType(String)).toString()); final _options = Options( method: r'POST', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'cookie', 'keyName': 'immich_access_token', 'where': '', },{ 'type': 'apiKey', 'name': 'api_key', 'keyName': 'x-api-key', 'where': 'header', },{ 'type': 'http', 'scheme': 'Bearer', 'name': 'bearer', }, ], ...?extra, }, validateStatus: validateStatus, ); final _response = await _dio.request( _path, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); return _response; } /// scanLibrary /// /// /// Parameters: /// * [id] /// * [scanLibraryDto] /// * [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] /// Throws [DioException] if API call or serialization fails Future> scanLibrary({ required String id, required ScanLibraryDto scanLibraryDto, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/library/{id}/scan'.replaceAll('{' r'id' '}', encodeQueryParameter(_serializers, id, const FullType(String)).toString()); final _options = Options( method: r'POST', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'cookie', 'keyName': 'immich_access_token', 'where': '', },{ 'type': 'apiKey', 'name': 'api_key', 'keyName': 'x-api-key', 'where': 'header', },{ 'type': 'http', 'scheme': 'Bearer', 'name': 'bearer', }, ], ...?extra, }, contentType: 'application/json', validateStatus: validateStatus, ); dynamic _bodyData; try { const _type = FullType(ScanLibraryDto); _bodyData = _serializers.serialize(scanLibraryDto, specifiedType: _type); } catch(error, stackTrace) { throw DioException( requestOptions: _options.compose( _dio.options, _path, ), type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } final _response = await _dio.request( _path, data: _bodyData, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); return _response; } /// updateLibrary /// /// /// Parameters: /// * [id] /// * [updateLibraryDto] /// * [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 [LibraryResponseDto] as data /// Throws [DioException] if API call or serialization fails Future> updateLibrary({ required String id, required UpdateLibraryDto updateLibraryDto, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/library/{id}'.replaceAll('{' r'id' '}', encodeQueryParameter(_serializers, id, const FullType(String)).toString()); final _options = Options( method: r'PUT', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'cookie', 'keyName': 'immich_access_token', 'where': '', },{ 'type': 'apiKey', 'name': 'api_key', 'keyName': 'x-api-key', 'where': 'header', },{ 'type': 'http', 'scheme': 'Bearer', 'name': 'bearer', }, ], ...?extra, }, contentType: 'application/json', validateStatus: validateStatus, ); dynamic _bodyData; try { const _type = FullType(UpdateLibraryDto); _bodyData = _serializers.serialize(updateLibraryDto, specifiedType: _type); } catch(error, stackTrace) { throw DioException( requestOptions: _options.compose( _dio.options, _path, ), type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } final _response = await _dio.request( _path, data: _bodyData, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); LibraryResponseDto? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(LibraryResponseDto), ) as LibraryResponseDto; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.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, ); } /// validate /// /// /// Parameters: /// * [id] /// * [validateLibraryDto] /// * [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 [ValidateLibraryResponseDto] as data /// Throws [DioException] if API call or serialization fails Future> validate({ required String id, required ValidateLibraryDto validateLibraryDto, CancelToken? cancelToken, Map? headers, Map? extra, ValidateStatus? validateStatus, ProgressCallback? onSendProgress, ProgressCallback? onReceiveProgress, }) async { final _path = r'/library/{id}/validate'.replaceAll('{' r'id' '}', encodeQueryParameter(_serializers, id, const FullType(String)).toString()); final _options = Options( method: r'POST', headers: { ...?headers, }, extra: { 'secure': >[ { 'type': 'apiKey', 'name': 'cookie', 'keyName': 'immich_access_token', 'where': '', },{ 'type': 'apiKey', 'name': 'api_key', 'keyName': 'x-api-key', 'where': 'header', },{ 'type': 'http', 'scheme': 'Bearer', 'name': 'bearer', }, ], ...?extra, }, contentType: 'application/json', validateStatus: validateStatus, ); dynamic _bodyData; try { const _type = FullType(ValidateLibraryDto); _bodyData = _serializers.serialize(validateLibraryDto, specifiedType: _type); } catch(error, stackTrace) { throw DioException( requestOptions: _options.compose( _dio.options, _path, ), type: DioExceptionType.unknown, error: error, stackTrace: stackTrace, ); } final _response = await _dio.request( _path, data: _bodyData, options: _options, cancelToken: cancelToken, onSendProgress: onSendProgress, onReceiveProgress: onReceiveProgress, ); ValidateLibraryResponseDto? _responseData; try { final rawResponse = _response.data; _responseData = rawResponse == null ? null : _serializers.deserialize( rawResponse, specifiedType: const FullType(ValidateLibraryResponseDto), ) as ValidateLibraryResponseDto; } catch (error, stackTrace) { throw DioException( requestOptions: _response.requestOptions, response: _response, type: DioExceptionType.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, ); } }