mirror of
https://github.com/immich-app/immich.git
synced 2025-12-25 14:27:37 -05:00
856 lines
27 KiB
Dart
856 lines
27 KiB
Dart
//
|
|
// 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<Response<LibraryResponseDto>> createLibrary({
|
|
required CreateLibraryDto createLibraryDto,
|
|
CancelToken? cancelToken,
|
|
Map<String, dynamic>? headers,
|
|
Map<String, dynamic>? extra,
|
|
ValidateStatus? validateStatus,
|
|
ProgressCallback? onSendProgress,
|
|
ProgressCallback? onReceiveProgress,
|
|
}) async {
|
|
final _path = r'/library';
|
|
final _options = Options(
|
|
method: r'POST',
|
|
headers: <String, dynamic>{
|
|
...?headers,
|
|
},
|
|
extra: <String, dynamic>{
|
|
'secure': <Map<String, String>>[
|
|
{
|
|
'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<Object>(
|
|
_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<LibraryResponseDto>(
|
|
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<Response<void>> deleteLibrary({
|
|
required String id,
|
|
CancelToken? cancelToken,
|
|
Map<String, dynamic>? headers,
|
|
Map<String, dynamic>? 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: <String, dynamic>{
|
|
...?headers,
|
|
},
|
|
extra: <String, dynamic>{
|
|
'secure': <Map<String, String>>[
|
|
{
|
|
'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<Object>(
|
|
_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<LibraryResponseDto>] as data
|
|
/// Throws [DioException] if API call or serialization fails
|
|
Future<Response<BuiltList<LibraryResponseDto>>> getAllLibraries({
|
|
LibraryType? type,
|
|
CancelToken? cancelToken,
|
|
Map<String, dynamic>? headers,
|
|
Map<String, dynamic>? extra,
|
|
ValidateStatus? validateStatus,
|
|
ProgressCallback? onSendProgress,
|
|
ProgressCallback? onReceiveProgress,
|
|
}) async {
|
|
final _path = r'/library';
|
|
final _options = Options(
|
|
method: r'GET',
|
|
headers: <String, dynamic>{
|
|
...?headers,
|
|
},
|
|
extra: <String, dynamic>{
|
|
'secure': <Map<String, String>>[
|
|
{
|
|
'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 = <String, dynamic>{
|
|
if (type != null) r'type': encodeQueryParameter(_serializers, type, const FullType(LibraryType)),
|
|
};
|
|
|
|
final _response = await _dio.request<Object>(
|
|
_path,
|
|
options: _options,
|
|
queryParameters: _queryParameters,
|
|
cancelToken: cancelToken,
|
|
onSendProgress: onSendProgress,
|
|
onReceiveProgress: onReceiveProgress,
|
|
);
|
|
|
|
BuiltList<LibraryResponseDto>? _responseData;
|
|
|
|
try {
|
|
final rawResponse = _response.data;
|
|
_responseData = rawResponse == null ? null : _serializers.deserialize(
|
|
rawResponse,
|
|
specifiedType: const FullType(BuiltList, [FullType(LibraryResponseDto)]),
|
|
) as BuiltList<LibraryResponseDto>;
|
|
|
|
} catch (error, stackTrace) {
|
|
throw DioException(
|
|
requestOptions: _response.requestOptions,
|
|
response: _response,
|
|
type: DioExceptionType.unknown,
|
|
error: error,
|
|
stackTrace: stackTrace,
|
|
);
|
|
}
|
|
|
|
return Response<BuiltList<LibraryResponseDto>>(
|
|
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<Response<LibraryResponseDto>> getLibrary({
|
|
required String id,
|
|
CancelToken? cancelToken,
|
|
Map<String, dynamic>? headers,
|
|
Map<String, dynamic>? 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: <String, dynamic>{
|
|
...?headers,
|
|
},
|
|
extra: <String, dynamic>{
|
|
'secure': <Map<String, String>>[
|
|
{
|
|
'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<Object>(
|
|
_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<LibraryResponseDto>(
|
|
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<Response<LibraryStatsResponseDto>> getLibraryStatistics({
|
|
required String id,
|
|
CancelToken? cancelToken,
|
|
Map<String, dynamic>? headers,
|
|
Map<String, dynamic>? 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: <String, dynamic>{
|
|
...?headers,
|
|
},
|
|
extra: <String, dynamic>{
|
|
'secure': <Map<String, String>>[
|
|
{
|
|
'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<Object>(
|
|
_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<LibraryStatsResponseDto>(
|
|
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<Response<void>> removeOfflineFiles({
|
|
required String id,
|
|
CancelToken? cancelToken,
|
|
Map<String, dynamic>? headers,
|
|
Map<String, dynamic>? 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: <String, dynamic>{
|
|
...?headers,
|
|
},
|
|
extra: <String, dynamic>{
|
|
'secure': <Map<String, String>>[
|
|
{
|
|
'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<Object>(
|
|
_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<Response<void>> scanLibrary({
|
|
required String id,
|
|
required ScanLibraryDto scanLibraryDto,
|
|
CancelToken? cancelToken,
|
|
Map<String, dynamic>? headers,
|
|
Map<String, dynamic>? 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: <String, dynamic>{
|
|
...?headers,
|
|
},
|
|
extra: <String, dynamic>{
|
|
'secure': <Map<String, String>>[
|
|
{
|
|
'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<Object>(
|
|
_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<Response<LibraryResponseDto>> updateLibrary({
|
|
required String id,
|
|
required UpdateLibraryDto updateLibraryDto,
|
|
CancelToken? cancelToken,
|
|
Map<String, dynamic>? headers,
|
|
Map<String, dynamic>? 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: <String, dynamic>{
|
|
...?headers,
|
|
},
|
|
extra: <String, dynamic>{
|
|
'secure': <Map<String, String>>[
|
|
{
|
|
'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<Object>(
|
|
_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<LibraryResponseDto>(
|
|
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<Response<ValidateLibraryResponseDto>> validate({
|
|
required String id,
|
|
required ValidateLibraryDto validateLibraryDto,
|
|
CancelToken? cancelToken,
|
|
Map<String, dynamic>? headers,
|
|
Map<String, dynamic>? 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: <String, dynamic>{
|
|
...?headers,
|
|
},
|
|
extra: <String, dynamic>{
|
|
'secure': <Map<String, String>>[
|
|
{
|
|
'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<Object>(
|
|
_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<ValidateLibraryResponseDto>(
|
|
data: _responseData,
|
|
headers: _response.headers,
|
|
isRedirect: _response.isRedirect,
|
|
requestOptions: _response.requestOptions,
|
|
redirects: _response.redirects,
|
|
statusCode: _response.statusCode,
|
|
statusMessage: _response.statusMessage,
|
|
extra: _response.extra,
|
|
);
|
|
}
|
|
|
|
}
|