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:
Jason Rasmussen
2023-05-31 21:51:28 -04:00
committed by GitHub
parent 631f13cf2f
commit 656dc08406
54 changed files with 2336 additions and 816 deletions

View File

@@ -25,6 +25,8 @@ doc/AssetCountByTimeBucket.md
doc/AssetCountByTimeBucketResponseDto.md
doc/AssetCountByUserIdResponseDto.md
doc/AssetFileUploadResponseDto.md
doc/AssetIdsDto.md
doc/AssetIdsResponseDto.md
doc/AssetResponseDto.md
doc/AssetTypeEnum.md
doc/AuthDeviceResponseDto.md
@@ -154,6 +156,8 @@ lib/model/asset_count_by_time_bucket.dart
lib/model/asset_count_by_time_bucket_response_dto.dart
lib/model/asset_count_by_user_id_response_dto.dart
lib/model/asset_file_upload_response_dto.dart
lib/model/asset_ids_dto.dart
lib/model/asset_ids_response_dto.dart
lib/model/asset_response_dto.dart
lib/model/asset_type_enum.dart
lib/model/auth_device_response_dto.dart
@@ -252,6 +256,8 @@ test/asset_count_by_time_bucket_response_dto_test.dart
test/asset_count_by_time_bucket_test.dart
test/asset_count_by_user_id_response_dto_test.dart
test/asset_file_upload_response_dto_test.dart
test/asset_ids_dto_test.dart
test/asset_ids_response_dto_test.dart
test/asset_response_dto_test.dart
test/asset_type_enum_test.dart
test/auth_device_response_dto_test.dart

View File

@@ -154,11 +154,14 @@ Class | Method | HTTP request | Description
*SystemConfigApi* | [**getDefaults**](doc//SystemConfigApi.md#getdefaults) | **GET** /system-config/defaults |
*SystemConfigApi* | [**getStorageTemplateOptions**](doc//SystemConfigApi.md#getstoragetemplateoptions) | **GET** /system-config/storage-template-options |
*SystemConfigApi* | [**updateConfig**](doc//SystemConfigApi.md#updateconfig) | **PUT** /system-config |
*TagApi* | [**create**](doc//TagApi.md#create) | **POST** /tag |
*TagApi* | [**delete**](doc//TagApi.md#delete) | **DELETE** /tag/{id} |
*TagApi* | [**findAll**](doc//TagApi.md#findall) | **GET** /tag |
*TagApi* | [**findOne**](doc//TagApi.md#findone) | **GET** /tag/{id} |
*TagApi* | [**update**](doc//TagApi.md#update) | **PATCH** /tag/{id} |
*TagApi* | [**createTag**](doc//TagApi.md#createtag) | **POST** /tag |
*TagApi* | [**deleteTag**](doc//TagApi.md#deletetag) | **DELETE** /tag/{id} |
*TagApi* | [**getAllTags**](doc//TagApi.md#getalltags) | **GET** /tag |
*TagApi* | [**getTagAssets**](doc//TagApi.md#gettagassets) | **GET** /tag/{id}/assets |
*TagApi* | [**getTagById**](doc//TagApi.md#gettagbyid) | **GET** /tag/{id} |
*TagApi* | [**tagAssets**](doc//TagApi.md#tagassets) | **PUT** /tag/{id}/assets |
*TagApi* | [**untagAssets**](doc//TagApi.md#untagassets) | **DELETE** /tag/{id}/assets |
*TagApi* | [**updateTag**](doc//TagApi.md#updatetag) | **PATCH** /tag/{id} |
*UserApi* | [**createProfileImage**](doc//UserApi.md#createprofileimage) | **POST** /user/profile-image |
*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **POST** /user |
*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **DELETE** /user/{userId} |
@@ -192,6 +195,8 @@ Class | Method | HTTP request | Description
- [AssetCountByTimeBucketResponseDto](doc//AssetCountByTimeBucketResponseDto.md)
- [AssetCountByUserIdResponseDto](doc//AssetCountByUserIdResponseDto.md)
- [AssetFileUploadResponseDto](doc//AssetFileUploadResponseDto.md)
- [AssetIdsDto](doc//AssetIdsDto.md)
- [AssetIdsResponseDto](doc//AssetIdsResponseDto.md)
- [AssetResponseDto](doc//AssetResponseDto.md)
- [AssetTypeEnum](doc//AssetTypeEnum.md)
- [AuthDeviceResponseDto](doc//AuthDeviceResponseDto.md)

15
mobile/openapi/doc/AssetIdsDto.md generated Normal file
View File

@@ -0,0 +1,15 @@
# openapi.model.AssetIdsDto
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**assetIds** | **List<String>** | | [default to const []]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,17 @@
# openapi.model.AssetIdsResponseDto
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**assetId** | **String** | |
**success** | **bool** | |
**error** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -9,15 +9,18 @@ All URIs are relative to */api*
Method | HTTP request | Description
------------- | ------------- | -------------
[**create**](TagApi.md#create) | **POST** /tag |
[**delete**](TagApi.md#delete) | **DELETE** /tag/{id} |
[**findAll**](TagApi.md#findall) | **GET** /tag |
[**findOne**](TagApi.md#findone) | **GET** /tag/{id} |
[**update**](TagApi.md#update) | **PATCH** /tag/{id} |
[**createTag**](TagApi.md#createtag) | **POST** /tag |
[**deleteTag**](TagApi.md#deletetag) | **DELETE** /tag/{id} |
[**getAllTags**](TagApi.md#getalltags) | **GET** /tag |
[**getTagAssets**](TagApi.md#gettagassets) | **GET** /tag/{id}/assets |
[**getTagById**](TagApi.md#gettagbyid) | **GET** /tag/{id} |
[**tagAssets**](TagApi.md#tagassets) | **PUT** /tag/{id}/assets |
[**untagAssets**](TagApi.md#untagassets) | **DELETE** /tag/{id}/assets |
[**updateTag**](TagApi.md#updatetag) | **PATCH** /tag/{id} |
# **create**
> TagResponseDto create(createTagDto)
# **createTag**
> TagResponseDto createTag(createTagDto)
@@ -43,10 +46,10 @@ final api_instance = TagApi();
final createTagDto = CreateTagDto(); // CreateTagDto |
try {
final result = api_instance.create(createTagDto);
final result = api_instance.createTag(createTagDto);
print(result);
} catch (e) {
print('Exception when calling TagApi->create: $e\n');
print('Exception when calling TagApi->createTag: $e\n');
}
```
@@ -71,8 +74,8 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **delete**
> delete(id)
# **deleteTag**
> deleteTag(id)
@@ -98,9 +101,9 @@ final api_instance = TagApi();
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
try {
api_instance.delete(id);
api_instance.deleteTag(id);
} catch (e) {
print('Exception when calling TagApi->delete: $e\n');
print('Exception when calling TagApi->deleteTag: $e\n');
}
```
@@ -125,8 +128,8 @@ void (empty response body)
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **findAll**
> List<TagResponseDto> findAll()
# **getAllTags**
> List<TagResponseDto> getAllTags()
@@ -151,10 +154,10 @@ import 'package:openapi/api.dart';
final api_instance = TagApi();
try {
final result = api_instance.findAll();
final result = api_instance.getAllTags();
print(result);
} catch (e) {
print('Exception when calling TagApi->findAll: $e\n');
print('Exception when calling TagApi->getAllTags: $e\n');
}
```
@@ -176,8 +179,8 @@ This endpoint does not need any parameter.
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **findOne**
> TagResponseDto findOne(id)
# **getTagAssets**
> List<AssetResponseDto> getTagAssets(id)
@@ -203,10 +206,65 @@ final api_instance = TagApi();
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
try {
final result = api_instance.findOne(id);
final result = api_instance.getTagAssets(id);
print(result);
} catch (e) {
print('Exception when calling TagApi->findOne: $e\n');
print('Exception when calling TagApi->getTagAssets: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **String**| |
### Return type
[**List<AssetResponseDto>**](AssetResponseDto.md)
### Authorization
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getTagById**
> TagResponseDto getTagById(id)
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = TagApi();
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
try {
final result = api_instance.getTagById(id);
print(result);
} catch (e) {
print('Exception when calling TagApi->getTagById: $e\n');
}
```
@@ -231,8 +289,122 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **update**
> TagResponseDto update(id, updateTagDto)
# **tagAssets**
> List<AssetIdsResponseDto> tagAssets(id, assetIdsDto)
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = TagApi();
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final assetIdsDto = AssetIdsDto(); // AssetIdsDto |
try {
final result = api_instance.tagAssets(id, assetIdsDto);
print(result);
} catch (e) {
print('Exception when calling TagApi->tagAssets: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **String**| |
**assetIdsDto** | [**AssetIdsDto**](AssetIdsDto.md)| |
### Return type
[**List<AssetIdsResponseDto>**](AssetIdsResponseDto.md)
### Authorization
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **untagAssets**
> List<AssetIdsResponseDto> untagAssets(id, assetIdsDto)
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = TagApi();
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final assetIdsDto = AssetIdsDto(); // AssetIdsDto |
try {
final result = api_instance.untagAssets(id, assetIdsDto);
print(result);
} catch (e) {
print('Exception when calling TagApi->untagAssets: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **String**| |
**assetIdsDto** | [**AssetIdsDto**](AssetIdsDto.md)| |
### Return type
[**List<AssetIdsResponseDto>**](AssetIdsResponseDto.md)
### Authorization
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **updateTag**
> TagResponseDto updateTag(id, updateTagDto)
@@ -259,10 +431,10 @@ final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final updateTagDto = UpdateTagDto(); // UpdateTagDto |
try {
final result = api_instance.update(id, updateTagDto);
final result = api_instance.updateTag(id, updateTagDto);
print(result);
} catch (e) {
print('Exception when calling TagApi->update: $e\n');
print('Exception when calling TagApi->updateTag: $e\n');
}
```

View File

@@ -8,11 +8,10 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **String** | |
**type** | [**TagTypeEnum**](TagTypeEnum.md) | |
**id** | **String** | |
**name** | **String** | |
**userId** | **String** | |
**renameTagId** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -9,7 +9,6 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional]
**renameTagId** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -62,6 +62,8 @@ part 'model/asset_count_by_time_bucket.dart';
part 'model/asset_count_by_time_bucket_response_dto.dart';
part 'model/asset_count_by_user_id_response_dto.dart';
part 'model/asset_file_upload_response_dto.dart';
part 'model/asset_ids_dto.dart';
part 'model/asset_ids_response_dto.dart';
part 'model/asset_response_dto.dart';
part 'model/asset_type_enum.dart';
part 'model/auth_device_response_dto.dart';

View File

@@ -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));
}

View File

@@ -219,6 +219,10 @@ class ApiClient {
return AssetCountByUserIdResponseDto.fromJson(value);
case 'AssetFileUploadResponseDto':
return AssetFileUploadResponseDto.fromJson(value);
case 'AssetIdsDto':
return AssetIdsDto.fromJson(value);
case 'AssetIdsResponseDto':
return AssetIdsResponseDto.fromJson(value);
case 'AssetResponseDto':
return AssetResponseDto.fromJson(value);
case 'AssetTypeEnum':

View File

@@ -0,0 +1,111 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class AssetIdsDto {
/// Returns a new [AssetIdsDto] instance.
AssetIdsDto({
this.assetIds = const [],
});
List<String> assetIds;
@override
bool operator ==(Object other) => identical(this, other) || other is AssetIdsDto &&
other.assetIds == assetIds;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(assetIds.hashCode);
@override
String toString() => 'AssetIdsDto[assetIds=$assetIds]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'assetIds'] = this.assetIds;
return json;
}
/// Returns a new [AssetIdsDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetIdsDto? fromJson(dynamic value) {
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!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "AssetIdsDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "AssetIdsDto[$key]" has a null value in JSON.');
});
return true;
}());
return AssetIdsDto(
assetIds: json[r'assetIds'] is Iterable
? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
);
}
return null;
}
static List<AssetIdsDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <AssetIdsDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = AssetIdsDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, AssetIdsDto> mapFromJson(dynamic json) {
final map = <String, AssetIdsDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AssetIdsDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of AssetIdsDto-objects as value to a dart map
static Map<String, List<AssetIdsDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<AssetIdsDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = AssetIdsDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'assetIds',
};
}

View File

@@ -0,0 +1,205 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class AssetIdsResponseDto {
/// Returns a new [AssetIdsResponseDto] instance.
AssetIdsResponseDto({
required this.assetId,
required this.success,
this.error,
});
String assetId;
bool success;
AssetIdsResponseDtoErrorEnum? error;
@override
bool operator ==(Object other) => identical(this, other) || other is AssetIdsResponseDto &&
other.assetId == assetId &&
other.success == success &&
other.error == error;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(assetId.hashCode) +
(success.hashCode) +
(error == null ? 0 : error!.hashCode);
@override
String toString() => 'AssetIdsResponseDto[assetId=$assetId, success=$success, error=$error]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'assetId'] = this.assetId;
json[r'success'] = this.success;
if (this.error != null) {
json[r'error'] = this.error;
} else {
// json[r'error'] = null;
}
return json;
}
/// Returns a new [AssetIdsResponseDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetIdsResponseDto? fromJson(dynamic value) {
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!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "AssetIdsResponseDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "AssetIdsResponseDto[$key]" has a null value in JSON.');
});
return true;
}());
return AssetIdsResponseDto(
assetId: mapValueOfType<String>(json, r'assetId')!,
success: mapValueOfType<bool>(json, r'success')!,
error: AssetIdsResponseDtoErrorEnum.fromJson(json[r'error']),
);
}
return null;
}
static List<AssetIdsResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <AssetIdsResponseDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = AssetIdsResponseDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, AssetIdsResponseDto> mapFromJson(dynamic json) {
final map = <String, AssetIdsResponseDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AssetIdsResponseDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of AssetIdsResponseDto-objects as value to a dart map
static Map<String, List<AssetIdsResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<AssetIdsResponseDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = AssetIdsResponseDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'assetId',
'success',
};
}
class AssetIdsResponseDtoErrorEnum {
/// Instantiate a new enum with the provided [value].
const AssetIdsResponseDtoErrorEnum._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const duplicate = AssetIdsResponseDtoErrorEnum._(r'duplicate');
static const noPermission = AssetIdsResponseDtoErrorEnum._(r'no_permission');
static const notFound = AssetIdsResponseDtoErrorEnum._(r'not_found');
/// List of all possible values in this [enum][AssetIdsResponseDtoErrorEnum].
static const values = <AssetIdsResponseDtoErrorEnum>[
duplicate,
noPermission,
notFound,
];
static AssetIdsResponseDtoErrorEnum? fromJson(dynamic value) => AssetIdsResponseDtoErrorEnumTypeTransformer().decode(value);
static List<AssetIdsResponseDtoErrorEnum>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <AssetIdsResponseDtoErrorEnum>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = AssetIdsResponseDtoErrorEnum.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
}
/// Transformation class that can [encode] an instance of [AssetIdsResponseDtoErrorEnum] to String,
/// and [decode] dynamic data back to [AssetIdsResponseDtoErrorEnum].
class AssetIdsResponseDtoErrorEnumTypeTransformer {
factory AssetIdsResponseDtoErrorEnumTypeTransformer() => _instance ??= const AssetIdsResponseDtoErrorEnumTypeTransformer._();
const AssetIdsResponseDtoErrorEnumTypeTransformer._();
String encode(AssetIdsResponseDtoErrorEnum data) => data.value;
/// Decodes a [dynamic value][data] to a AssetIdsResponseDtoErrorEnum.
///
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code.
AssetIdsResponseDtoErrorEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data) {
case r'duplicate': return AssetIdsResponseDtoErrorEnum.duplicate;
case r'no_permission': return AssetIdsResponseDtoErrorEnum.noPermission;
case r'not_found': return AssetIdsResponseDtoErrorEnum.notFound;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [AssetIdsResponseDtoErrorEnumTypeTransformer] instance.
static AssetIdsResponseDtoErrorEnumTypeTransformer? _instance;
}

View File

@@ -13,54 +13,44 @@ part of openapi.api;
class TagResponseDto {
/// Returns a new [TagResponseDto] instance.
TagResponseDto({
required this.id,
required this.type,
required this.id,
required this.name,
required this.userId,
this.renameTagId,
});
String id;
TagTypeEnum type;
String id;
String name;
String userId;
String? renameTagId;
@override
bool operator ==(Object other) => identical(this, other) || other is TagResponseDto &&
other.id == id &&
other.type == type &&
other.id == id &&
other.name == name &&
other.userId == userId &&
other.renameTagId == renameTagId;
other.userId == userId;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(id.hashCode) +
(type.hashCode) +
(id.hashCode) +
(name.hashCode) +
(userId.hashCode) +
(renameTagId == null ? 0 : renameTagId!.hashCode);
(userId.hashCode);
@override
String toString() => 'TagResponseDto[id=$id, type=$type, name=$name, userId=$userId, renameTagId=$renameTagId]';
String toString() => 'TagResponseDto[type=$type, id=$id, name=$name, userId=$userId]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'id'] = this.id;
json[r'type'] = this.type;
json[r'id'] = this.id;
json[r'name'] = this.name;
json[r'userId'] = this.userId;
if (this.renameTagId != null) {
json[r'renameTagId'] = this.renameTagId;
} else {
// json[r'renameTagId'] = null;
}
return json;
}
@@ -83,11 +73,10 @@ class TagResponseDto {
}());
return TagResponseDto(
id: mapValueOfType<String>(json, r'id')!,
type: TagTypeEnum.fromJson(json[r'type'])!,
id: mapValueOfType<String>(json, r'id')!,
name: mapValueOfType<String>(json, r'name')!,
userId: mapValueOfType<String>(json, r'userId')!,
renameTagId: mapValueOfType<String>(json, r'renameTagId'),
);
}
return null;
@@ -135,8 +124,8 @@ class TagResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'id',
'type',
'id',
'name',
'userId',
};

View File

@@ -14,7 +14,6 @@ class UpdateTagDto {
/// Returns a new [UpdateTagDto] instance.
UpdateTagDto({
this.name,
this.renameTagId,
});
///
@@ -25,27 +24,17 @@ class UpdateTagDto {
///
String? name;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? renameTagId;
@override
bool operator ==(Object other) => identical(this, other) || other is UpdateTagDto &&
other.name == name &&
other.renameTagId == renameTagId;
other.name == name;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(name == null ? 0 : name!.hashCode) +
(renameTagId == null ? 0 : renameTagId!.hashCode);
(name == null ? 0 : name!.hashCode);
@override
String toString() => 'UpdateTagDto[name=$name, renameTagId=$renameTagId]';
String toString() => 'UpdateTagDto[name=$name]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@@ -54,11 +43,6 @@ class UpdateTagDto {
} else {
// json[r'name'] = null;
}
if (this.renameTagId != null) {
json[r'renameTagId'] = this.renameTagId;
} else {
// json[r'renameTagId'] = null;
}
return json;
}
@@ -82,7 +66,6 @@ class UpdateTagDto {
return UpdateTagDto(
name: mapValueOfType<String>(json, r'name'),
renameTagId: mapValueOfType<String>(json, r'renameTagId'),
);
}
return null;

View File

@@ -0,0 +1,27 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for AssetIdsDto
void main() {
// final instance = AssetIdsDto();
group('test AssetIdsDto', () {
// List<String> assetIds (default value: const [])
test('to test the property `assetIds`', () async {
// TODO
});
});
}

View File

@@ -0,0 +1,37 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for AssetIdsResponseDto
void main() {
// final instance = AssetIdsResponseDto();
group('test AssetIdsResponseDto', () {
// String assetId
test('to test the property `assetId`', () async {
// TODO
});
// bool success
test('to test the property `success`', () async {
// TODO
});
// String error
test('to test the property `error`', () async {
// TODO
});
});
}

View File

@@ -17,28 +17,43 @@ void main() {
// final instance = TagApi();
group('tests for TagApi', () {
//Future<TagResponseDto> create(CreateTagDto createTagDto) async
test('test create', () async {
//Future<TagResponseDto> createTag(CreateTagDto createTagDto) async
test('test createTag', () async {
// TODO
});
//Future delete(String id) async
test('test delete', () async {
//Future deleteTag(String id) async
test('test deleteTag', () async {
// TODO
});
//Future<List<TagResponseDto>> findAll() async
test('test findAll', () async {
//Future<List<TagResponseDto>> getAllTags() async
test('test getAllTags', () async {
// TODO
});
//Future<TagResponseDto> findOne(String id) async
test('test findOne', () async {
//Future<List<AssetResponseDto>> getTagAssets(String id) async
test('test getTagAssets', () async {
// TODO
});
//Future<TagResponseDto> update(String id, UpdateTagDto updateTagDto) async
test('test update', () async {
//Future<TagResponseDto> getTagById(String id) async
test('test getTagById', () async {
// TODO
});
//Future<List<AssetIdsResponseDto>> tagAssets(String id, AssetIdsDto assetIdsDto) async
test('test tagAssets', () async {
// TODO
});
//Future<List<AssetIdsResponseDto>> untagAssets(String id, AssetIdsDto assetIdsDto) async
test('test untagAssets', () async {
// TODO
});
//Future<TagResponseDto> updateTag(String id, UpdateTagDto updateTagDto) async
test('test updateTag', () async {
// TODO
});

View File

@@ -16,13 +16,13 @@ void main() {
// final instance = TagResponseDto();
group('test TagResponseDto', () {
// String id
test('to test the property `id`', () async {
// TagTypeEnum type
test('to test the property `type`', () async {
// TODO
});
// TagTypeEnum type
test('to test the property `type`', () async {
// String id
test('to test the property `id`', () async {
// TODO
});
@@ -36,11 +36,6 @@ void main() {
// TODO
});
// String renameTagId
test('to test the property `renameTagId`', () async {
// TODO
});
});

View File

@@ -21,11 +21,6 @@ void main() {
// TODO
});
// String renameTagId
test('to test the property `renameTagId`', () async {
// TODO
});
});