feat: preload textual model
This commit is contained in:
@@ -9,11 +9,7 @@ function dart {
|
||||
wget -O native_class.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENERATOR_VERSION/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache
|
||||
patch --no-backup-if-mismatch -u native_class.mustache <native_class.mustache.patch
|
||||
|
||||
cd ../../
|
||||
wget -O api_client.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/$OPENAPI_GENERATOR_VERSION/modules/openapi-generator/src/main/resources/dart2/api_client.mustache
|
||||
patch --no-backup-if-mismatch -u api_client.mustache <api_client.mustache.patch
|
||||
|
||||
cd ../../
|
||||
cd ../../../../
|
||||
npx --yes @openapitools/openapi-generator-cli generate -g dart -i ./immich-openapi-specs.json -o ../mobile/openapi -t ./templates/mobile
|
||||
|
||||
# Post generate patches
|
||||
@@ -40,4 +36,4 @@ elif [[ $1 == 'typescript' ]]; then
|
||||
else
|
||||
dart
|
||||
typescript
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1646,6 +1646,8 @@
|
||||
},
|
||||
"/assets/random": {
|
||||
"get": {
|
||||
"deprecated": true,
|
||||
"description": "This property was deprecated in v1.116.0",
|
||||
"operationId": "getRandom",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -1685,8 +1687,12 @@
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Assets"
|
||||
]
|
||||
"Assets",
|
||||
"Deprecated"
|
||||
],
|
||||
"x-immich-lifecycle": {
|
||||
"deprecatedAt": "v1.116.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"/assets/statistics": {
|
||||
@@ -2561,6 +2567,39 @@
|
||||
"tags": [
|
||||
"Jobs"
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"operationId": "createJob",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/JobCreateDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Jobs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/jobs/{id}": {
|
||||
@@ -3128,55 +3167,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/map/style.json": {
|
||||
"get": {
|
||||
"operationId": "getMapStyle",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "key",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "theme",
|
||||
"required": true,
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/MapTheme"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Map"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/memories": {
|
||||
"get": {
|
||||
"operationId": "searchMemories",
|
||||
@@ -4644,6 +4634,48 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/search/random": {
|
||||
"post": {
|
||||
"operationId": "searchRandom",
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/RandomSearchDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/SearchResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
},
|
||||
{
|
||||
"cookie": []
|
||||
},
|
||||
{
|
||||
"api_key": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Search"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/search/smart": {
|
||||
"post": {
|
||||
"operationId": "searchSmart",
|
||||
@@ -5275,8 +5307,8 @@
|
||||
"name": "password",
|
||||
"required": false,
|
||||
"in": "query",
|
||||
"example": "password",
|
||||
"schema": {
|
||||
"example": "password",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
@@ -6806,7 +6838,14 @@
|
||||
"operationId": "emptyTrash",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"204": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TrashResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
@@ -6831,7 +6870,14 @@
|
||||
"operationId": "restoreTrash",
|
||||
"parameters": [],
|
||||
"responses": {
|
||||
"204": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TrashResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
@@ -6866,7 +6912,14 @@
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"204": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TrashResponseDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
@@ -8750,6 +8803,10 @@
|
||||
},
|
||||
"CreateProfileImageResponseDto": {
|
||||
"properties": {
|
||||
"profileChangedAt": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"profileImagePath": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -8758,6 +8815,7 @@
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"profileChangedAt",
|
||||
"profileImagePath",
|
||||
"userId"
|
||||
],
|
||||
@@ -9065,7 +9123,7 @@
|
||||
"maxDistance": {
|
||||
"format": "double",
|
||||
"maximum": 2,
|
||||
"minimum": 0,
|
||||
"minimum": 0.1,
|
||||
"type": "number"
|
||||
},
|
||||
"minFaces": {
|
||||
@@ -9075,7 +9133,7 @@
|
||||
"minScore": {
|
||||
"format": "double",
|
||||
"maximum": 1,
|
||||
"minimum": 0,
|
||||
"minimum": 0.1,
|
||||
"type": "number"
|
||||
},
|
||||
"modelName": {
|
||||
@@ -9273,6 +9331,17 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"JobCreateDto": {
|
||||
"properties": {
|
||||
"name": {
|
||||
"$ref": "#/components/schemas/ManualJobName"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"JobName": {
|
||||
"enum": [
|
||||
"thumbnailGeneration",
|
||||
@@ -9532,6 +9601,14 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ManualJobName": {
|
||||
"enum": [
|
||||
"person-cleanup",
|
||||
"tag-cleanup",
|
||||
"user-cleanup"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"MapMarkerResponseDto": {
|
||||
"properties": {
|
||||
"city": {
|
||||
@@ -9590,13 +9667,6 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"MapTheme": {
|
||||
"enum": [
|
||||
"light",
|
||||
"dark"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"MemoriesResponse": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
@@ -9984,6 +10054,10 @@
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"profileChangedAt": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"profileImagePath": {
|
||||
"type": "string"
|
||||
}
|
||||
@@ -9993,6 +10067,7 @@
|
||||
"email",
|
||||
"id",
|
||||
"name",
|
||||
"profileChangedAt",
|
||||
"profileImagePath"
|
||||
],
|
||||
"type": "object"
|
||||
@@ -10392,6 +10467,130 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"RandomSearchDto": {
|
||||
"properties": {
|
||||
"city": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"createdAfter": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"createdBefore": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"deviceId": {
|
||||
"type": "string"
|
||||
},
|
||||
"isArchived": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isEncoded": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isFavorite": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isMotion": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isNotInAlbum": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isOffline": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"isVisible": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"lensModel": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"libraryId": {
|
||||
"format": "uuid",
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"make": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"page": {
|
||||
"minimum": 1,
|
||||
"type": "number"
|
||||
},
|
||||
"personIds": {
|
||||
"items": {
|
||||
"format": "uuid",
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"size": {
|
||||
"maximum": 1000,
|
||||
"minimum": 1,
|
||||
"type": "number"
|
||||
},
|
||||
"state": {
|
||||
"nullable": true,
|
||||
"type": "string"
|
||||
},
|
||||
"takenAfter": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"takenBefore": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"trashedAfter": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"trashedBefore": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/components/schemas/AssetTypeEnum"
|
||||
},
|
||||
"updatedAfter": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedBefore": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"withArchived": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"withDeleted": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"withExif": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"withPeople": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"withStacked": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"RatingsResponse": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
@@ -10683,6 +10882,12 @@
|
||||
"loginPageMessage": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapDarkStyleUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"mapLightStyleUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"oauthButtonText": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -10698,6 +10903,8 @@
|
||||
"isInitialized",
|
||||
"isOnboarded",
|
||||
"loginPageMessage",
|
||||
"mapDarkStyleUrl",
|
||||
"mapLightStyleUrl",
|
||||
"oauthButtonText",
|
||||
"trashDays",
|
||||
"userDeleteDelay"
|
||||
@@ -12213,6 +12420,17 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"TrashResponseDto": {
|
||||
"properties": {
|
||||
"count": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"count"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"UpdateAlbumDto": {
|
||||
"properties": {
|
||||
"albumName": {
|
||||
@@ -12423,6 +12641,10 @@
|
||||
"oauthId": {
|
||||
"type": "string"
|
||||
},
|
||||
"profileChangedAt": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"profileImagePath": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -12461,6 +12683,7 @@
|
||||
"license",
|
||||
"name",
|
||||
"oauthId",
|
||||
"profileChangedAt",
|
||||
"profileImagePath",
|
||||
"quotaSizeInBytes",
|
||||
"quotaUsageInBytes",
|
||||
@@ -12622,6 +12845,10 @@
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"profileChangedAt": {
|
||||
"format": "date-time",
|
||||
"type": "string"
|
||||
},
|
||||
"profileImagePath": {
|
||||
"type": "string"
|
||||
}
|
||||
@@ -12631,6 +12858,7 @@
|
||||
"email",
|
||||
"id",
|
||||
"name",
|
||||
"profileChangedAt",
|
||||
"profileImagePath"
|
||||
],
|
||||
"type": "object"
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
{{>header}}
|
||||
{{>part_of}}
|
||||
class ApiClient {
|
||||
ApiClient({this.basePath = '{{{basePath}}}', this.authentication,});
|
||||
|
||||
final String basePath;
|
||||
final Authentication? authentication;
|
||||
|
||||
var _client = Client();
|
||||
final _defaultHeaderMap = <String, String>{};
|
||||
|
||||
/// Returns the current HTTP [Client] instance to use in this class.
|
||||
///
|
||||
/// The return value is guaranteed to never be null.
|
||||
Client get client => _client;
|
||||
|
||||
/// Requests to use a new HTTP [Client] in this class.
|
||||
set client(Client newClient) {
|
||||
_client = newClient;
|
||||
}
|
||||
|
||||
Map<String, String> get defaultHeaderMap => _defaultHeaderMap;
|
||||
|
||||
void addDefaultHeader(String key, String value) {
|
||||
_defaultHeaderMap[key] = value;
|
||||
}
|
||||
|
||||
// We don't use a Map<String, String> for queryParams.
|
||||
// If collectionFormat is 'multi', a key might appear multiple times.
|
||||
Future<Response> invokeAPI(
|
||||
String path,
|
||||
String method,
|
||||
List<QueryParam> queryParams,
|
||||
Object? body,
|
||||
Map<String, String> headerParams,
|
||||
Map<String, String> formParams,
|
||||
String? contentType,
|
||||
) async {
|
||||
await authentication?.applyToParams(queryParams, headerParams);
|
||||
|
||||
headerParams.addAll(_defaultHeaderMap);
|
||||
if (contentType != null) {
|
||||
headerParams['Content-Type'] = contentType;
|
||||
}
|
||||
|
||||
final urlEncodedQueryParams = queryParams.map((param) => '$param');
|
||||
final queryString = urlEncodedQueryParams.isNotEmpty ? '?${urlEncodedQueryParams.join('&')}' : '';
|
||||
final uri = Uri.parse('$basePath$path$queryString');
|
||||
|
||||
try {
|
||||
// Special case for uploading a single file which isn't a 'multipart/form-data'.
|
||||
if (
|
||||
body is MultipartFile && (contentType == null ||
|
||||
!contentType.toLowerCase().startsWith('multipart/form-data'))
|
||||
) {
|
||||
final request = StreamedRequest(method, uri);
|
||||
request.headers.addAll(headerParams);
|
||||
request.contentLength = body.length;
|
||||
body.finalize().listen(
|
||||
request.sink.add,
|
||||
onDone: request.sink.close,
|
||||
// ignore: avoid_types_on_closure_parameters
|
||||
onError: (Object error, StackTrace trace) => request.sink.close(),
|
||||
cancelOnError: true,
|
||||
);
|
||||
final response = await _client.send(request);
|
||||
return Response.fromStream(response);
|
||||
}
|
||||
|
||||
if (body is MultipartRequest) {
|
||||
final request = MultipartRequest(method, uri);
|
||||
request.fields.addAll(body.fields);
|
||||
request.files.addAll(body.files);
|
||||
request.headers.addAll(body.headers);
|
||||
request.headers.addAll(headerParams);
|
||||
final response = await _client.send(request);
|
||||
return Response.fromStream(response);
|
||||
}
|
||||
|
||||
final msgBody = contentType == 'application/x-www-form-urlencoded'
|
||||
? formParams
|
||||
: await serializeAsync(body);
|
||||
final nullableHeaderParams = headerParams.isEmpty ? null : headerParams;
|
||||
|
||||
switch(method) {
|
||||
case 'POST': return await _client.post(uri, headers: nullableHeaderParams, body: msgBody,);
|
||||
case 'PUT': return await _client.put(uri, headers: nullableHeaderParams, body: msgBody,);
|
||||
case 'DELETE': return await _client.delete(uri, headers: nullableHeaderParams, body: msgBody,);
|
||||
case 'PATCH': return await _client.patch(uri, headers: nullableHeaderParams, body: msgBody,);
|
||||
case 'HEAD': return await _client.head(uri, headers: nullableHeaderParams,);
|
||||
case 'GET': return await _client.get(uri, headers: nullableHeaderParams,);
|
||||
}
|
||||
} on SocketException catch (error, trace) {
|
||||
throw ApiException.withInner(
|
||||
HttpStatus.badRequest,
|
||||
'Socket operation failed: $method $path',
|
||||
error,
|
||||
trace,
|
||||
);
|
||||
} on TlsException catch (error, trace) {
|
||||
throw ApiException.withInner(
|
||||
HttpStatus.badRequest,
|
||||
'TLS/SSL communication failed: $method $path',
|
||||
error,
|
||||
trace,
|
||||
);
|
||||
} on IOException catch (error, trace) {
|
||||
throw ApiException.withInner(
|
||||
HttpStatus.badRequest,
|
||||
'I/O operation failed: $method $path',
|
||||
error,
|
||||
trace,
|
||||
);
|
||||
} on ClientException catch (error, trace) {
|
||||
throw ApiException.withInner(
|
||||
HttpStatus.badRequest,
|
||||
'HTTP connection failed: $method $path',
|
||||
error,
|
||||
trace,
|
||||
);
|
||||
} on Exception catch (error, trace) {
|
||||
throw ApiException.withInner(
|
||||
HttpStatus.badRequest,
|
||||
'Exception occurred: $method $path',
|
||||
error,
|
||||
trace,
|
||||
);
|
||||
}
|
||||
|
||||
throw ApiException(
|
||||
HttpStatus.badRequest,
|
||||
'Invalid HTTP operation: $method $path',
|
||||
);
|
||||
}
|
||||
{{#native_serialization}}
|
||||
|
||||
Future<dynamic> deserializeAsync(String value, String targetType, {bool growable = false,}) async =>
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
deserialize(value, targetType, growable: growable);
|
||||
|
||||
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use deserializeAsync() instead.')
|
||||
dynamic deserialize(String value, String targetType, {bool growable = false,}) {
|
||||
// Remove all spaces. Necessary for regular expressions as well.
|
||||
targetType = targetType.replaceAll(' ', ''); // ignore: parameter_assignments
|
||||
|
||||
// If the expected target type is String, nothing to do...
|
||||
return targetType == 'String'
|
||||
? value
|
||||
: fromJson(json.decode(value), targetType, growable: growable);
|
||||
}
|
||||
{{/native_serialization}}
|
||||
|
||||
// ignore: deprecated_member_use_from_same_package
|
||||
Future<String> serializeAsync(Object? value) async => serialize(value);
|
||||
|
||||
@Deprecated('Scheduled for removal in OpenAPI Generator 6.x. Use serializeAsync() instead.')
|
||||
String serialize(Object? value) => value == null ? '' : json.encode(value);
|
||||
|
||||
{{#native_serialization}}
|
||||
/// Returns a native instance of an OpenAPI class matching the [specified type][targetType].
|
||||
static dynamic fromJson(dynamic value, String targetType, {bool growable = false,}) {
|
||||
upgradeDto(value, targetType);
|
||||
try {
|
||||
switch (targetType) {
|
||||
case 'String':
|
||||
return value is String ? value : value.toString();
|
||||
case 'int':
|
||||
return value is int ? value : int.parse('$value');
|
||||
case 'double':
|
||||
return value is double ? value : double.parse('$value');
|
||||
case 'bool':
|
||||
if (value is bool) {
|
||||
return value;
|
||||
}
|
||||
final valueString = '$value'.toLowerCase();
|
||||
return valueString == 'true' || valueString == '1';
|
||||
case 'DateTime':
|
||||
return value is DateTime ? value : DateTime.tryParse(value);
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
case '{{{classname}}}':
|
||||
{{#isEnum}}
|
||||
{{#native_serialization}}return {{{classname}}}TypeTransformer().decode(value);{{/native_serialization}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
return {{{classname}}}.fromJson(value);
|
||||
{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
||||
default:
|
||||
dynamic match;
|
||||
if (value is List && (match = _regList.firstMatch(targetType)?.group(1)) != null) {
|
||||
return value
|
||||
.map<dynamic>((dynamic v) => fromJson(v, match, growable: growable,))
|
||||
.toList(growable: growable);
|
||||
}
|
||||
if (value is Set && (match = _regSet.firstMatch(targetType)?.group(1)) != null) {
|
||||
return value
|
||||
.map<dynamic>((dynamic v) => fromJson(v, match, growable: growable,))
|
||||
.toSet();
|
||||
}
|
||||
if (value is Map && (match = _regMap.firstMatch(targetType)?.group(1)) != null) {
|
||||
return Map<String, dynamic>.fromIterables(
|
||||
value.keys.cast<String>(),
|
||||
value.values.map<dynamic>((dynamic v) => fromJson(v, match, growable: growable,)),
|
||||
);
|
||||
}
|
||||
}
|
||||
} on Exception catch (error, trace) {
|
||||
throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', error, trace,);
|
||||
}
|
||||
throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',);
|
||||
}
|
||||
{{/native_serialization}}
|
||||
}
|
||||
{{#native_serialization}}
|
||||
|
||||
/// Primarily intended for use in an isolate.
|
||||
class DeserializationMessage {
|
||||
const DeserializationMessage({
|
||||
required this.json,
|
||||
required this.targetType,
|
||||
this.growable = false,
|
||||
});
|
||||
|
||||
/// The JSON value to deserialize.
|
||||
final String json;
|
||||
|
||||
/// Target type to deserialize to.
|
||||
final String targetType;
|
||||
|
||||
/// Whether to make deserialized lists or maps growable.
|
||||
final bool growable;
|
||||
}
|
||||
|
||||
/// Primarily intended for use in an isolate.
|
||||
Future<dynamic> decodeAsync(DeserializationMessage message) async {
|
||||
// Remove all spaces. Necessary for regular expressions as well.
|
||||
final targetType = message.targetType.replaceAll(' ', '');
|
||||
|
||||
// If the expected target type is String, nothing to do...
|
||||
return targetType == 'String'
|
||||
? message.json
|
||||
: json.decode(message.json);
|
||||
}
|
||||
|
||||
/// Primarily intended for use in an isolate.
|
||||
Future<dynamic> deserializeAsync(DeserializationMessage message) async {
|
||||
// Remove all spaces. Necessary for regular expressions as well.
|
||||
final targetType = message.targetType.replaceAll(' ', '');
|
||||
|
||||
// If the expected target type is String, nothing to do...
|
||||
return targetType == 'String'
|
||||
? message.json
|
||||
: ApiClient.fromJson(
|
||||
json.decode(message.json),
|
||||
targetType,
|
||||
growable: message.growable,
|
||||
);
|
||||
}
|
||||
{{/native_serialization}}
|
||||
|
||||
/// Primarily intended for use in an isolate.
|
||||
Future<String> serializeAsync(Object? value) async => value == null ? '' : json.encode(value);
|
||||
@@ -1,10 +0,0 @@
|
||||
--- api_client.mustache 2024-08-13 14:29:04.056364916 -0500
|
||||
+++ api_client_new.mustache 2024-08-13 14:29:36.224410735 -0500
|
||||
@@ -159,6 +159,7 @@
|
||||
{{#native_serialization}}
|
||||
/// Returns a native instance of an OpenAPI class matching the [specified type][targetType].
|
||||
static dynamic fromJson(dynamic value, String targetType, {bool growable = false,}) {
|
||||
+ upgradeDto(value, targetType);
|
||||
try {
|
||||
switch (targetType) {
|
||||
case 'String':
|
||||
@@ -111,6 +111,7 @@ class {{{classname}}} {
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static {{{classname}}}? fromJson(dynamic value) {
|
||||
upgradeDto(value, "{{{classname}}}");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
--- native_class.mustache 2023-08-31 23:09:59.584269162 +0200
|
||||
+++ native_class1.mustache 2023-08-31 22:59:53.633083270 +0200
|
||||
--- native_class.mustache 2024-09-19 11:41:07.855683995 -0400
|
||||
+++ native_class_temp.mustache 2024-09-19 11:41:57.113249395 -0400
|
||||
@@ -91,14 +91,14 @@
|
||||
{{/isDateTime}}
|
||||
{{#isNullable}}
|
||||
@@ -17,10 +17,14 @@
|
||||
}
|
||||
{{/defaultValue}}
|
||||
{{/required}}
|
||||
@@ -114,17 +114,6 @@
|
||||
@@ -111,20 +111,10 @@
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static {{{classname}}}? fromJson(dynamic value) {
|
||||
+ upgradeDto(value, "{{{classname}}}");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
|
||||
- // Ensure that the map contains the required keys.
|
||||
- // Note 1: the values aren't checked for validity beyond being non-null.
|
||||
- // Note 2: this code is stripped in release mode!
|
||||
@@ -35,9 +39,9 @@
|
||||
return {{{classname}}}(
|
||||
{{#vars}}
|
||||
{{#isDateTime}}
|
||||
@@ -215,6 +204,10 @@
|
||||
@@ -215,6 +205,10 @@
|
||||
? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}
|
||||
: {{{datatypeWithEnum}}}.parse(json[r'{{{baseName}}}'].toString()),
|
||||
: {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'),
|
||||
{{/isNumber}}
|
||||
+ {{#isDouble}}
|
||||
+ {{{name}}}: (mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}).toDouble(),
|
||||
@@ -46,7 +50,7 @@
|
||||
{{^isNumber}}
|
||||
{{^isEnum}}
|
||||
{{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
|
||||
@@ -223,6 +216,7 @@
|
||||
@@ -223,6 +217,7 @@
|
||||
{{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
|
||||
{{/isEnum}}
|
||||
{{/isNumber}}
|
||||
|
||||
+3
-3
@@ -32,9 +32,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.5.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
|
||||
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
|
||||
"version": "5.6.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz",
|
||||
"integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
|
||||
@@ -19,6 +19,7 @@ export type UserResponseDto = {
|
||||
email: string;
|
||||
id: string;
|
||||
name: string;
|
||||
profileChangedAt: string;
|
||||
profileImagePath: string;
|
||||
};
|
||||
export type ActivityResponseDto = {
|
||||
@@ -53,6 +54,7 @@ export type UserAdminResponseDto = {
|
||||
license: (UserLicense) | null;
|
||||
name: string;
|
||||
oauthId: string;
|
||||
profileChangedAt: string;
|
||||
profileImagePath: string;
|
||||
quotaSizeInBytes: number | null;
|
||||
quotaUsageInBytes: number | null;
|
||||
@@ -548,6 +550,9 @@ export type AllJobStatusResponseDto = {
|
||||
thumbnailGeneration: JobStatusDto;
|
||||
videoConversion: JobStatusDto;
|
||||
};
|
||||
export type JobCreateDto = {
|
||||
name: ManualJobName;
|
||||
};
|
||||
export type JobCommandDto = {
|
||||
command: JobCommand;
|
||||
force: boolean;
|
||||
@@ -666,6 +671,7 @@ export type PartnerResponseDto = {
|
||||
id: string;
|
||||
inTimeline?: boolean;
|
||||
name: string;
|
||||
profileChangedAt: string;
|
||||
profileImagePath: string;
|
||||
};
|
||||
export type UpdatePartnerDto = {
|
||||
@@ -831,6 +837,40 @@ export type PlacesResponseDto = {
|
||||
longitude: number;
|
||||
name: string;
|
||||
};
|
||||
export type RandomSearchDto = {
|
||||
city?: string | null;
|
||||
country?: string | null;
|
||||
createdAfter?: string;
|
||||
createdBefore?: string;
|
||||
deviceId?: string;
|
||||
isArchived?: boolean;
|
||||
isEncoded?: boolean;
|
||||
isFavorite?: boolean;
|
||||
isMotion?: boolean;
|
||||
isNotInAlbum?: boolean;
|
||||
isOffline?: boolean;
|
||||
isVisible?: boolean;
|
||||
lensModel?: string | null;
|
||||
libraryId?: string | null;
|
||||
make?: string;
|
||||
model?: string | null;
|
||||
page?: number;
|
||||
personIds?: string[];
|
||||
size?: number;
|
||||
state?: string | null;
|
||||
takenAfter?: string;
|
||||
takenBefore?: string;
|
||||
trashedAfter?: string;
|
||||
trashedBefore?: string;
|
||||
"type"?: AssetTypeEnum;
|
||||
updatedAfter?: string;
|
||||
updatedBefore?: string;
|
||||
withArchived?: boolean;
|
||||
withDeleted?: boolean;
|
||||
withExif?: boolean;
|
||||
withPeople?: boolean;
|
||||
withStacked?: boolean;
|
||||
};
|
||||
export type SmartSearchDto = {
|
||||
city?: string | null;
|
||||
country?: string | null;
|
||||
@@ -888,6 +928,8 @@ export type ServerConfigDto = {
|
||||
isInitialized: boolean;
|
||||
isOnboarded: boolean;
|
||||
loginPageMessage: string;
|
||||
mapDarkStyleUrl: string;
|
||||
mapLightStyleUrl: string;
|
||||
oauthButtonText: string;
|
||||
trashDays: number;
|
||||
userDeleteDelay: number;
|
||||
@@ -1245,6 +1287,9 @@ export type TimeBucketResponseDto = {
|
||||
count: number;
|
||||
timeBucket: string;
|
||||
};
|
||||
export type TrashResponseDto = {
|
||||
count: number;
|
||||
};
|
||||
export type UserUpdateMeDto = {
|
||||
email?: string;
|
||||
name?: string;
|
||||
@@ -1254,6 +1299,7 @@ export type CreateProfileImageDto = {
|
||||
file: Blob;
|
||||
};
|
||||
export type CreateProfileImageResponseDto = {
|
||||
profileChangedAt: string;
|
||||
profileImagePath: string;
|
||||
userId: string;
|
||||
};
|
||||
@@ -1691,6 +1737,9 @@ export function getMemoryLane({ day, month }: {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* This property was deprecated in v1.116.0
|
||||
*/
|
||||
export function getRandom({ count }: {
|
||||
count?: number;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
@@ -1946,6 +1995,15 @@ export function getAllJobsStatus(opts?: Oazapfts.RequestOpts) {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function createJob({ jobCreateDto }: {
|
||||
jobCreateDto: JobCreateDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/jobs", oazapfts.json({
|
||||
...opts,
|
||||
method: "POST",
|
||||
body: jobCreateDto
|
||||
})));
|
||||
}
|
||||
export function sendJobCommand({ id, jobCommandDto }: {
|
||||
id: JobName;
|
||||
jobCommandDto: JobCommandDto;
|
||||
@@ -2087,20 +2145,6 @@ export function reverseGeocode({ lat, lon }: {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function getMapStyle({ key, theme }: {
|
||||
key?: string;
|
||||
theme: MapTheme;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: object;
|
||||
}>(`/map/style.json${QS.query(QS.explode({
|
||||
key,
|
||||
theme
|
||||
}))}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function searchMemories(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
@@ -2486,6 +2530,18 @@ export function searchPlaces({ name }: {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export function searchRandom({ randomSearchDto }: {
|
||||
randomSearchDto: RandomSearchDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: SearchResponseDto;
|
||||
}>("/search/random", oazapfts.json({
|
||||
...opts,
|
||||
method: "POST",
|
||||
body: randomSearchDto
|
||||
})));
|
||||
}
|
||||
export function searchSmart({ smartSearchDto }: {
|
||||
smartSearchDto: SmartSearchDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
@@ -3062,13 +3118,19 @@ export function getTimeBuckets({ albumId, isArchived, isFavorite, isTrashed, key
|
||||
}));
|
||||
}
|
||||
export function emptyTrash(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/trash/empty", {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: TrashResponseDto;
|
||||
}>("/trash/empty", {
|
||||
...opts,
|
||||
method: "POST"
|
||||
}));
|
||||
}
|
||||
export function restoreTrash(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/trash/restore", {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: TrashResponseDto;
|
||||
}>("/trash/restore", {
|
||||
...opts,
|
||||
method: "POST"
|
||||
}));
|
||||
@@ -3076,7 +3138,10 @@ export function restoreTrash(opts?: Oazapfts.RequestOpts) {
|
||||
export function restoreAssets({ bulkIdsDto }: {
|
||||
bulkIdsDto: BulkIdsDto;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchText("/trash/restore/assets", oazapfts.json({
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: TrashResponseDto;
|
||||
}>("/trash/restore/assets", oazapfts.json({
|
||||
...opts,
|
||||
method: "POST",
|
||||
body: bulkIdsDto
|
||||
@@ -3369,6 +3434,11 @@ export enum EntityType {
|
||||
Asset = "ASSET",
|
||||
Album = "ALBUM"
|
||||
}
|
||||
export enum ManualJobName {
|
||||
PersonCleanup = "person-cleanup",
|
||||
TagCleanup = "tag-cleanup",
|
||||
UserCleanup = "user-cleanup"
|
||||
}
|
||||
export enum JobName {
|
||||
ThumbnailGeneration = "thumbnailGeneration",
|
||||
MetadataExtraction = "metadataExtraction",
|
||||
@@ -3392,10 +3462,6 @@ export enum JobCommand {
|
||||
Empty = "empty",
|
||||
ClearFailed = "clear-failed"
|
||||
}
|
||||
export enum MapTheme {
|
||||
Light = "light",
|
||||
Dark = "dark"
|
||||
}
|
||||
export enum MemoryType {
|
||||
OnThisDay = "on_this_day"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user