From e67880bc5047f00b81331bc1dada1e9d6cf3fa06 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Wed, 27 Dec 2023 18:24:30 +0100 Subject: [PATCH] update service generation --- lib/api/swagger.yaml | 66 ++++--- manager_api/.openapi-generator/FILES | 2 + manager_api/README.md | 1 + manager_api/doc/CategorieDTO.md | 5 +- manager_api/doc/GeoPointDTOCategorie.md | 5 +- manager_api/doc/LevelDTO.md | 5 +- manager_api/doc/PuzzleDTO.md | 4 +- manager_api/doc/QuestionDTO.md | 8 +- manager_api/doc/QuizzDTOBadLevel.md | 5 +- manager_api/doc/ResponseDTO.md | 5 +- manager_api/doc/TranslationAndResourceDTO.md | 19 ++ manager_api/lib/api.dart | 1 + manager_api/lib/api_client.dart | 2 + manager_api/lib/model/categorie_dto.dart | 55 ++++-- .../lib/model/geo_point_dto_categorie.dart | 55 ++++-- manager_api/lib/model/level_dto.dart | 49 +----- manager_api/lib/model/puzzle_dto.dart | 8 +- manager_api/lib/model/question_dto.dart | 54 +++--- .../lib/model/quizz_dto_bad_level.dart | 49 +----- manager_api/lib/model/response_dto.dart | 45 +---- .../model/translation_and_resource_dto.dart | 162 ++++++++++++++++++ .../translation_and_resource_dto_test.dart | 47 +++++ 22 files changed, 423 insertions(+), 229 deletions(-) create mode 100644 manager_api/doc/TranslationAndResourceDTO.md create mode 100644 manager_api/lib/model/translation_and_resource_dto.dart create mode 100644 manager_api/test/translation_and_resource_dto_test.dart diff --git a/lib/api/swagger.yaml b/lib/api/swagger.yaml index e873dc2..e6997e0 100644 --- a/lib/api/swagger.yaml +++ b/lib/api/swagger.yaml @@ -2175,12 +2175,24 @@ components: type: object additionalProperties: false properties: - name: - type: string + label: + type: array nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' icon: type: string nullable: true + iconResourceId: + type: string + nullable: true + iconUrl: + type: string + nullable: true + order: + type: integer + format: int32 + nullable: true SliderDTO: type: object additionalProperties: false @@ -2279,12 +2291,33 @@ components: type: array nullable: true items: - $ref: '#/components/schemas/TranslationDTO' + $ref: '#/components/schemas/TranslationAndResourceDTO' responses: type: array nullable: true items: $ref: '#/components/schemas/ResponseDTO' + imageBackgroundResourceId: + type: string + nullable: true + imageBackgroundResourceType: + $ref: '#/components/schemas/ResourceType' + imageBackgroundResourceUrl: + type: string + nullable: true + order: + type: integer + format: int32 + TranslationAndResourceDTO: + type: object + additionalProperties: false + properties: + language: + type: string + nullable: true + value: + type: string + nullable: true resourceId: type: string nullable: true @@ -2293,9 +2326,6 @@ components: resourceUrl: type: string nullable: true - order: - type: integer - format: int32 ResponseDTO: type: object additionalProperties: false @@ -2304,17 +2334,9 @@ components: type: array nullable: true items: - $ref: '#/components/schemas/TranslationDTO' + $ref: '#/components/schemas/TranslationAndResourceDTO' isGood: type: boolean - resourceId: - type: string - nullable: true - resourceType: - $ref: '#/components/schemas/ResourceType' - resourceUrl: - type: string - nullable: true order: type: integer format: int32 @@ -2326,15 +2348,7 @@ components: type: array nullable: true items: - $ref: '#/components/schemas/TranslationDTO' - resourceId: - type: string - nullable: true - resourceType: - $ref: '#/components/schemas/ResourceType' - resourceUrl: - type: string - nullable: true + $ref: '#/components/schemas/TranslationAndResourceDTO' ArticleDTO: type: object additionalProperties: false @@ -2376,12 +2390,12 @@ components: type: array nullable: true items: - $ref: '#/components/schemas/TranslationDTO' + $ref: '#/components/schemas/TranslationAndResourceDTO' messageFin: type: array nullable: true items: - $ref: '#/components/schemas/TranslationDTO' + $ref: '#/components/schemas/TranslationAndResourceDTO' image: nullable: true oneOf: diff --git a/manager_api/.openapi-generator/FILES b/manager_api/.openapi-generator/FILES index 0fd499a..091da7e 100644 --- a/manager_api/.openapi-generator/FILES +++ b/manager_api/.openapi-generator/FILES @@ -42,6 +42,7 @@ doc/SectionDTO.md doc/SectionType.md doc/SliderDTO.md doc/TokenDTO.md +doc/TranslationAndResourceDTO.md doc/TranslationDTO.md doc/User.md doc/UserApi.md @@ -99,6 +100,7 @@ lib/model/section_dto.dart lib/model/section_type.dart lib/model/slider_dto.dart lib/model/token_dto.dart +lib/model/translation_and_resource_dto.dart lib/model/translation_dto.dart lib/model/user.dart lib/model/user_detail_dto.dart diff --git a/manager_api/README.md b/manager_api/README.md index 51c0bba..c1ec6b7 100644 --- a/manager_api/README.md +++ b/manager_api/README.md @@ -157,6 +157,7 @@ Class | Method | HTTP request | Description - [SectionType](doc\/SectionType.md) - [SliderDTO](doc\/SliderDTO.md) - [TokenDTO](doc\/TokenDTO.md) + - [TranslationAndResourceDTO](doc\/TranslationAndResourceDTO.md) - [TranslationDTO](doc\/TranslationDTO.md) - [User](doc\/User.md) - [UserDetailDTO](doc\/UserDetailDTO.md) diff --git a/manager_api/doc/CategorieDTO.md b/manager_api/doc/CategorieDTO.md index 58c3a49..5495085 100644 --- a/manager_api/doc/CategorieDTO.md +++ b/manager_api/doc/CategorieDTO.md @@ -8,8 +8,11 @@ import 'package:manager_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **String** | | [optional] +**label** | [**List**](TranslationDTO.md) | | [optional] [default to const []] **icon** | **String** | | [optional] +**iconResourceId** | **String** | | [optional] +**iconUrl** | **String** | | [optional] +**order** | **int** | | [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) diff --git a/manager_api/doc/GeoPointDTOCategorie.md b/manager_api/doc/GeoPointDTOCategorie.md index cc339e2..bb14184 100644 --- a/manager_api/doc/GeoPointDTOCategorie.md +++ b/manager_api/doc/GeoPointDTOCategorie.md @@ -8,8 +8,11 @@ import 'package:manager_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **String** | | [optional] +**label** | [**List**](TranslationDTO.md) | | [optional] [default to const []] **icon** | **String** | | [optional] +**iconResourceId** | **String** | | [optional] +**iconUrl** | **String** | | [optional] +**order** | **int** | | [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) diff --git a/manager_api/doc/LevelDTO.md b/manager_api/doc/LevelDTO.md index d50dfe4..d87fee3 100644 --- a/manager_api/doc/LevelDTO.md +++ b/manager_api/doc/LevelDTO.md @@ -8,10 +8,7 @@ import 'package:manager_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**label** | [**List**](TranslationDTO.md) | | [optional] [default to const []] -**resourceId** | **String** | | [optional] -**resourceType** | [**ResourceType**](ResourceType.md) | | [optional] -**resourceUrl** | **String** | | [optional] +**label** | [**List**](TranslationAndResourceDTO.md) | | [optional] [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) diff --git a/manager_api/doc/PuzzleDTO.md b/manager_api/doc/PuzzleDTO.md index 076df06..55c1750 100644 --- a/manager_api/doc/PuzzleDTO.md +++ b/manager_api/doc/PuzzleDTO.md @@ -8,8 +8,8 @@ import 'package:manager_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messageDebut** | [**List**](TranslationDTO.md) | | [optional] [default to const []] -**messageFin** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**messageDebut** | [**List**](TranslationAndResourceDTO.md) | | [optional] [default to const []] +**messageFin** | [**List**](TranslationAndResourceDTO.md) | | [optional] [default to const []] **image** | [**PuzzleDTOImage**](PuzzleDTOImage.md) | | [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) diff --git a/manager_api/doc/QuestionDTO.md b/manager_api/doc/QuestionDTO.md index e4bbbb3..24020cc 100644 --- a/manager_api/doc/QuestionDTO.md +++ b/manager_api/doc/QuestionDTO.md @@ -8,11 +8,11 @@ import 'package:manager_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**label** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**label** | [**List**](TranslationAndResourceDTO.md) | | [optional] [default to const []] **responses** | [**List**](ResponseDTO.md) | | [optional] [default to const []] -**resourceId** | **String** | | [optional] -**resourceType** | [**ResourceType**](ResourceType.md) | | [optional] -**resourceUrl** | **String** | | [optional] +**imageBackgroundResourceId** | **String** | | [optional] +**imageBackgroundResourceType** | [**ResourceType**](ResourceType.md) | | [optional] +**imageBackgroundResourceUrl** | **String** | | [optional] **order** | **int** | | [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) diff --git a/manager_api/doc/QuizzDTOBadLevel.md b/manager_api/doc/QuizzDTOBadLevel.md index 48b8beb..fd4ad3a 100644 --- a/manager_api/doc/QuizzDTOBadLevel.md +++ b/manager_api/doc/QuizzDTOBadLevel.md @@ -8,10 +8,7 @@ import 'package:manager_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**label** | [**List**](TranslationDTO.md) | | [optional] [default to const []] -**resourceId** | **String** | | [optional] -**resourceType** | [**ResourceType**](ResourceType.md) | | [optional] -**resourceUrl** | **String** | | [optional] +**label** | [**List**](TranslationAndResourceDTO.md) | | [optional] [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) diff --git a/manager_api/doc/ResponseDTO.md b/manager_api/doc/ResponseDTO.md index 91d84ba..c40e9a8 100644 --- a/manager_api/doc/ResponseDTO.md +++ b/manager_api/doc/ResponseDTO.md @@ -8,11 +8,8 @@ import 'package:manager_api/api.dart'; ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**label** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**label** | [**List**](TranslationAndResourceDTO.md) | | [optional] [default to const []] **isGood** | **bool** | | [optional] -**resourceId** | **String** | | [optional] -**resourceType** | [**ResourceType**](ResourceType.md) | | [optional] -**resourceUrl** | **String** | | [optional] **order** | **int** | | [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) diff --git a/manager_api/doc/TranslationAndResourceDTO.md b/manager_api/doc/TranslationAndResourceDTO.md new file mode 100644 index 0000000..5f6f567 --- /dev/null +++ b/manager_api/doc/TranslationAndResourceDTO.md @@ -0,0 +1,19 @@ +# manager_api.model.TranslationAndResourceDTO + +## Load the model package +```dart +import 'package:manager_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**language** | **String** | | [optional] +**value** | **String** | | [optional] +**resourceId** | **String** | | [optional] +**resourceType** | [**ResourceType**](ResourceType.md) | | [optional] +**resourceUrl** | **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) + + diff --git a/manager_api/lib/api.dart b/manager_api/lib/api.dart index d05a44a..3a2761d 100644 --- a/manager_api/lib/api.dart +++ b/manager_api/lib/api.dart @@ -69,6 +69,7 @@ part 'model/section_dto.dart'; part 'model/section_type.dart'; part 'model/slider_dto.dart'; part 'model/token_dto.dart'; +part 'model/translation_and_resource_dto.dart'; part 'model/translation_dto.dart'; part 'model/user.dart'; part 'model/user_detail_dto.dart'; diff --git a/manager_api/lib/api_client.dart b/manager_api/lib/api_client.dart index d12228b..0193f94 100644 --- a/manager_api/lib/api_client.dart +++ b/manager_api/lib/api_client.dart @@ -249,6 +249,8 @@ class ApiClient { return SliderDTO.fromJson(value); case 'TokenDTO': return TokenDTO.fromJson(value); + case 'TranslationAndResourceDTO': + return TranslationAndResourceDTO.fromJson(value); case 'TranslationDTO': return TranslationDTO.fromJson(value); case 'User': diff --git a/manager_api/lib/model/categorie_dto.dart b/manager_api/lib/model/categorie_dto.dart index ce4fcbe..823a423 100644 --- a/manager_api/lib/model/categorie_dto.dart +++ b/manager_api/lib/model/categorie_dto.dart @@ -13,40 +13,70 @@ part of openapi.api; class CategorieDTO { /// Returns a new [CategorieDTO] instance. CategorieDTO({ - this.name, + this.label = const [], this.icon, + this.iconResourceId, + this.iconUrl, + this.order, }); - String? name; + List? label; String? icon; + String? iconResourceId; + + String? iconUrl; + + int? order; + @override bool operator ==(Object other) => identical(this, other) || other is CategorieDTO && - other.name == name && - other.icon == icon; + other.label == label && + other.icon == icon && + other.iconResourceId == iconResourceId && + other.iconUrl == iconUrl && + other.order == order; @override int get hashCode => // ignore: unnecessary_parenthesis - (name == null ? 0 : name!.hashCode) + - (icon == null ? 0 : icon!.hashCode); + (label == null ? 0 : label!.hashCode) + + (icon == null ? 0 : icon!.hashCode) + + (iconResourceId == null ? 0 : iconResourceId!.hashCode) + + (iconUrl == null ? 0 : iconUrl!.hashCode) + + (order == null ? 0 : order!.hashCode); @override - String toString() => 'CategorieDTO[name=$name, icon=$icon]'; + String toString() => 'CategorieDTO[label=$label, icon=$icon, iconResourceId=$iconResourceId, iconUrl=$iconUrl, order=$order]'; Map toJson() { final json = {}; - if (this.name != null) { - json[r'name'] = this.name; + if (this.label != null) { + json[r'label'] = this.label; } else { - json[r'name'] = null; + json[r'label'] = null; } if (this.icon != null) { json[r'icon'] = this.icon; } else { json[r'icon'] = null; } + if (this.iconResourceId != null) { + json[r'iconResourceId'] = this.iconResourceId; + } else { + json[r'iconResourceId'] = null; + } + if (this.iconUrl != null) { + json[r'iconUrl'] = this.iconUrl; + } else { + json[r'iconUrl'] = null; + } + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; + } return json; } @@ -69,8 +99,11 @@ class CategorieDTO { }()); return CategorieDTO( - name: mapValueOfType(json, r'name'), + label: TranslationDTO.listFromJson(json[r'label']), icon: mapValueOfType(json, r'icon'), + iconResourceId: mapValueOfType(json, r'iconResourceId'), + iconUrl: mapValueOfType(json, r'iconUrl'), + order: mapValueOfType(json, r'order'), ); } return null; diff --git a/manager_api/lib/model/geo_point_dto_categorie.dart b/manager_api/lib/model/geo_point_dto_categorie.dart index 184646a..ad87bbb 100644 --- a/manager_api/lib/model/geo_point_dto_categorie.dart +++ b/manager_api/lib/model/geo_point_dto_categorie.dart @@ -13,40 +13,70 @@ part of openapi.api; class GeoPointDTOCategorie { /// Returns a new [GeoPointDTOCategorie] instance. GeoPointDTOCategorie({ - this.name, + this.label = const [], this.icon, + this.iconResourceId, + this.iconUrl, + this.order, }); - String? name; + List? label; String? icon; + String? iconResourceId; + + String? iconUrl; + + int? order; + @override bool operator ==(Object other) => identical(this, other) || other is GeoPointDTOCategorie && - other.name == name && - other.icon == icon; + other.label == label && + other.icon == icon && + other.iconResourceId == iconResourceId && + other.iconUrl == iconUrl && + other.order == order; @override int get hashCode => // ignore: unnecessary_parenthesis - (name == null ? 0 : name!.hashCode) + - (icon == null ? 0 : icon!.hashCode); + (label == null ? 0 : label!.hashCode) + + (icon == null ? 0 : icon!.hashCode) + + (iconResourceId == null ? 0 : iconResourceId!.hashCode) + + (iconUrl == null ? 0 : iconUrl!.hashCode) + + (order == null ? 0 : order!.hashCode); @override - String toString() => 'GeoPointDTOCategorie[name=$name, icon=$icon]'; + String toString() => 'GeoPointDTOCategorie[label=$label, icon=$icon, iconResourceId=$iconResourceId, iconUrl=$iconUrl, order=$order]'; Map toJson() { final json = {}; - if (this.name != null) { - json[r'name'] = this.name; + if (this.label != null) { + json[r'label'] = this.label; } else { - json[r'name'] = null; + json[r'label'] = null; } if (this.icon != null) { json[r'icon'] = this.icon; } else { json[r'icon'] = null; } + if (this.iconResourceId != null) { + json[r'iconResourceId'] = this.iconResourceId; + } else { + json[r'iconResourceId'] = null; + } + if (this.iconUrl != null) { + json[r'iconUrl'] = this.iconUrl; + } else { + json[r'iconUrl'] = null; + } + if (this.order != null) { + json[r'order'] = this.order; + } else { + json[r'order'] = null; + } return json; } @@ -69,8 +99,11 @@ class GeoPointDTOCategorie { }()); return GeoPointDTOCategorie( - name: mapValueOfType(json, r'name'), + label: TranslationDTO.listFromJson(json[r'label']), icon: mapValueOfType(json, r'icon'), + iconResourceId: mapValueOfType(json, r'iconResourceId'), + iconUrl: mapValueOfType(json, r'iconUrl'), + order: mapValueOfType(json, r'order'), ); } return null; diff --git a/manager_api/lib/model/level_dto.dart b/manager_api/lib/model/level_dto.dart index ae154d9..79e8ea1 100644 --- a/manager_api/lib/model/level_dto.dart +++ b/manager_api/lib/model/level_dto.dart @@ -14,42 +14,21 @@ class LevelDTO { /// Returns a new [LevelDTO] instance. LevelDTO({ this.label = const [], - this.resourceId, - this.resourceType, - this.resourceUrl, }); - List? label; - - String? resourceId; - - /// - /// 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. - /// - ResourceType? resourceType; - - String? resourceUrl; + List? label; @override bool operator ==(Object other) => identical(this, other) || other is LevelDTO && - other.label == label && - other.resourceId == resourceId && - other.resourceType == resourceType && - other.resourceUrl == resourceUrl; + other.label == label; @override int get hashCode => // ignore: unnecessary_parenthesis - (label == null ? 0 : label!.hashCode) + - (resourceId == null ? 0 : resourceId!.hashCode) + - (resourceType == null ? 0 : resourceType!.hashCode) + - (resourceUrl == null ? 0 : resourceUrl!.hashCode); + (label == null ? 0 : label!.hashCode); @override - String toString() => 'LevelDTO[label=$label, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl]'; + String toString() => 'LevelDTO[label=$label]'; Map toJson() { final json = {}; @@ -58,21 +37,6 @@ class LevelDTO { } else { json[r'label'] = null; } - if (this.resourceId != null) { - json[r'resourceId'] = this.resourceId; - } else { - json[r'resourceId'] = null; - } - if (this.resourceType != null) { - json[r'resourceType'] = this.resourceType; - } else { - json[r'resourceType'] = null; - } - if (this.resourceUrl != null) { - json[r'resourceUrl'] = this.resourceUrl; - } else { - json[r'resourceUrl'] = null; - } return json; } @@ -95,10 +59,7 @@ class LevelDTO { }()); return LevelDTO( - label: TranslationDTO.listFromJson(json[r'label']), - resourceId: mapValueOfType(json, r'resourceId'), - resourceType: ResourceType.fromJson(json[r'resourceType']), - resourceUrl: mapValueOfType(json, r'resourceUrl'), + label: TranslationAndResourceDTO.listFromJson(json[r'label']), ); } return null; diff --git a/manager_api/lib/model/puzzle_dto.dart b/manager_api/lib/model/puzzle_dto.dart index 4b89f15..2955a13 100644 --- a/manager_api/lib/model/puzzle_dto.dart +++ b/manager_api/lib/model/puzzle_dto.dart @@ -18,9 +18,9 @@ class PuzzleDTO { this.image, }); - List? messageDebut; + List? messageDebut; - List? messageFin; + List? messageFin; PuzzleDTOImage? image; @@ -79,8 +79,8 @@ class PuzzleDTO { }()); return PuzzleDTO( - messageDebut: TranslationDTO.listFromJson(json[r'messageDebut']), - messageFin: TranslationDTO.listFromJson(json[r'messageFin']), + messageDebut: TranslationAndResourceDTO.listFromJson(json[r'messageDebut']), + messageFin: TranslationAndResourceDTO.listFromJson(json[r'messageFin']), image: PuzzleDTOImage.fromJson(json[r'image']), ); } diff --git a/manager_api/lib/model/question_dto.dart b/manager_api/lib/model/question_dto.dart index e2ee08c..4eb1254 100644 --- a/manager_api/lib/model/question_dto.dart +++ b/manager_api/lib/model/question_dto.dart @@ -15,17 +15,17 @@ class QuestionDTO { QuestionDTO({ this.label = const [], this.responses = const [], - this.resourceId, - this.resourceType, - this.resourceUrl, + this.imageBackgroundResourceId, + this.imageBackgroundResourceType, + this.imageBackgroundResourceUrl, this.order, }); - List? label; + List? label; List? responses; - String? resourceId; + String? imageBackgroundResourceId; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -33,9 +33,9 @@ class QuestionDTO { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - ResourceType? resourceType; + ResourceType? imageBackgroundResourceType; - String? resourceUrl; + String? imageBackgroundResourceUrl; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -49,9 +49,9 @@ class QuestionDTO { bool operator ==(Object other) => identical(this, other) || other is QuestionDTO && other.label == label && other.responses == responses && - other.resourceId == resourceId && - other.resourceType == resourceType && - other.resourceUrl == resourceUrl && + other.imageBackgroundResourceId == imageBackgroundResourceId && + other.imageBackgroundResourceType == imageBackgroundResourceType && + other.imageBackgroundResourceUrl == imageBackgroundResourceUrl && other.order == order; @override @@ -59,13 +59,13 @@ class QuestionDTO { // ignore: unnecessary_parenthesis (label == null ? 0 : label!.hashCode) + (responses == null ? 0 : responses!.hashCode) + - (resourceId == null ? 0 : resourceId!.hashCode) + - (resourceType == null ? 0 : resourceType!.hashCode) + - (resourceUrl == null ? 0 : resourceUrl!.hashCode) + + (imageBackgroundResourceId == null ? 0 : imageBackgroundResourceId!.hashCode) + + (imageBackgroundResourceType == null ? 0 : imageBackgroundResourceType!.hashCode) + + (imageBackgroundResourceUrl == null ? 0 : imageBackgroundResourceUrl!.hashCode) + (order == null ? 0 : order!.hashCode); @override - String toString() => 'QuestionDTO[label=$label, responses=$responses, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl, order=$order]'; + String toString() => 'QuestionDTO[label=$label, responses=$responses, imageBackgroundResourceId=$imageBackgroundResourceId, imageBackgroundResourceType=$imageBackgroundResourceType, imageBackgroundResourceUrl=$imageBackgroundResourceUrl, order=$order]'; Map toJson() { final json = {}; @@ -79,20 +79,20 @@ class QuestionDTO { } else { json[r'responses'] = null; } - if (this.resourceId != null) { - json[r'resourceId'] = this.resourceId; + if (this.imageBackgroundResourceId != null) { + json[r'imageBackgroundResourceId'] = this.imageBackgroundResourceId; } else { - json[r'resourceId'] = null; + json[r'imageBackgroundResourceId'] = null; } - if (this.resourceType != null) { - json[r'resourceType'] = this.resourceType; + if (this.imageBackgroundResourceType != null) { + json[r'imageBackgroundResourceType'] = this.imageBackgroundResourceType; } else { - json[r'resourceType'] = null; + json[r'imageBackgroundResourceType'] = null; } - if (this.resourceUrl != null) { - json[r'resourceUrl'] = this.resourceUrl; + if (this.imageBackgroundResourceUrl != null) { + json[r'imageBackgroundResourceUrl'] = this.imageBackgroundResourceUrl; } else { - json[r'resourceUrl'] = null; + json[r'imageBackgroundResourceUrl'] = null; } if (this.order != null) { json[r'order'] = this.order; @@ -121,11 +121,11 @@ class QuestionDTO { }()); return QuestionDTO( - label: TranslationDTO.listFromJson(json[r'label']), + label: TranslationAndResourceDTO.listFromJson(json[r'label']), responses: ResponseDTO.listFromJson(json[r'responses']), - resourceId: mapValueOfType(json, r'resourceId'), - resourceType: ResourceType.fromJson(json[r'resourceType']), - resourceUrl: mapValueOfType(json, r'resourceUrl'), + imageBackgroundResourceId: mapValueOfType(json, r'imageBackgroundResourceId'), + imageBackgroundResourceType: ResourceType.fromJson(json[r'imageBackgroundResourceType']), + imageBackgroundResourceUrl: mapValueOfType(json, r'imageBackgroundResourceUrl'), order: mapValueOfType(json, r'order'), ); } diff --git a/manager_api/lib/model/quizz_dto_bad_level.dart b/manager_api/lib/model/quizz_dto_bad_level.dart index 63b674b..3e2fee2 100644 --- a/manager_api/lib/model/quizz_dto_bad_level.dart +++ b/manager_api/lib/model/quizz_dto_bad_level.dart @@ -14,42 +14,21 @@ class QuizzDTOBadLevel { /// Returns a new [QuizzDTOBadLevel] instance. QuizzDTOBadLevel({ this.label = const [], - this.resourceId, - this.resourceType, - this.resourceUrl, }); - List? label; - - String? resourceId; - - /// - /// 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. - /// - ResourceType? resourceType; - - String? resourceUrl; + List? label; @override bool operator ==(Object other) => identical(this, other) || other is QuizzDTOBadLevel && - other.label == label && - other.resourceId == resourceId && - other.resourceType == resourceType && - other.resourceUrl == resourceUrl; + other.label == label; @override int get hashCode => // ignore: unnecessary_parenthesis - (label == null ? 0 : label!.hashCode) + - (resourceId == null ? 0 : resourceId!.hashCode) + - (resourceType == null ? 0 : resourceType!.hashCode) + - (resourceUrl == null ? 0 : resourceUrl!.hashCode); + (label == null ? 0 : label!.hashCode); @override - String toString() => 'QuizzDTOBadLevel[label=$label, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl]'; + String toString() => 'QuizzDTOBadLevel[label=$label]'; Map toJson() { final json = {}; @@ -58,21 +37,6 @@ class QuizzDTOBadLevel { } else { json[r'label'] = null; } - if (this.resourceId != null) { - json[r'resourceId'] = this.resourceId; - } else { - json[r'resourceId'] = null; - } - if (this.resourceType != null) { - json[r'resourceType'] = this.resourceType; - } else { - json[r'resourceType'] = null; - } - if (this.resourceUrl != null) { - json[r'resourceUrl'] = this.resourceUrl; - } else { - json[r'resourceUrl'] = null; - } return json; } @@ -95,10 +59,7 @@ class QuizzDTOBadLevel { }()); return QuizzDTOBadLevel( - label: TranslationDTO.listFromJson(json[r'label']), - resourceId: mapValueOfType(json, r'resourceId'), - resourceType: ResourceType.fromJson(json[r'resourceType']), - resourceUrl: mapValueOfType(json, r'resourceUrl'), + label: TranslationAndResourceDTO.listFromJson(json[r'label']), ); } return null; diff --git a/manager_api/lib/model/response_dto.dart b/manager_api/lib/model/response_dto.dart index d72237a..6963754 100644 --- a/manager_api/lib/model/response_dto.dart +++ b/manager_api/lib/model/response_dto.dart @@ -15,13 +15,10 @@ class ResponseDTO { ResponseDTO({ this.label = const [], this.isGood, - this.resourceId, - this.resourceType, - this.resourceUrl, this.order, }); - List? label; + List? label; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -31,18 +28,6 @@ class ResponseDTO { /// bool? isGood; - String? resourceId; - - /// - /// 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. - /// - ResourceType? resourceType; - - String? resourceUrl; - /// /// 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 @@ -55,9 +40,6 @@ class ResponseDTO { bool operator ==(Object other) => identical(this, other) || other is ResponseDTO && other.label == label && other.isGood == isGood && - other.resourceId == resourceId && - other.resourceType == resourceType && - other.resourceUrl == resourceUrl && other.order == order; @override @@ -65,13 +47,10 @@ class ResponseDTO { // ignore: unnecessary_parenthesis (label == null ? 0 : label!.hashCode) + (isGood == null ? 0 : isGood!.hashCode) + - (resourceId == null ? 0 : resourceId!.hashCode) + - (resourceType == null ? 0 : resourceType!.hashCode) + - (resourceUrl == null ? 0 : resourceUrl!.hashCode) + (order == null ? 0 : order!.hashCode); @override - String toString() => 'ResponseDTO[label=$label, isGood=$isGood, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl, order=$order]'; + String toString() => 'ResponseDTO[label=$label, isGood=$isGood, order=$order]'; Map toJson() { final json = {}; @@ -85,21 +64,6 @@ class ResponseDTO { } else { json[r'isGood'] = null; } - if (this.resourceId != null) { - json[r'resourceId'] = this.resourceId; - } else { - json[r'resourceId'] = null; - } - if (this.resourceType != null) { - json[r'resourceType'] = this.resourceType; - } else { - json[r'resourceType'] = null; - } - if (this.resourceUrl != null) { - json[r'resourceUrl'] = this.resourceUrl; - } else { - json[r'resourceUrl'] = null; - } if (this.order != null) { json[r'order'] = this.order; } else { @@ -127,11 +91,8 @@ class ResponseDTO { }()); return ResponseDTO( - label: TranslationDTO.listFromJson(json[r'label']), + label: TranslationAndResourceDTO.listFromJson(json[r'label']), isGood: mapValueOfType(json, r'isGood'), - resourceId: mapValueOfType(json, r'resourceId'), - resourceType: ResourceType.fromJson(json[r'resourceType']), - resourceUrl: mapValueOfType(json, r'resourceUrl'), order: mapValueOfType(json, r'order'), ); } diff --git a/manager_api/lib/model/translation_and_resource_dto.dart b/manager_api/lib/model/translation_and_resource_dto.dart new file mode 100644 index 0000000..f365b2e --- /dev/null +++ b/manager_api/lib/model/translation_and_resource_dto.dart @@ -0,0 +1,162 @@ +// +// 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 TranslationAndResourceDTO { + /// Returns a new [TranslationAndResourceDTO] instance. + TranslationAndResourceDTO({ + this.language, + this.value, + this.resourceId, + this.resourceType, + this.resourceUrl, + }); + + String? language; + + String? value; + + String? resourceId; + + /// + /// 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. + /// + ResourceType? resourceType; + + String? resourceUrl; + + @override + bool operator ==(Object other) => identical(this, other) || other is TranslationAndResourceDTO && + other.language == language && + other.value == value && + other.resourceId == resourceId && + other.resourceType == resourceType && + other.resourceUrl == resourceUrl; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (language == null ? 0 : language!.hashCode) + + (value == null ? 0 : value!.hashCode) + + (resourceId == null ? 0 : resourceId!.hashCode) + + (resourceType == null ? 0 : resourceType!.hashCode) + + (resourceUrl == null ? 0 : resourceUrl!.hashCode); + + @override + String toString() => 'TranslationAndResourceDTO[language=$language, value=$value, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl]'; + + Map toJson() { + final json = {}; + if (this.language != null) { + json[r'language'] = this.language; + } else { + json[r'language'] = null; + } + if (this.value != null) { + json[r'value'] = this.value; + } else { + json[r'value'] = null; + } + if (this.resourceId != null) { + json[r'resourceId'] = this.resourceId; + } else { + json[r'resourceId'] = null; + } + if (this.resourceType != null) { + json[r'resourceType'] = this.resourceType; + } else { + json[r'resourceType'] = null; + } + if (this.resourceUrl != null) { + json[r'resourceUrl'] = this.resourceUrl; + } else { + json[r'resourceUrl'] = null; + } + return json; + } + + /// Returns a new [TranslationAndResourceDTO] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static TranslationAndResourceDTO? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + // 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 "TranslationAndResourceDTO[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "TranslationAndResourceDTO[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return TranslationAndResourceDTO( + language: mapValueOfType(json, r'language'), + value: mapValueOfType(json, r'value'), + resourceId: mapValueOfType(json, r'resourceId'), + resourceType: ResourceType.fromJson(json[r'resourceType']), + resourceUrl: mapValueOfType(json, r'resourceUrl'), + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = TranslationAndResourceDTO.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = TranslationAndResourceDTO.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of TranslationAndResourceDTO-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = TranslationAndResourceDTO.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + }; +} + diff --git a/manager_api/test/translation_and_resource_dto_test.dart b/manager_api/test/translation_and_resource_dto_test.dart new file mode 100644 index 0000000..9eccea6 --- /dev/null +++ b/manager_api/test/translation_and_resource_dto_test.dart @@ -0,0 +1,47 @@ +// +// 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:manager_api/api.dart'; +import 'package:test/test.dart'; + +// tests for TranslationAndResourceDTO +void main() { + // final instance = TranslationAndResourceDTO(); + + group('test TranslationAndResourceDTO', () { + // String language + test('to test the property `language`', () async { + // TODO + }); + + // String value + test('to test the property `value`', () async { + // TODO + }); + + // String resourceId + test('to test the property `resourceId`', () async { + // TODO + }); + + // ResourceType resourceType + test('to test the property `resourceType`', () async { + // TODO + }); + + // String resourceUrl + test('to test the property `resourceUrl`', () async { + // TODO + }); + + + }); + +}