diff --git a/lib/api/swagger.yaml b/lib/api/swagger.yaml index c6fe041..7c6aaf9 100644 --- a/lib/api/swagger.yaml +++ b/lib/api/swagger.yaml @@ -1505,6 +1505,20 @@ paths: $ref: '#/components/schemas/AgendaDTO' security: - bearer: [] + /api/Section/WeatherDTO: + get: + tags: + - Section + operationId: Section_GetWeatherDTO + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/WeatherDTO' + security: + - bearer: [] /api/User: get: tags: @@ -1827,6 +1841,16 @@ components: type: boolean isHour: type: boolean + isSectionImageBackground: + type: boolean + roundedValue: + type: integer + format: int32 + nullable: true + screenPercentageSectionsMainPage: + type: integer + format: int32 + nullable: true TranslationDTO: type: object additionalProperties: false @@ -1931,6 +1955,7 @@ components: 7 = PDF 8 = Puzzle 9 = Agenda + 10 = Weather x-enumNames: - Map - Slider @@ -1942,6 +1967,7 @@ components: - PDF - Puzzle - Agenda + - Weather enum: - 0 - 1 @@ -1953,6 +1979,7 @@ components: - 7 - 8 - 9 + - 10 ResourceDTO: type: object additionalProperties: false @@ -2216,6 +2243,31 @@ components: longitude: type: string nullable: true + schedules: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + prices: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + phone: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + email: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' + site: + type: array + nullable: true + items: + $ref: '#/components/schemas/TranslationDTO' ContentGeoPoint: type: object additionalProperties: false @@ -2495,6 +2547,20 @@ components: nullable: true oneOf: - $ref: '#/components/schemas/MapProvider' + WeatherDTO: + type: object + additionalProperties: false + properties: + city: + type: string + nullable: true + updatedDate: + type: string + format: date-time + nullable: true + result: + type: string + nullable: true User: type: object additionalProperties: false diff --git a/manager_api/.openapi-generator/FILES b/manager_api/.openapi-generator/FILES index 7d78126..7849567 100644 --- a/manager_api/.openapi-generator/FILES +++ b/manager_api/.openapi-generator/FILES @@ -54,6 +54,7 @@ doc/User.md doc/UserApi.md doc/UserDetailDTO.md doc/VideoDTO.md +doc/WeatherDTO.md doc/WebDTO.md git_push.sh lib/api.dart @@ -117,6 +118,8 @@ lib/model/translation_dto.dart lib/model/user.dart lib/model/user_detail_dto.dart lib/model/video_dto.dart +lib/model/weather_dto.dart lib/model/web_dto.dart pubspec.yaml test/pdf_file_dto_test.dart +test/weather_dto_test.dart diff --git a/manager_api/README.md b/manager_api/README.md index bb3bee1..7a47de3 100644 --- a/manager_api/README.md +++ b/manager_api/README.md @@ -60,7 +60,7 @@ try { ## Documentation for API Endpoints -All URIs are relative to *https://localhost:5001* +All URIs are relative to *https://api.myinfomate.be* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- @@ -110,6 +110,7 @@ Class | Method | HTTP request | Description *SectionApi* | [**sectionGetQuizzDTO**](doc\/SectionApi.md#sectiongetquizzdto) | **GET** /api/Section/QuizzDTO | *SectionApi* | [**sectionGetSliderDTO**](doc\/SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO | *SectionApi* | [**sectionGetVideoDTO**](doc\/SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO | +*SectionApi* | [**sectionGetWeatherDTO**](doc\/SectionApi.md#sectiongetweatherdto) | **GET** /api/Section/WeatherDTO | *SectionApi* | [**sectionGetWebDTO**](doc\/SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO | *SectionApi* | [**sectionPlayerMessageDTO**](doc\/SectionApi.md#sectionplayermessagedto) | **GET** /api/Section/PlayerMessageDTO | *SectionApi* | [**sectionUpdate**](doc\/SectionApi.md#sectionupdate) | **PUT** /api/Section | @@ -168,6 +169,7 @@ Class | Method | HTTP request | Description - [User](doc\/User.md) - [UserDetailDTO](doc\/UserDetailDTO.md) - [VideoDTO](doc\/VideoDTO.md) + - [WeatherDTO](doc\/WeatherDTO.md) - [WebDTO](doc\/WebDTO.md) diff --git a/manager_api/doc/ConfigurationDTO.md b/manager_api/doc/ConfigurationDTO.md index 69f53fc..edf6380 100644 --- a/manager_api/doc/ConfigurationDTO.md +++ b/manager_api/doc/ConfigurationDTO.md @@ -30,6 +30,9 @@ Name | Type | Description | Notes **isWeather** | **bool** | | [optional] **isDate** | **bool** | | [optional] **isHour** | **bool** | | [optional] +**isSectionImageBackground** | **bool** | | [optional] +**roundedValue** | **int** | | [optional] +**screenPercentageSectionsMainPage** | **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/ExportConfigurationDTO.md b/manager_api/doc/ExportConfigurationDTO.md index 534051b..3c88c48 100644 --- a/manager_api/doc/ExportConfigurationDTO.md +++ b/manager_api/doc/ExportConfigurationDTO.md @@ -30,6 +30,9 @@ Name | Type | Description | Notes **isWeather** | **bool** | | [optional] **isDate** | **bool** | | [optional] **isHour** | **bool** | | [optional] +**isSectionImageBackground** | **bool** | | [optional] +**roundedValue** | **int** | | [optional] +**screenPercentageSectionsMainPage** | **int** | | [optional] **sections** | [**List**](SectionDTO.md) | | [optional] [default to const []] **resources** | [**List**](ResourceDTO.md) | | [optional] [default to const []] diff --git a/manager_api/doc/GeoPointDTO.md b/manager_api/doc/GeoPointDTO.md index c22d4b3..93f8a5c 100644 --- a/manager_api/doc/GeoPointDTO.md +++ b/manager_api/doc/GeoPointDTO.md @@ -15,6 +15,11 @@ Name | Type | Description | Notes **categorie** | [**GeoPointDTOCategorie**](GeoPointDTOCategorie.md) | | [optional] **latitude** | **String** | | [optional] **longitude** | **String** | | [optional] +**schedules** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**prices** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**phone** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**email** | [**List**](TranslationDTO.md) | | [optional] [default to const []] +**site** | [**List**](TranslationDTO.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/SectionApi.md b/manager_api/doc/SectionApi.md index 039f7f4..5dba346 100644 --- a/manager_api/doc/SectionApi.md +++ b/manager_api/doc/SectionApi.md @@ -26,6 +26,7 @@ Method | HTTP request | Description [**sectionGetQuizzDTO**](SectionApi.md#sectiongetquizzdto) | **GET** /api/Section/QuizzDTO | [**sectionGetSliderDTO**](SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO | [**sectionGetVideoDTO**](SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO | +[**sectionGetWeatherDTO**](SectionApi.md#sectiongetweatherdto) | **GET** /api/Section/WeatherDTO | [**sectionGetWebDTO**](SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO | [**sectionPlayerMessageDTO**](SectionApi.md#sectionplayermessagedto) | **GET** /api/Section/PlayerMessageDTO | [**sectionUpdate**](SectionApi.md#sectionupdate) | **PUT** /api/Section | @@ -727,6 +728,45 @@ 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) +# **sectionGetWeatherDTO** +> WeatherDTO sectionGetWeatherDTO() + + + +### Example +```dart +import 'package:manager_api/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = SectionApi(); + +try { + final result = api_instance.sectionGetWeatherDTO(); + print(result); +} catch (e) { + print('Exception when calling SectionApi->sectionGetWeatherDTO: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**WeatherDTO**](WeatherDTO.md) + +### Authorization + +[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) + # **sectionGetWebDTO** > WebDTO sectionGetWebDTO() diff --git a/manager_api/doc/WeatherDTO.md b/manager_api/doc/WeatherDTO.md new file mode 100644 index 0000000..fedb7d7 --- /dev/null +++ b/manager_api/doc/WeatherDTO.md @@ -0,0 +1,17 @@ +# manager_api.model.WeatherDTO + +## Load the model package +```dart +import 'package:manager_api/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**city** | **String** | | [optional] +**updatedDate** | [**DateTime**](DateTime.md) | | [optional] +**result** | **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 f8ec430..078b45c 100644 --- a/manager_api/lib/api.dart +++ b/manager_api/lib/api.dart @@ -80,6 +80,7 @@ part 'model/translation_dto.dart'; part 'model/user.dart'; part 'model/user_detail_dto.dart'; part 'model/video_dto.dart'; +part 'model/weather_dto.dart'; part 'model/web_dto.dart'; diff --git a/manager_api/lib/api/section_api.dart b/manager_api/lib/api/section_api.dart index 5f94765..5dfcc5d 100644 --- a/manager_api/lib/api/section_api.dart +++ b/manager_api/lib/api/section_api.dart @@ -783,6 +783,47 @@ class SectionApi { return null; } + /// Performs an HTTP 'GET /api/Section/WeatherDTO' operation and returns the [Response]. + Future sectionGetWeatherDTOWithHttpInfo() async { + // ignore: prefer_const_declarations + final path = r'/api/Section/WeatherDTO'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + Future sectionGetWeatherDTO() async { + final response = await sectionGetWeatherDTOWithHttpInfo(); + 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) { + return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'WeatherDTO',) as WeatherDTO; + + } + return null; + } + /// Performs an HTTP 'GET /api/Section/WebDTO' operation and returns the [Response]. Future sectionGetWebDTOWithHttpInfo() async { // ignore: prefer_const_declarations diff --git a/manager_api/lib/api_client.dart b/manager_api/lib/api_client.dart index caa5476..2fb099d 100644 --- a/manager_api/lib/api_client.dart +++ b/manager_api/lib/api_client.dart @@ -11,7 +11,7 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'https://localhost:5001', this.authentication,}); + ApiClient({this.basePath = 'https://api.myinfomate.be', this.authentication,}); final String basePath; final Authentication? authentication; @@ -271,6 +271,8 @@ class ApiClient { return UserDetailDTO.fromJson(value); case 'VideoDTO': return VideoDTO.fromJson(value); + case 'WeatherDTO': + return WeatherDTO.fromJson(value); case 'WebDTO': return WebDTO.fromJson(value); default: diff --git a/manager_api/lib/model/configuration_dto.dart b/manager_api/lib/model/configuration_dto.dart index 810ef02..3d642fc 100644 --- a/manager_api/lib/model/configuration_dto.dart +++ b/manager_api/lib/model/configuration_dto.dart @@ -35,6 +35,9 @@ class ConfigurationDTO { this.isWeather, this.isDate, this.isHour, + this.isSectionImageBackground, + this.roundedValue, + this.screenPercentageSectionsMainPage, }); String? id; @@ -123,6 +126,18 @@ class ConfigurationDTO { /// bool? isHour; + /// + /// 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. + /// + bool? isSectionImageBackground; + + int? roundedValue; + + int? screenPercentageSectionsMainPage; + @override bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO && other.id == id && @@ -146,7 +161,10 @@ class ConfigurationDTO { other.weatherResult == weatherResult && other.isWeather == isWeather && other.isDate == isDate && - other.isHour == isHour; + other.isHour == isHour && + other.isSectionImageBackground == isSectionImageBackground && + other.roundedValue == roundedValue && + other.screenPercentageSectionsMainPage == screenPercentageSectionsMainPage; @override int get hashCode => @@ -172,10 +190,13 @@ class ConfigurationDTO { (weatherResult == null ? 0 : weatherResult!.hashCode) + (isWeather == null ? 0 : isWeather!.hashCode) + (isDate == null ? 0 : isDate!.hashCode) + - (isHour == null ? 0 : isHour!.hashCode); + (isHour == null ? 0 : isHour!.hashCode) + + (isSectionImageBackground == null ? 0 : isSectionImageBackground!.hashCode) + + (roundedValue == null ? 0 : roundedValue!.hashCode) + + (screenPercentageSectionsMainPage == null ? 0 : screenPercentageSectionsMainPage!.hashCode); @override - String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, weatherUpdatedDate=$weatherUpdatedDate, weatherResult=$weatherResult, isWeather=$isWeather, isDate=$isDate, isHour=$isHour]'; + String toString() => 'ConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, weatherUpdatedDate=$weatherUpdatedDate, weatherResult=$weatherResult, isWeather=$isWeather, isDate=$isDate, isHour=$isHour, isSectionImageBackground=$isSectionImageBackground, roundedValue=$roundedValue, screenPercentageSectionsMainPage=$screenPercentageSectionsMainPage]'; Map toJson() { final json = {}; @@ -289,6 +310,21 @@ class ConfigurationDTO { } else { json[r'isHour'] = null; } + if (this.isSectionImageBackground != null) { + json[r'isSectionImageBackground'] = this.isSectionImageBackground; + } else { + json[r'isSectionImageBackground'] = null; + } + if (this.roundedValue != null) { + json[r'roundedValue'] = this.roundedValue; + } else { + json[r'roundedValue'] = null; + } + if (this.screenPercentageSectionsMainPage != null) { + json[r'screenPercentageSectionsMainPage'] = this.screenPercentageSectionsMainPage; + } else { + json[r'screenPercentageSectionsMainPage'] = null; + } return json; } @@ -337,6 +373,9 @@ class ConfigurationDTO { isWeather: mapValueOfType(json, r'isWeather'), isDate: mapValueOfType(json, r'isDate'), isHour: mapValueOfType(json, r'isHour'), + isSectionImageBackground: mapValueOfType(json, r'isSectionImageBackground'), + roundedValue: mapValueOfType(json, r'roundedValue'), + screenPercentageSectionsMainPage: mapValueOfType(json, r'screenPercentageSectionsMainPage'), ); } return null; diff --git a/manager_api/lib/model/export_configuration_dto.dart b/manager_api/lib/model/export_configuration_dto.dart index 34ffbc1..e1f7cad 100644 --- a/manager_api/lib/model/export_configuration_dto.dart +++ b/manager_api/lib/model/export_configuration_dto.dart @@ -35,6 +35,9 @@ class ExportConfigurationDTO { this.isWeather, this.isDate, this.isHour, + this.isSectionImageBackground, + this.roundedValue, + this.screenPercentageSectionsMainPage, this.sections = const [], this.resources = const [], }); @@ -125,6 +128,18 @@ class ExportConfigurationDTO { /// bool? isHour; + /// + /// 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. + /// + bool? isSectionImageBackground; + + int? roundedValue; + + int? screenPercentageSectionsMainPage; + List? sections; List? resources; @@ -153,6 +168,9 @@ class ExportConfigurationDTO { other.isWeather == isWeather && other.isDate == isDate && other.isHour == isHour && + other.isSectionImageBackground == isSectionImageBackground && + other.roundedValue == roundedValue && + other.screenPercentageSectionsMainPage == screenPercentageSectionsMainPage && other.sections == sections && other.resources == resources; @@ -181,11 +199,14 @@ class ExportConfigurationDTO { (isWeather == null ? 0 : isWeather!.hashCode) + (isDate == null ? 0 : isDate!.hashCode) + (isHour == null ? 0 : isHour!.hashCode) + + (isSectionImageBackground == null ? 0 : isSectionImageBackground!.hashCode) + + (roundedValue == null ? 0 : roundedValue!.hashCode) + + (screenPercentageSectionsMainPage == null ? 0 : screenPercentageSectionsMainPage!.hashCode) + (sections == null ? 0 : sections!.hashCode) + (resources == null ? 0 : resources!.hashCode); @override - String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, weatherUpdatedDate=$weatherUpdatedDate, weatherResult=$weatherResult, isWeather=$isWeather, isDate=$isDate, isHour=$isHour, sections=$sections, resources=$resources]'; + String toString() => 'ExportConfigurationDTO[id=$id, label=$label, title=$title, imageId=$imageId, imageSource=$imageSource, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, isMobile=$isMobile, isTablet=$isTablet, isOffline=$isOffline, instanceId=$instanceId, sectionIds=$sectionIds, loaderImageId=$loaderImageId, loaderImageUrl=$loaderImageUrl, weatherCity=$weatherCity, weatherUpdatedDate=$weatherUpdatedDate, weatherResult=$weatherResult, isWeather=$isWeather, isDate=$isDate, isHour=$isHour, isSectionImageBackground=$isSectionImageBackground, roundedValue=$roundedValue, screenPercentageSectionsMainPage=$screenPercentageSectionsMainPage, sections=$sections, resources=$resources]'; Map toJson() { final json = {}; @@ -299,6 +320,21 @@ class ExportConfigurationDTO { } else { json[r'isHour'] = null; } + if (this.isSectionImageBackground != null) { + json[r'isSectionImageBackground'] = this.isSectionImageBackground; + } else { + json[r'isSectionImageBackground'] = null; + } + if (this.roundedValue != null) { + json[r'roundedValue'] = this.roundedValue; + } else { + json[r'roundedValue'] = null; + } + if (this.screenPercentageSectionsMainPage != null) { + json[r'screenPercentageSectionsMainPage'] = this.screenPercentageSectionsMainPage; + } else { + json[r'screenPercentageSectionsMainPage'] = null; + } if (this.sections != null) { json[r'sections'] = this.sections; } else { @@ -357,6 +393,9 @@ class ExportConfigurationDTO { isWeather: mapValueOfType(json, r'isWeather'), isDate: mapValueOfType(json, r'isDate'), isHour: mapValueOfType(json, r'isHour'), + isSectionImageBackground: mapValueOfType(json, r'isSectionImageBackground'), + roundedValue: mapValueOfType(json, r'roundedValue'), + screenPercentageSectionsMainPage: mapValueOfType(json, r'screenPercentageSectionsMainPage'), sections: SectionDTO.listFromJson(json[r'sections']), resources: ResourceDTO.listFromJson(json[r'resources']), ); diff --git a/manager_api/lib/model/geo_point_dto.dart b/manager_api/lib/model/geo_point_dto.dart index e221c40..5f6cc7a 100644 --- a/manager_api/lib/model/geo_point_dto.dart +++ b/manager_api/lib/model/geo_point_dto.dart @@ -20,6 +20,11 @@ class GeoPointDTO { this.categorie, this.latitude, this.longitude, + this.schedules = const [], + this.prices = const [], + this.phone = const [], + this.email = const [], + this.site = const [], }); int? id; @@ -36,6 +41,16 @@ class GeoPointDTO { String? longitude; + List? schedules; + + List? prices; + + List? phone; + + List? email; + + List? site; + @override bool operator ==(Object other) => identical(this, other) || other is GeoPointDTO && other.id == id && @@ -44,7 +59,12 @@ class GeoPointDTO { other.contents == contents && other.categorie == categorie && other.latitude == latitude && - other.longitude == longitude; + other.longitude == longitude && + other.schedules == schedules && + other.prices == prices && + other.phone == phone && + other.email == email && + other.site == site; @override int get hashCode => @@ -55,10 +75,15 @@ class GeoPointDTO { (contents == null ? 0 : contents!.hashCode) + (categorie == null ? 0 : categorie!.hashCode) + (latitude == null ? 0 : latitude!.hashCode) + - (longitude == null ? 0 : longitude!.hashCode); + (longitude == null ? 0 : longitude!.hashCode) + + (schedules == null ? 0 : schedules!.hashCode) + + (prices == null ? 0 : prices!.hashCode) + + (phone == null ? 0 : phone!.hashCode) + + (email == null ? 0 : email!.hashCode) + + (site == null ? 0 : site!.hashCode); @override - String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, contents=$contents, categorie=$categorie, latitude=$latitude, longitude=$longitude]'; + String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, contents=$contents, categorie=$categorie, latitude=$latitude, longitude=$longitude, schedules=$schedules, prices=$prices, phone=$phone, email=$email, site=$site]'; Map toJson() { final json = {}; @@ -97,6 +122,31 @@ class GeoPointDTO { } else { json[r'longitude'] = null; } + if (this.schedules != null) { + json[r'schedules'] = this.schedules; + } else { + json[r'schedules'] = null; + } + if (this.prices != null) { + json[r'prices'] = this.prices; + } else { + json[r'prices'] = null; + } + if (this.phone != null) { + json[r'phone'] = this.phone; + } else { + json[r'phone'] = null; + } + if (this.email != null) { + json[r'email'] = this.email; + } else { + json[r'email'] = null; + } + if (this.site != null) { + json[r'site'] = this.site; + } else { + json[r'site'] = null; + } return json; } @@ -126,6 +176,11 @@ class GeoPointDTO { categorie: GeoPointDTOCategorie.fromJson(json[r'categorie']), latitude: mapValueOfType(json, r'latitude'), longitude: mapValueOfType(json, r'longitude'), + schedules: TranslationDTO.listFromJson(json[r'schedules']), + prices: TranslationDTO.listFromJson(json[r'prices']), + phone: TranslationDTO.listFromJson(json[r'phone']), + email: TranslationDTO.listFromJson(json[r'email']), + site: TranslationDTO.listFromJson(json[r'site']), ); } return null; diff --git a/manager_api/lib/model/section_type.dart b/manager_api/lib/model/section_type.dart index e29b2c6..fe65f35 100644 --- a/manager_api/lib/model/section_type.dart +++ b/manager_api/lib/model/section_type.dart @@ -23,29 +23,31 @@ class SectionType { int toJson() => value; - static const map = SectionType._(0); - static const slider = SectionType._(1); - static const video = SectionType._(2); - static const web = SectionType._(3); - static const menu = SectionType._(4); - static const quizz = SectionType._(5); - static const article = SectionType._(6); - static const pdf = SectionType._(7); - static const puzzle = SectionType._(8); - static const agenda = SectionType._(9); + static const Map = SectionType._(0); + static const Slider = SectionType._(1); + static const Video = SectionType._(2); + static const Web = SectionType._(3); + static const Menu = SectionType._(4); + static const Quizz = SectionType._(5); + static const Article = SectionType._(6); + static const Pdf = SectionType._(7); + static const Puzzle = SectionType._(8); + static const Agenda = SectionType._(9); + static const Weather = SectionType._(10); /// List of all possible values in this [enum][SectionType]. static const values = [ - map, - slider, - video, - web, - menu, - quizz, - article, - pdf, - puzzle, - agenda + Map, + Slider, + Video, + Web, + Menu, + Quizz, + Article, + Pdf, + Puzzle, + Agenda, + Weather ]; static SectionType? fromJson(dynamic value) => SectionTypeTypeTransformer().decode(value); @@ -83,21 +85,19 @@ class SectionTypeTypeTransformer { /// and users are still using an old app with the old code. SectionType? decode(dynamic data, {bool allowNull = true}) { if (data != null) { - /*print("data.toString()"); - print(data.toString()); - print(data.runtimeType);*/ if(data.runtimeType == String) { switch (data.toString()) { - case r'Map': return SectionType.map; - case r'Slider': return SectionType.slider; - case r'Video': return SectionType.video; - case r'Web': return SectionType.web; - case r'Menu': return SectionType.menu; - case r'Quizz': return SectionType.quizz; - case r'Article': return SectionType.article; - case r'PDF': return SectionType.pdf; - case r'Puzzle': return SectionType.puzzle; - case r'Agenda': return SectionType.agenda; + case r'Map': return SectionType.Map; + case r'Slider': return SectionType.Slider; + case r'Video': return SectionType.Video; + case r'Web': return SectionType.Web; + case r'Menu': return SectionType.Menu; + case r'Quizz': return SectionType.Quizz; + case r'Article': return SectionType.Article; + case r'PDF': return SectionType.Pdf; + case r'Puzzle': return SectionType.Puzzle; + case r'Agenda': return SectionType.Agenda; + case r'Weather': return SectionType.Weather; default: if (!allowNull) { throw ArgumentError('Unknown enum value to decode: $data'); @@ -105,20 +105,18 @@ class SectionTypeTypeTransformer { } } else { if(data.runtimeType == int) { - //print("HELLOWWWWW INT"); switch (data) { - case 0: - print("RETURN MAP"); - return SectionType.map; - case 1: return SectionType.slider; - case 2: return SectionType.video; - case 3: return SectionType.web; - case 4: return SectionType.menu; - case 5: return SectionType.quizz; - case 6: return SectionType.article; - case 7: return SectionType.pdf; - case 8: return SectionType.puzzle; - case 9: return SectionType.agenda; + case 0: return SectionType.Map; + case 1: return SectionType.Slider; + case 2: return SectionType.Video; + case 3: return SectionType.Web; + case 4: return SectionType.Menu; + case 5: return SectionType.Quizz; + case 6: return SectionType.Article; + case 7: return SectionType.Pdf; + case 8: return SectionType.Puzzle; + case 9: return SectionType.Agenda; + case 10: return SectionType.Weather; default: if (!allowNull) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/manager_api/lib/model/weather_dto.dart b/manager_api/lib/model/weather_dto.dart new file mode 100644 index 0000000..e2447d0 --- /dev/null +++ b/manager_api/lib/model/weather_dto.dart @@ -0,0 +1,134 @@ +// +// 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 WeatherDTO { + /// Returns a new [WeatherDTO] instance. + WeatherDTO({ + this.city, + this.updatedDate, + this.result, + }); + + String? city; + + DateTime? updatedDate; + + String? result; + + @override + bool operator ==(Object other) => identical(this, other) || other is WeatherDTO && + other.city == city && + other.updatedDate == updatedDate && + other.result == result; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (city == null ? 0 : city!.hashCode) + + (updatedDate == null ? 0 : updatedDate!.hashCode) + + (result == null ? 0 : result!.hashCode); + + @override + String toString() => 'WeatherDTO[city=$city, updatedDate=$updatedDate, result=$result]'; + + Map toJson() { + final json = {}; + if (this.city != null) { + json[r'city'] = this.city; + } else { + json[r'city'] = null; + } + if (this.updatedDate != null) { + json[r'updatedDate'] = this.updatedDate!.toUtc().toIso8601String(); + } else { + json[r'updatedDate'] = null; + } + if (this.result != null) { + json[r'result'] = this.result; + } else { + json[r'result'] = null; + } + return json; + } + + /// Returns a new [WeatherDTO] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static WeatherDTO? 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 "WeatherDTO[$key]" is missing from JSON.'); + assert(json[key] != null, 'Required key "WeatherDTO[$key]" has a null value in JSON.'); + }); + return true; + }()); + + return WeatherDTO( + city: mapValueOfType(json, r'city'), + updatedDate: mapDateTime(json, r'updatedDate', ''), + result: mapValueOfType(json, r'result'), + ); + } + 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 = WeatherDTO.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 = WeatherDTO.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of WeatherDTO-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] = WeatherDTO.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/weather_dto_test.dart b/manager_api/test/weather_dto_test.dart new file mode 100644 index 0000000..dabee61 --- /dev/null +++ b/manager_api/test/weather_dto_test.dart @@ -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:manager_api/api.dart'; +import 'package:test/test.dart'; + +// tests for WeatherDTO +void main() { + // final instance = WeatherDTO(); + + group('test WeatherDTO', () { + // String city + test('to test the property `city`', () async { + // TODO + }); + + // DateTime updatedDate + test('to test the property `updatedDate`', () async { + // TODO + }); + + // String result + test('to test the property `result`', () async { + // TODO + }); + + + }); + +}