From 9e4cd502cc64512a154a08544fa36ce0b7452430 Mon Sep 17 00:00:00 2001 From: Thomas Fransolet Date: Sat, 10 Apr 2021 22:57:02 +0200 Subject: [PATCH] Swagger service generation update --- lib/client.dart | 8 +- lib/main.dart | 8 +- manager_api/.gitignore | 48 ---- manager_api/.openapi-generator/FILES | 26 +- manager_api/README.md | 14 +- manager_api/doc/AuthenticationApi.md | 2 +- manager_api/doc/ConfigurationApi.md | 229 ++++++++++++++++++ manager_api/doc/ConfigurationDTO.md | 21 ++ manager_api/doc/RessourceApi.md | 2 +- manager_api/doc/SectionApi.md | 2 +- manager_api/doc/SectionDTO.md | 1 + manager_api/doc/UserApi.md | 2 +- manager_api/lib/api.dart | 4 +- ...isplay_api.dart => configuration_api.dart} | 88 +++---- manager_api/lib/api_client.dart | 6 +- manager_api/lib/model/configuration_dto.dart | 131 ++++++++++ manager_api/lib/model/section_dto.dart | 11 +- manager_api/swagger.yaml | 49 ++-- manager_api/test/configuration_api_test.dart | 45 ++++ manager_api/test/configuration_dto_test.dart | 56 +++++ 20 files changed, 593 insertions(+), 160 deletions(-) create mode 100644 manager_api/doc/ConfigurationApi.md create mode 100644 manager_api/doc/ConfigurationDTO.md rename manager_api/lib/api/{display_api.dart => configuration_api.dart} (75%) create mode 100644 manager_api/lib/model/configuration_dto.dart create mode 100644 manager_api/test/configuration_api_test.dart create mode 100644 manager_api/test/configuration_dto_test.dart diff --git a/lib/client.dart b/lib/client.dart index 4d9b7db..5d6d066 100644 --- a/lib/client.dart +++ b/lib/client.dart @@ -11,8 +11,8 @@ class Client { UserApi _userApi; UserApi get userApi => _userApi; - DisplayApi _displayApi; - DisplayApi get displayApi => _displayApi; + ConfigurationApi _configurationApi; + ConfigurationApi get configurationApi => _configurationApi; SectionApi _sectionApi; SectionApi get sectionApi => _sectionApi; @@ -22,11 +22,11 @@ class Client { Client() { _apiClient = ApiClient( - basePath: "http://192.168.31.140"); + basePath: "http://192.168.31.96"); //basePath: "http://localhost:25049"); _authenticationApi = AuthenticationApi(_apiClient); _userApi = UserApi(_apiClient); - _displayApi = DisplayApi(_apiClient); + _configurationApi = ConfigurationApi(_apiClient); _sectionApi = SectionApi(_apiClient); _ressourceApi = RessourceApi(_apiClient); } diff --git a/lib/main.dart b/lib/main.dart index 46b653f..8b57b5e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -93,14 +93,14 @@ class _MyHomePageState extends State { } if (!isError) { - UserDetailDTO user = await clientAPI.userApi.userGetDetail("604a33639b4a377a413045b9"); + UserDetailDTO user = await clientAPI.userApi.userGetDetail("6071f74aaf542f03116f2b9b"); print("user values ??"); print(user.email); print(user.id); - List displays = await clientAPI.displayApi.displayGet(); - print("number of displays " + displays.length.toString()); - displays.forEach((element) { + List configurations = await clientAPI.configurationApi.configurationGet(); + print("number of configurations " + configurations.length.toString()); + configurations.forEach((element) { print(element); }); diff --git a/manager_api/.gitignore b/manager_api/.gitignore index 63cbf39..7c28044 100644 --- a/manager_api/.gitignore +++ b/manager_api/.gitignore @@ -25,51 +25,3 @@ doc/api/ # Don't commit pubspec lock file # (Library packages only! Remove pattern if developing an application package) pubspec.lock - -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -**/ios/Flutter/.last_build_id -.dart_tool/ -.flutter-plugins -.flutter-plugins-dependencies -.packages -.pub-cache/ -.pub/ -/build/ - -# Web related -lib/generated_plugin_registrant.dart - -# Symbolication related -app.*.symbols - -# Obfuscation related -app.*.map.json - -# Android Studio will place build artifacts here -/android/app/debug -/android/app/profile -/android/app/release - diff --git a/manager_api/.openapi-generator/FILES b/manager_api/.openapi-generator/FILES index 9d81cf0..0511881 100644 --- a/manager_api/.openapi-generator/FILES +++ b/manager_api/.openapi-generator/FILES @@ -1,10 +1,9 @@ .gitignore -.openapi-generator-ignore .travis.yml README.md doc/AuthenticationApi.md -doc/DisplayApi.md -doc/DisplayDTO.md +doc/ConfigurationApi.md +doc/ConfigurationDTO.md doc/LoginDTO.md doc/RessourceApi.md doc/RessourceDTO.md @@ -20,7 +19,7 @@ doc/UserDetailDTO.md git_push.sh lib/api.dart lib/api/authentication_api.dart -lib/api/display_api.dart +lib/api/configuration_api.dart lib/api/ressource_api.dart lib/api/section_api.dart lib/api/user_api.dart @@ -32,7 +31,7 @@ lib/auth/authentication.dart lib/auth/http_basic_auth.dart lib/auth/http_bearer_auth.dart lib/auth/oauth.dart -lib/model/display_dto.dart +lib/model/configuration_dto.dart lib/model/login_dto.dart lib/model/ressource_detail_dto.dart lib/model/ressource_dto.dart @@ -43,18 +42,5 @@ lib/model/token_dto.dart lib/model/user.dart lib/model/user_detail_dto.dart pubspec.yaml -test/authentication_api_test.dart -test/display_api_test.dart -test/display_dto_test.dart -test/login_dto_test.dart -test/ressource_api_test.dart -test/ressource_detail_dto_test.dart -test/ressource_dto_test.dart -test/ressource_type_test.dart -test/section_api_test.dart -test/section_dto_test.dart -test/section_type_test.dart -test/token_dto_test.dart -test/user_api_test.dart -test/user_detail_dto_test.dart -test/user_test.dart +test/configuration_api_test.dart +test/configuration_dto_test.dart diff --git a/manager_api/README.md b/manager_api/README.md index 9c16ba0..010988a 100644 --- a/manager_api/README.md +++ b/manager_api/README.md @@ -60,17 +60,17 @@ try { ## Documentation for API Endpoints -All URIs are relative to *https://localhost:44339* +All URIs are relative to *http://192.168.31.96* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AuthenticationApi* | [**authenticationAuthenticateWithForm**](doc\/AuthenticationApi.md#authenticationauthenticatewithform) | **POST** /api/Authentication/Token | *AuthenticationApi* | [**authenticationAuthenticateWithJson**](doc\/AuthenticationApi.md#authenticationauthenticatewithjson) | **POST** /api/Authentication/Authenticate | -*DisplayApi* | [**displayCreate**](doc\/DisplayApi.md#displaycreate) | **POST** /api/Display | -*DisplayApi* | [**displayDelete**](doc\/DisplayApi.md#displaydelete) | **DELETE** /api/Display/{id} | -*DisplayApi* | [**displayGet**](doc\/DisplayApi.md#displayget) | **GET** /api/Display | -*DisplayApi* | [**displayGetDetail**](doc\/DisplayApi.md#displaygetdetail) | **GET** /api/Display/{id} | -*DisplayApi* | [**displayUpdate**](doc\/DisplayApi.md#displayupdate) | **PUT** /api/Display | +*ConfigurationApi* | [**configurationCreate**](doc\/ConfigurationApi.md#configurationcreate) | **POST** /api/Configuration | +*ConfigurationApi* | [**configurationDelete**](doc\/ConfigurationApi.md#configurationdelete) | **DELETE** /api/Configuration/{id} | +*ConfigurationApi* | [**configurationGet**](doc\/ConfigurationApi.md#configurationget) | **GET** /api/Configuration | +*ConfigurationApi* | [**configurationGetDetail**](doc\/ConfigurationApi.md#configurationgetdetail) | **GET** /api/Configuration/{id} | +*ConfigurationApi* | [**configurationUpdate**](doc\/ConfigurationApi.md#configurationupdate) | **PUT** /api/Configuration | *RessourceApi* | [**ressourceCreate**](doc\/RessourceApi.md#ressourcecreate) | **POST** /api/Ressource | *RessourceApi* | [**ressourceDelete**](doc\/RessourceApi.md#ressourcedelete) | **DELETE** /api/Ressource/{id} | *RessourceApi* | [**ressourceGet**](doc\/RessourceApi.md#ressourceget) | **GET** /api/Ressource | @@ -92,7 +92,7 @@ Class | Method | HTTP request | Description ## Documentation For Models - - [DisplayDTO](doc\/DisplayDTO.md) + - [ConfigurationDTO](doc\/ConfigurationDTO.md) - [LoginDTO](doc\/LoginDTO.md) - [RessourceDTO](doc\/RessourceDTO.md) - [RessourceDetailDTO](doc\/RessourceDetailDTO.md) diff --git a/manager_api/doc/AuthenticationApi.md b/manager_api/doc/AuthenticationApi.md index 92d3753..464f981 100644 --- a/manager_api/doc/AuthenticationApi.md +++ b/manager_api/doc/AuthenticationApi.md @@ -5,7 +5,7 @@ import 'package:managerapi/api.dart'; ``` -All URIs are relative to *https://localhost:44339* +All URIs are relative to *http://192.168.31.96* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/manager_api/doc/ConfigurationApi.md b/manager_api/doc/ConfigurationApi.md new file mode 100644 index 0000000..e4acba2 --- /dev/null +++ b/manager_api/doc/ConfigurationApi.md @@ -0,0 +1,229 @@ +# managerapi.api.ConfigurationApi + +## Load the API package +```dart +import 'package:managerapi/api.dart'; +``` + +All URIs are relative to *http://192.168.31.96* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**configurationCreate**](ConfigurationApi.md#configurationcreate) | **POST** /api/Configuration | +[**configurationDelete**](ConfigurationApi.md#configurationdelete) | **DELETE** /api/Configuration/{id} | +[**configurationGet**](ConfigurationApi.md#configurationget) | **GET** /api/Configuration | +[**configurationGetDetail**](ConfigurationApi.md#configurationgetdetail) | **GET** /api/Configuration/{id} | +[**configurationUpdate**](ConfigurationApi.md#configurationupdate) | **PUT** /api/Configuration | + + +# **configurationCreate** +> RessourceDetailDTO configurationCreate(configurationDTO) + + + +### Example +```dart +import 'package:managerapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = ConfigurationApi(); +final configurationDTO = ConfigurationDTO(); // ConfigurationDTO | + +try { + final result = api_instance.configurationCreate(configurationDTO); + print(result); +} catch (e) { + print('Exception when calling ConfigurationApi->configurationCreate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **configurationDTO** | [**ConfigurationDTO**](ConfigurationDTO.md)| | + +### Return type + +[**RessourceDetailDTO**](RessourceDetailDTO.md) + +### Authorization + +[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) + +# **configurationDelete** +> String configurationDelete(id) + + + +### Example +```dart +import 'package:managerapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = ConfigurationApi(); +final id = id_example; // String | + +try { + final result = api_instance.configurationDelete(id); + print(result); +} catch (e) { + print('Exception when calling ConfigurationApi->configurationDelete: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| | + +### Return type + +**String** + +### 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) + +# **configurationGet** +> List configurationGet() + + + +### Example +```dart +import 'package:managerapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = ConfigurationApi(); + +try { + final result = api_instance.configurationGet(); + print(result); +} catch (e) { + print('Exception when calling ConfigurationApi->configurationGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**List**](ConfigurationDTO.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) + +# **configurationGetDetail** +> ConfigurationDTO configurationGetDetail(id) + + + +### Example +```dart +import 'package:managerapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = ConfigurationApi(); +final id = id_example; // String | + +try { + final result = api_instance.configurationGetDetail(id); + print(result); +} catch (e) { + print('Exception when calling ConfigurationApi->configurationGetDetail: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| | + +### Return type + +[**ConfigurationDTO**](ConfigurationDTO.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) + +# **configurationUpdate** +> ConfigurationDTO configurationUpdate(configurationDTO) + + + +### Example +```dart +import 'package:managerapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: bearer +//defaultApiClient.getAuthentication('bearer').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = ConfigurationApi(); +final configurationDTO = ConfigurationDTO(); // ConfigurationDTO | + +try { + final result = api_instance.configurationUpdate(configurationDTO); + print(result); +} catch (e) { + print('Exception when calling ConfigurationApi->configurationUpdate: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **configurationDTO** | [**ConfigurationDTO**](ConfigurationDTO.md)| | + +### Return type + +[**ConfigurationDTO**](ConfigurationDTO.md) + +### Authorization + +[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) + diff --git a/manager_api/doc/ConfigurationDTO.md b/manager_api/doc/ConfigurationDTO.md new file mode 100644 index 0000000..b1a7371 --- /dev/null +++ b/manager_api/doc/ConfigurationDTO.md @@ -0,0 +1,21 @@ +# managerapi.model.ConfigurationDTO + +## Load the model package +```dart +import 'package:managerapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | [optional] +**label** | **String** | | [optional] +**sectionIds** | **List** | | [optional] [default to const []] +**primaryColor** | **String** | | [optional] +**secondaryColor** | **String** | | [optional] +**languages** | **List** | | [optional] [default to const []] +**dateCreation** | [**DateTime**](DateTime.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/RessourceApi.md b/manager_api/doc/RessourceApi.md index b46261c..070554b 100644 --- a/manager_api/doc/RessourceApi.md +++ b/manager_api/doc/RessourceApi.md @@ -5,7 +5,7 @@ import 'package:managerapi/api.dart'; ``` -All URIs are relative to *https://localhost:44339* +All URIs are relative to *http://192.168.31.96* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/manager_api/doc/SectionApi.md b/manager_api/doc/SectionApi.md index 7e5520c..f3df477 100644 --- a/manager_api/doc/SectionApi.md +++ b/manager_api/doc/SectionApi.md @@ -5,7 +5,7 @@ import 'package:managerapi/api.dart'; ``` -All URIs are relative to *https://localhost:44339* +All URIs are relative to *http://192.168.31.96* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/manager_api/doc/SectionDTO.md b/manager_api/doc/SectionDTO.md index 0e7bc00..2cf32ee 100644 --- a/manager_api/doc/SectionDTO.md +++ b/manager_api/doc/SectionDTO.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **label** | **String** | | [optional] **description** | **String** | | [optional] **imageId** | **String** | | [optional] +**configurationId** | **String** | | [optional] **isSubSection** | **bool** | | [optional] **parentId** | **String** | | [optional] **type** | [**SectionType**](SectionType.md) | | [optional] diff --git a/manager_api/doc/UserApi.md b/manager_api/doc/UserApi.md index 54baedf..65b7df2 100644 --- a/manager_api/doc/UserApi.md +++ b/manager_api/doc/UserApi.md @@ -5,7 +5,7 @@ import 'package:managerapi/api.dart'; ``` -All URIs are relative to *https://localhost:44339* +All URIs are relative to *http://192.168.31.96* Method | HTTP request | Description ------------- | ------------- | ------------- diff --git a/manager_api/lib/api.dart b/manager_api/lib/api.dart index e2ebf8d..4459904 100644 --- a/manager_api/lib/api.dart +++ b/manager_api/lib/api.dart @@ -28,12 +28,12 @@ part 'auth/http_basic_auth.dart'; part 'auth/http_bearer_auth.dart'; part 'api/authentication_api.dart'; -part 'api/display_api.dart'; +part 'api/configuration_api.dart'; part 'api/ressource_api.dart'; part 'api/section_api.dart'; part 'api/user_api.dart'; -part 'model/display_dto.dart'; +part 'model/configuration_dto.dart'; part 'model/login_dto.dart'; part 'model/ressource_dto.dart'; part 'model/ressource_detail_dto.dart'; diff --git a/manager_api/lib/api/display_api.dart b/manager_api/lib/api/configuration_api.dart similarity index 75% rename from manager_api/lib/api/display_api.dart rename to manager_api/lib/api/configuration_api.dart index aafe20e..842e92b 100644 --- a/manager_api/lib/api/display_api.dart +++ b/manager_api/lib/api/configuration_api.dart @@ -10,24 +10,24 @@ part of openapi.api; -class DisplayApi { - DisplayApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; +class ConfigurationApi { + ConfigurationApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; - /// Performs an HTTP 'POST /api/Display' operation and returns the [Response]. + /// Performs an HTTP 'POST /api/Configuration' operation and returns the [Response]. /// Parameters: /// - /// * [DisplayDTO] displayDTO (required): - Future displayCreateWithHttpInfo(DisplayDTO displayDTO) async { + /// * [ConfigurationDTO] configurationDTO (required): + Future configurationCreateWithHttpInfo(ConfigurationDTO configurationDTO) async { // Verify required params are set. - if (displayDTO == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: displayDTO'); + if (configurationDTO == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: configurationDTO'); } - final path = r'/api/Display'; + final path = r'/api/Configuration'; - Object postBody = displayDTO; + Object postBody = configurationDTO; final queryParams = []; final headerParams = {}; @@ -63,9 +63,9 @@ class DisplayApi { /// Parameters: /// - /// * [DisplayDTO] displayDTO (required): - Future displayCreate(DisplayDTO displayDTO) async { - final response = await displayCreateWithHttpInfo(displayDTO); + /// * [ConfigurationDTO] configurationDTO (required): + Future configurationCreate(ConfigurationDTO configurationDTO) async { + final response = await configurationCreateWithHttpInfo(configurationDTO); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -78,17 +78,17 @@ class DisplayApi { return Future.value(null); } - /// Performs an HTTP 'DELETE /api/Display/{id}' operation and returns the [Response]. + /// Performs an HTTP 'DELETE /api/Configuration/{id}' operation and returns the [Response]. /// Parameters: /// /// * [String] id (required): - Future displayDeleteWithHttpInfo(String id) async { + Future configurationDeleteWithHttpInfo(String id) async { // Verify required params are set. if (id == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: id'); } - final path = r'/api/Display/{id}' + final path = r'/api/Configuration/{id}' .replaceAll('{' + 'id' + '}', id.toString()); Object postBody; @@ -128,8 +128,8 @@ class DisplayApi { /// Parameters: /// /// * [String] id (required): - Future displayDelete(String id) async { - final response = await displayDeleteWithHttpInfo(id); + Future configurationDelete(String id) async { + final response = await configurationDeleteWithHttpInfo(id); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -142,9 +142,9 @@ class DisplayApi { return Future.value(null); } - /// Performs an HTTP 'GET /api/Display' operation and returns the [Response]. - Future displayGetWithHttpInfo() async { - final path = r'/api/Display'; + /// Performs an HTTP 'GET /api/Configuration' operation and returns the [Response]. + Future configurationGetWithHttpInfo() async { + final path = r'/api/Configuration'; Object postBody; @@ -180,8 +180,8 @@ class DisplayApi { ); } - Future> displayGet() async { - final response = await displayGetWithHttpInfo(); + Future> configurationGet() async { + final response = await configurationGetWithHttpInfo(); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -189,24 +189,24 @@ class DisplayApi { // 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 != null && response.statusCode != HttpStatus.noContent) { - return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) - .cast() + return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) + .cast() .toList(growable: false); } - return Future>.value(null); + return Future>.value(null); } - /// Performs an HTTP 'GET /api/Display/{id}' operation and returns the [Response]. + /// Performs an HTTP 'GET /api/Configuration/{id}' operation and returns the [Response]. /// Parameters: /// /// * [String] id (required): - Future displayGetDetailWithHttpInfo(String id) async { + Future configurationGetDetailWithHttpInfo(String id) async { // Verify required params are set. if (id == null) { throw ApiException(HttpStatus.badRequest, 'Missing required param: id'); } - final path = r'/api/Display/{id}' + final path = r'/api/Configuration/{id}' .replaceAll('{' + 'id' + '}', id.toString()); Object postBody; @@ -246,8 +246,8 @@ class DisplayApi { /// Parameters: /// /// * [String] id (required): - Future displayGetDetail(String id) async { - final response = await displayGetDetailWithHttpInfo(id); + Future configurationGetDetail(String id) async { + final response = await configurationGetDetailWithHttpInfo(id); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -255,24 +255,24 @@ class DisplayApi { // 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 != null && response.statusCode != HttpStatus.noContent) { - return apiClient.deserialize(_decodeBodyBytes(response), 'DisplayDTO') as DisplayDTO; + return apiClient.deserialize(_decodeBodyBytes(response), 'ConfigurationDTO') as ConfigurationDTO; } - return Future.value(null); + return Future.value(null); } - /// Performs an HTTP 'PUT /api/Display' operation and returns the [Response]. + /// Performs an HTTP 'PUT /api/Configuration' operation and returns the [Response]. /// Parameters: /// - /// * [DisplayDTO] displayDTO (required): - Future displayUpdateWithHttpInfo(DisplayDTO displayDTO) async { + /// * [ConfigurationDTO] configurationDTO (required): + Future configurationUpdateWithHttpInfo(ConfigurationDTO configurationDTO) async { // Verify required params are set. - if (displayDTO == null) { - throw ApiException(HttpStatus.badRequest, 'Missing required param: displayDTO'); + if (configurationDTO == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: configurationDTO'); } - final path = r'/api/Display'; + final path = r'/api/Configuration'; - Object postBody = displayDTO; + Object postBody = configurationDTO; final queryParams = []; final headerParams = {}; @@ -308,9 +308,9 @@ class DisplayApi { /// Parameters: /// - /// * [DisplayDTO] displayDTO (required): - Future displayUpdate(DisplayDTO displayDTO) async { - final response = await displayUpdateWithHttpInfo(displayDTO); + /// * [ConfigurationDTO] configurationDTO (required): + Future configurationUpdate(ConfigurationDTO configurationDTO) async { + final response = await configurationUpdateWithHttpInfo(configurationDTO); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, _decodeBodyBytes(response)); } @@ -318,8 +318,8 @@ class DisplayApi { // 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 != null && response.statusCode != HttpStatus.noContent) { - return apiClient.deserialize(_decodeBodyBytes(response), 'DisplayDTO') as DisplayDTO; + return apiClient.deserialize(_decodeBodyBytes(response), 'ConfigurationDTO') as ConfigurationDTO; } - return Future.value(null); + return Future.value(null); } } diff --git a/manager_api/lib/api_client.dart b/manager_api/lib/api_client.dart index a45667c..9013c84 100644 --- a/manager_api/lib/api_client.dart +++ b/manager_api/lib/api_client.dart @@ -10,7 +10,7 @@ part of openapi.api; class ApiClient { - ApiClient({this.basePath = 'https://localhost:44339'}) { + ApiClient({this.basePath = 'http://192.168.31.96'}) { // Setup authentications (key: authentication name, value: authentication). _authentications[r'bearer'] = OAuth(); } @@ -156,8 +156,8 @@ class ApiClient { break; case 'double': return value is double ? value : double.parse('$value'); - case 'DisplayDTO': - return DisplayDTO.fromJson(value); + case 'ConfigurationDTO': + return ConfigurationDTO.fromJson(value); case 'LoginDTO': return LoginDTO.fromJson(value); case 'RessourceDTO': diff --git a/manager_api/lib/model/configuration_dto.dart b/manager_api/lib/model/configuration_dto.dart new file mode 100644 index 0000000..132182c --- /dev/null +++ b/manager_api/lib/model/configuration_dto.dart @@ -0,0 +1,131 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ConfigurationDTO { + /// Returns a new [ConfigurationDTO] instance. + ConfigurationDTO({ + this.id, + this.label, + this.sectionIds, + this.primaryColor, + this.secondaryColor, + this.languages, + this.dateCreation, + }); + + String id; + + String label; + + List sectionIds; + + String primaryColor; + + String secondaryColor; + + List languages; + + DateTime dateCreation; + + @override + bool operator ==(Object other) => identical(this, other) || other is ConfigurationDTO && + other.id == id && + other.label == label && + other.sectionIds == sectionIds && + other.primaryColor == primaryColor && + other.secondaryColor == secondaryColor && + other.languages == languages && + other.dateCreation == dateCreation; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (label == null ? 0 : label.hashCode) + + (sectionIds == null ? 0 : sectionIds.hashCode) + + (primaryColor == null ? 0 : primaryColor.hashCode) + + (secondaryColor == null ? 0 : secondaryColor.hashCode) + + (languages == null ? 0 : languages.hashCode) + + (dateCreation == null ? 0 : dateCreation.hashCode); + + @override + String toString() => 'ConfigurationDTO[id=$id, label=$label, sectionIds=$sectionIds, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation]'; + + Map toJson() { + final json = {}; + if (id != null) { + json[r'id'] = id; + } + if (label != null) { + json[r'label'] = label; + } + if (sectionIds != null) { + json[r'sectionIds'] = sectionIds; + } + if (primaryColor != null) { + json[r'primaryColor'] = primaryColor; + } + if (secondaryColor != null) { + json[r'secondaryColor'] = secondaryColor; + } + if (languages != null) { + json[r'languages'] = languages; + } + if (dateCreation != null) { + json[r'dateCreation'] = dateCreation.toUtc().toIso8601String(); + } + return json; + } + + /// Returns a new [ConfigurationDTO] instance and imports its values from + /// [json] if it's non-null, null if [json] is null. + static ConfigurationDTO fromJson(Map json) => json == null + ? null + : ConfigurationDTO( + id: json[r'id'], + label: json[r'label'], + sectionIds: json[r'sectionIds'] == null + ? null + : (json[r'sectionIds'] as List).cast(), + primaryColor: json[r'primaryColor'], + secondaryColor: json[r'secondaryColor'], + languages: json[r'languages'] == null + ? null + : (json[r'languages'] as List).cast(), + dateCreation: json[r'dateCreation'] == null + ? null + : DateTime.parse(json[r'dateCreation']), + ); + + static List listFromJson(List json, {bool emptyIsNull, bool growable,}) => + json == null || json.isEmpty + ? true == emptyIsNull ? null : [] + : json.map((v) => ConfigurationDTO.fromJson(v)).toList(growable: true == growable); + + static Map mapFromJson(Map json) { + final map = {}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) => map[key] = ConfigurationDTO.fromJson(v)); + } + return map; + } + + // maps a json object with a list of ConfigurationDTO-objects as value to a dart map + static Map> mapListFromJson(Map json, {bool emptyIsNull, bool growable,}) { + final map = >{}; + if (json != null && json.isNotEmpty) { + json.forEach((String key, dynamic v) { + map[key] = ConfigurationDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable); + }); + } + return map; + } +} + diff --git a/manager_api/lib/model/section_dto.dart b/manager_api/lib/model/section_dto.dart index 73393df..0f8a752 100644 --- a/manager_api/lib/model/section_dto.dart +++ b/manager_api/lib/model/section_dto.dart @@ -16,6 +16,7 @@ class SectionDTO { this.label, this.description, this.imageId, + this.configurationId, this.isSubSection, this.parentId, this.type, @@ -31,6 +32,8 @@ class SectionDTO { String imageId; + String configurationId; + bool isSubSection; String parentId; @@ -47,6 +50,7 @@ class SectionDTO { other.label == label && other.description == description && other.imageId == imageId && + other.configurationId == configurationId && other.isSubSection == isSubSection && other.parentId == parentId && other.type == type && @@ -59,6 +63,7 @@ class SectionDTO { (label == null ? 0 : label.hashCode) + (description == null ? 0 : description.hashCode) + (imageId == null ? 0 : imageId.hashCode) + + (configurationId == null ? 0 : configurationId.hashCode) + (isSubSection == null ? 0 : isSubSection.hashCode) + (parentId == null ? 0 : parentId.hashCode) + (type == null ? 0 : type.hashCode) + @@ -66,7 +71,7 @@ class SectionDTO { (dateCreation == null ? 0 : dateCreation.hashCode); @override - String toString() => 'SectionDTO[id=$id, label=$label, description=$description, imageId=$imageId, isSubSection=$isSubSection, parentId=$parentId, type=$type, data=$data, dateCreation=$dateCreation]'; + String toString() => 'SectionDTO[id=$id, label=$label, description=$description, imageId=$imageId, configurationId=$configurationId, isSubSection=$isSubSection, parentId=$parentId, type=$type, data=$data, dateCreation=$dateCreation]'; Map toJson() { final json = {}; @@ -82,6 +87,9 @@ class SectionDTO { if (imageId != null) { json[r'imageId'] = imageId; } + if (configurationId != null) { + json[r'configurationId'] = configurationId; + } if (isSubSection != null) { json[r'isSubSection'] = isSubSection; } @@ -109,6 +117,7 @@ class SectionDTO { label: json[r'label'], description: json[r'description'], imageId: json[r'imageId'], + configurationId: json[r'configurationId'], isSubSection: json[r'isSubSection'], parentId: json[r'parentId'], type: SectionType.fromJson(json[r'type']), diff --git a/manager_api/swagger.yaml b/manager_api/swagger.yaml index d012667..f69c724 100644 --- a/manager_api/swagger.yaml +++ b/manager_api/swagger.yaml @@ -5,13 +5,13 @@ info: description: API Manager Service version: Version Alpha servers: - - url: 'https://localhost:44339' + - url: 'http://192.168.31.96' paths: - /api/Display: + /api/Configuration: get: tags: - - Display - operationId: Display_Get + - Configuration + operationId: Configuration_Get responses: '200': description: '' @@ -20,7 +20,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/DisplayDTO' + $ref: '#/components/schemas/ConfigurationDTO' '500': description: '' content: @@ -31,14 +31,14 @@ paths: - bearer: [] post: tags: - - Display - operationId: Display_Create + - Configuration + operationId: Configuration_Create requestBody: - x-name: newDisplay + x-name: newConfiguration content: application/json: schema: - $ref: '#/components/schemas/DisplayDTO' + $ref: '#/components/schemas/ConfigurationDTO' required: true x-position: 1 responses: @@ -70,14 +70,14 @@ paths: - bearer: [] put: tags: - - Display - operationId: Display_Update + - Configuration + operationId: Configuration_Update requestBody: - x-name: updatedDisplay + x-name: updatedConfiguration content: application/json: schema: - $ref: '#/components/schemas/DisplayDTO' + $ref: '#/components/schemas/ConfigurationDTO' required: true x-position: 1 responses: @@ -86,7 +86,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/DisplayDTO' + $ref: '#/components/schemas/ConfigurationDTO' '400': description: '' content: @@ -107,11 +107,11 @@ paths: type: string security: - bearer: [] - '/api/Display/{id}': + '/api/Configuration/{id}': get: tags: - - Display - operationId: Display_GetDetail + - Configuration + operationId: Configuration_GetDetail parameters: - name: id in: path @@ -126,7 +126,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/DisplayDTO' + $ref: '#/components/schemas/ConfigurationDTO' '404': description: '' content: @@ -141,8 +141,8 @@ paths: type: string delete: tags: - - Display - operationId: Display_Delete + - Configuration + operationId: Configuration_Delete parameters: - name: id in: path @@ -830,7 +830,7 @@ paths: type: string components: schemas: - DisplayDTO: + ConfigurationDTO: type: object additionalProperties: false properties: @@ -918,6 +918,9 @@ components: imageId: type: string nullable: true + configurationId: + type: string + nullable: true isSubSection: type: boolean parentId: @@ -1032,8 +1035,8 @@ components: security: - bearer: [] tags: - - name: Display - description: Display management + - name: Configuration + description: Configuration management - name: Ressource description: Ressource management - name: Section diff --git a/manager_api/test/configuration_api_test.dart b/manager_api/test/configuration_api_test.dart new file mode 100644 index 0000000..e9bc7e6 --- /dev/null +++ b/manager_api/test/configuration_api_test.dart @@ -0,0 +1,45 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:managerapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for ConfigurationApi +void main() { + final instance = ConfigurationApi(); + + group('tests for ConfigurationApi', () { + //Future configurationCreate(ConfigurationDTO configurationDTO) async + test('test configurationCreate', () async { + // TODO + }); + + //Future configurationDelete(String id) async + test('test configurationDelete', () async { + // TODO + }); + + //Future> configurationGet() async + test('test configurationGet', () async { + // TODO + }); + + //Future configurationGetDetail(String id) async + test('test configurationGetDetail', () async { + // TODO + }); + + //Future configurationUpdate(ConfigurationDTO configurationDTO) async + test('test configurationUpdate', () async { + // TODO + }); + + }); +} diff --git a/manager_api/test/configuration_dto_test.dart b/manager_api/test/configuration_dto_test.dart new file mode 100644 index 0000000..05d5f70 --- /dev/null +++ b/manager_api/test/configuration_dto_test.dart @@ -0,0 +1,56 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:managerapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ConfigurationDTO +void main() { + final instance = ConfigurationDTO(); + + group('test ConfigurationDTO', () { + // String id + test('to test the property `id`', () async { + // TODO + }); + + // String label + test('to test the property `label`', () async { + // TODO + }); + + // List sectionIds (default value: const []) + test('to test the property `sectionIds`', () async { + // TODO + }); + + // String primaryColor + test('to test the property `primaryColor`', () async { + // TODO + }); + + // String secondaryColor + test('to test the property `secondaryColor`', () async { + // TODO + }); + + // List languages (default value: const []) + test('to test the property `languages`', () async { + // TODO + }); + + // DateTime dateCreation + test('to test the property `dateCreation`', () async { + // TODO + }); + + + }); + +}