mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(server): tags (#2589)
* refactor: tags * chore: open api * chore: unused import * feat: add/remove/get tag assets * chore: open api * chore: finish tag tests for add/remove assets
This commit is contained in:
parent
631f13cf2f
commit
656dc08406
54 changed files with 2336 additions and 816 deletions
191
mobile/openapi/lib/api/tag_api.dart
generated
191
mobile/openapi/lib/api/tag_api.dart
generated
|
|
@ -20,7 +20,7 @@ class TagApi {
|
|||
/// Parameters:
|
||||
///
|
||||
/// * [CreateTagDto] createTagDto (required):
|
||||
Future<Response> createWithHttpInfo(CreateTagDto createTagDto,) async {
|
||||
Future<Response> createTagWithHttpInfo(CreateTagDto createTagDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/tag';
|
||||
|
||||
|
|
@ -48,8 +48,8 @@ class TagApi {
|
|||
/// Parameters:
|
||||
///
|
||||
/// * [CreateTagDto] createTagDto (required):
|
||||
Future<TagResponseDto?> create(CreateTagDto createTagDto,) async {
|
||||
final response = await createWithHttpInfo(createTagDto,);
|
||||
Future<TagResponseDto?> createTag(CreateTagDto createTagDto,) async {
|
||||
final response = await createTagWithHttpInfo(createTagDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ class TagApi {
|
|||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<Response> deleteWithHttpInfo(String id,) async {
|
||||
Future<Response> deleteTagWithHttpInfo(String id,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/tag/{id}'
|
||||
.replaceAll('{id}', id);
|
||||
|
|
@ -96,15 +96,15 @@ class TagApi {
|
|||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<void> delete(String id,) async {
|
||||
final response = await deleteWithHttpInfo(id,);
|
||||
Future<void> deleteTag(String id,) async {
|
||||
final response = await deleteTagWithHttpInfo(id,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /tag' operation and returns the [Response].
|
||||
Future<Response> findAllWithHttpInfo() async {
|
||||
Future<Response> getAllTagsWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/tag';
|
||||
|
||||
|
|
@ -129,8 +129,8 @@ class TagApi {
|
|||
);
|
||||
}
|
||||
|
||||
Future<List<TagResponseDto>?> findAll() async {
|
||||
final response = await findAllWithHttpInfo();
|
||||
Future<List<TagResponseDto>?> getAllTags() async {
|
||||
final response = await getAllTagsWithHttpInfo();
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
|
@ -147,11 +147,62 @@ class TagApi {
|
|||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /tag/{id}/assets' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<Response> getTagAssetsWithHttpInfo(String id,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/tag/{id}/assets'
|
||||
.replaceAll('{id}', id);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<List<AssetResponseDto>?> getTagAssets(String id,) async {
|
||||
final response = await getTagAssetsWithHttpInfo(id,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||
final responseBody = await _decodeBodyBytes(response);
|
||||
return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
|
||||
.cast<AssetResponseDto>()
|
||||
.toList();
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /tag/{id}' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<Response> findOneWithHttpInfo(String id,) async {
|
||||
Future<Response> getTagByIdWithHttpInfo(String id,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/tag/{id}'
|
||||
.replaceAll('{id}', id);
|
||||
|
|
@ -180,8 +231,8 @@ class TagApi {
|
|||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<TagResponseDto?> findOne(String id,) async {
|
||||
final response = await findOneWithHttpInfo(id,);
|
||||
Future<TagResponseDto?> getTagById(String id,) async {
|
||||
final response = await getTagByIdWithHttpInfo(id,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
|
@ -195,13 +246,123 @@ class TagApi {
|
|||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'PUT /tag/{id}/assets' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
///
|
||||
/// * [AssetIdsDto] assetIdsDto (required):
|
||||
Future<Response> tagAssetsWithHttpInfo(String id, AssetIdsDto assetIdsDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/tag/{id}/assets'
|
||||
.replaceAll('{id}', id);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = assetIdsDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
///
|
||||
/// * [AssetIdsDto] assetIdsDto (required):
|
||||
Future<List<AssetIdsResponseDto>?> tagAssets(String id, AssetIdsDto assetIdsDto,) async {
|
||||
final response = await tagAssetsWithHttpInfo(id, assetIdsDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||
final responseBody = await _decodeBodyBytes(response);
|
||||
return (await apiClient.deserializeAsync(responseBody, 'List<AssetIdsResponseDto>') as List)
|
||||
.cast<AssetIdsResponseDto>()
|
||||
.toList();
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'DELETE /tag/{id}/assets' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
///
|
||||
/// * [AssetIdsDto] assetIdsDto (required):
|
||||
Future<Response> untagAssetsWithHttpInfo(String id, AssetIdsDto assetIdsDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/tag/{id}/assets'
|
||||
.replaceAll('{id}', id);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = assetIdsDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
///
|
||||
/// * [AssetIdsDto] assetIdsDto (required):
|
||||
Future<List<AssetIdsResponseDto>?> untagAssets(String id, AssetIdsDto assetIdsDto,) async {
|
||||
final response = await untagAssetsWithHttpInfo(id, assetIdsDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||
final responseBody = await _decodeBodyBytes(response);
|
||||
return (await apiClient.deserializeAsync(responseBody, 'List<AssetIdsResponseDto>') as List)
|
||||
.cast<AssetIdsResponseDto>()
|
||||
.toList();
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'PATCH /tag/{id}' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
///
|
||||
/// * [UpdateTagDto] updateTagDto (required):
|
||||
Future<Response> updateWithHttpInfo(String id, UpdateTagDto updateTagDto,) async {
|
||||
Future<Response> updateTagWithHttpInfo(String id, UpdateTagDto updateTagDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/tag/{id}'
|
||||
.replaceAll('{id}', id);
|
||||
|
|
@ -232,8 +393,8 @@ class TagApi {
|
|||
/// * [String] id (required):
|
||||
///
|
||||
/// * [UpdateTagDto] updateTagDto (required):
|
||||
Future<TagResponseDto?> update(String id, UpdateTagDto updateTagDto,) async {
|
||||
final response = await updateWithHttpInfo(id, updateTagDto,);
|
||||
Future<TagResponseDto?> updateTag(String id, UpdateTagDto updateTagDto,) async {
|
||||
final response = await updateTagWithHttpInfo(id, updateTagDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue