Add import/export config + add duration for notification + update service generation (no more detail resource)
This commit is contained in:
parent
86e4beb362
commit
2674233113
@ -125,12 +125,12 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<ResourceDetailDTO> getResource(String resourceIdToShow, dynamic appContext) async {
|
||||
ResourceDetailDTO resource = await appContext.getContext().clientAPI.resourceApi.resourceGetDetail(resourceIdToShow);
|
||||
Future<ResourceDTO> getResource(String resourceIdToShow, dynamic appContext) async {
|
||||
ResourceDTO resource = await appContext.getContext().clientAPI.resourceApi.resourceGetDetail(resourceIdToShow);
|
||||
return resource;
|
||||
}
|
||||
|
||||
boxDecoration(ResourceDetailDTO resourceDetailDTO, appContext) {
|
||||
boxDecoration(ResourceDTO resourceDTO, appContext) {
|
||||
return BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
color: kWhite,
|
||||
@ -138,7 +138,7 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
|
||||
image: new DecorationImage(
|
||||
fit: widget.imageFit,
|
||||
image: new NetworkImage(
|
||||
resourceDetailDTO.type == ResourceType.image ? appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resourceDetailDTO.id : resourceDetailDTO.data,
|
||||
resourceDTO.type == ResourceType.image ? appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resourceDTO.id : resourceDTO.data,
|
||||
),
|
||||
),
|
||||
boxShadow: [
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
showNotification (Color backgroundColor, Color textColor, String text, BuildContext context) {
|
||||
showNotification (Color backgroundColor, Color textColor, String text, BuildContext context, int duration) {
|
||||
final snackBar = SnackBar(
|
||||
behavior: SnackBarBehavior.floating,
|
||||
duration: const Duration(milliseconds: 1500),
|
||||
duration: duration == null ? Duration(milliseconds: 1500) : Duration(milliseconds: duration),
|
||||
width: 280.0, // Width of the SnackBar.
|
||||
backgroundColor: backgroundColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
|
||||
@ -82,7 +82,7 @@ class _MultiSelectChipState extends State<MultiSelectChip> {
|
||||
onSelected: (selected) {
|
||||
setState(() {
|
||||
if (widget.isAtLeastOne && widget.selectedValues.length == 1 && widget.selectedValues[0] == item) {
|
||||
showNotification(Colors.orange, kWhite, 'Au moins une valeur doit être sélectionnée', context);
|
||||
showNotification(Colors.orange, kWhite, 'Au moins une valeur doit être sélectionnée', context, null);
|
||||
} else {
|
||||
if (widget.isMultiple) {
|
||||
widget.selectedValues.contains(item)
|
||||
|
||||
@ -6,11 +6,11 @@ import 'file:///C:/Users/Thomas%20Fransolet/Documents/Documents/Perso/MuseeDeLaF
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:managerapi/api.dart';
|
||||
class ResourceTab extends StatefulWidget {
|
||||
final ResourceDetailDTO resourceDetailDTO;
|
||||
final ResourceDTO resourceDTO;
|
||||
final Function onFileUpload;
|
||||
const ResourceTab({
|
||||
Key key,
|
||||
this.resourceDetailDTO,
|
||||
this.resourceDTO,
|
||||
this.onFileUpload,
|
||||
}) : super(key: key);
|
||||
|
||||
@ -51,7 +51,7 @@ class _ResourceTabState extends State<ResourceTab> with SingleTickerProviderStat
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
children: getContent(widget.resourceDetailDTO, widget.onFileUpload),
|
||||
children: getContent(widget.resourceDTO, widget.onFileUpload),
|
||||
controller: _tabController,
|
||||
),
|
||||
),
|
||||
@ -65,27 +65,27 @@ class _ResourceTabState extends State<ResourceTab> with SingleTickerProviderStat
|
||||
switch(_tabController.index) {
|
||||
case 0:
|
||||
setState(() {
|
||||
widget.resourceDetailDTO.data = null;
|
||||
widget.resourceDetailDTO.type = ResourceType.image;
|
||||
widget.resourceDTO.data = null;
|
||||
widget.resourceDTO.type = ResourceType.image;
|
||||
});
|
||||
break;
|
||||
case 1:
|
||||
setState(() {
|
||||
widget.resourceDetailDTO.data = null;
|
||||
widget.resourceDetailDTO.type = ResourceType.imageUrl;
|
||||
widget.resourceDTO.data = null;
|
||||
widget.resourceDTO.type = ResourceType.imageUrl;
|
||||
});
|
||||
break;
|
||||
case 2:
|
||||
setState(() {
|
||||
widget.resourceDetailDTO.data = null;
|
||||
widget.resourceDetailDTO.type = ResourceType.videoUrl;
|
||||
widget.resourceDTO.data = null;
|
||||
widget.resourceDTO.type = ResourceType.videoUrl;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getContent(ResourceDetailDTO resourceDetailDTO, Function onFileUpload) {
|
||||
getContent(ResourceDTO resourceDTO, Function onFileUpload) {
|
||||
List<Widget> tabsToShow = new List<Widget>();
|
||||
|
||||
// Local Image
|
||||
@ -95,7 +95,7 @@ getContent(ResourceDetailDTO resourceDetailDTO, Function onFileUpload) {
|
||||
child: UploadImageContainer(
|
||||
onChanged: (File file) {
|
||||
onFileUpload(file);
|
||||
resourceDetailDTO.type = ResourceType.image;
|
||||
resourceDTO.type = ResourceType.image;
|
||||
}
|
||||
),
|
||||
)
|
||||
@ -106,9 +106,9 @@ getContent(ResourceDetailDTO resourceDetailDTO, Function onFileUpload) {
|
||||
new Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
||||
child: UploadOnlineResourceContainer(
|
||||
resourceDetailDTO: resourceDetailDTO,
|
||||
onChanged: (ResourceDetailDTO value) {
|
||||
resourceDetailDTO = value;
|
||||
resourceDTO: resourceDTO,
|
||||
onChanged: (ResourceDTO value) {
|
||||
resourceDTO = value;
|
||||
},
|
||||
),
|
||||
)
|
||||
@ -119,9 +119,9 @@ getContent(ResourceDetailDTO resourceDetailDTO, Function onFileUpload) {
|
||||
new Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
||||
child: UploadOnlineResourceContainer(
|
||||
resourceDetailDTO: resourceDetailDTO,
|
||||
onChanged: (ResourceDetailDTO value) {
|
||||
resourceDetailDTO = value;
|
||||
resourceDTO: resourceDTO,
|
||||
onChanged: (ResourceDTO value) {
|
||||
resourceDTO = value;
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
@ -5,11 +5,11 @@ import 'package:managerapi/api.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UploadOnlineResourceContainer extends StatefulWidget {
|
||||
final ResourceDetailDTO resourceDetailDTO;
|
||||
final ValueChanged<ResourceDetailDTO> onChanged;
|
||||
final ResourceDTO resourceDTO;
|
||||
final ValueChanged<ResourceDTO> onChanged;
|
||||
const UploadOnlineResourceContainer({
|
||||
Key key,
|
||||
this.resourceDetailDTO,
|
||||
this.resourceDTO,
|
||||
this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@ -33,7 +33,7 @@ class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceCont
|
||||
}
|
||||
|
||||
showFile() {
|
||||
if (widget.resourceDetailDTO.type == ResourceType.videoUrl || widget.resourceDetailDTO.type == ResourceType.video) {
|
||||
if (widget.resourceDTO.type == ResourceType.videoUrl || widget.resourceDTO.type == ResourceType.video) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
@ -91,11 +91,11 @@ class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceCont
|
||||
child: Container(
|
||||
width: size.width *0.35, // TODO GET SIZE
|
||||
child: RoundedInputField(
|
||||
hintText: widget.resourceDetailDTO.type == ResourceType.imageUrl ? "Url de l'image" : "Url de la vidéo",
|
||||
icon: widget.resourceDetailDTO.type == ResourceType.imageUrl ? Icons.image : Icons.ondemand_video, // TODO: TBD
|
||||
hintText: widget.resourceDTO.type == ResourceType.imageUrl ? "Url de l'image" : "Url de la vidéo",
|
||||
icon: widget.resourceDTO.type == ResourceType.imageUrl ? Icons.image : Icons.ondemand_video, // TODO: TBD
|
||||
onChanged: (String text) {
|
||||
print("onchanged url");
|
||||
widget.resourceDetailDTO.data = text;
|
||||
widget.resourceDTO.data = text;
|
||||
},
|
||||
initialValue: ""
|
||||
),
|
||||
@ -105,7 +105,7 @@ class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceCont
|
||||
onTap: () {
|
||||
print("refresh preview");
|
||||
setState(() {
|
||||
urlResourceToShow = widget.resourceDetailDTO.data;
|
||||
urlResourceToShow = widget.resourceDTO.data;
|
||||
});
|
||||
},
|
||||
child: Center(
|
||||
@ -119,7 +119,7 @@ class _UploadOnlineResourceContainerState extends State<UploadOnlineResourceCont
|
||||
],
|
||||
),
|
||||
),
|
||||
if(widget.resourceDetailDTO.data != null) showFile()
|
||||
if(widget.resourceDTO.data != null) showFile()
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,10 +2,14 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:encrypt/encrypt.dart';
|
||||
import 'package:manager_app/Components/message_notification.dart';
|
||||
import 'package:manager_app/Models/session.dart';
|
||||
import 'package:manager_app/client.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:managerapi/api.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
class SessionHelper {
|
||||
class FileHelper {
|
||||
final key = Key.fromUtf8('aVs:ZMe3EK-yS<y:;k>vCGrj3T8]yG6E');
|
||||
final iv = IV.fromLength(16);
|
||||
|
||||
@ -34,6 +38,36 @@ class SessionHelper {
|
||||
return file.writeAsString(jsonEncode(session.toMap()));
|
||||
}
|
||||
|
||||
Future<File> storeConfiguration(ExportConfigurationDTO exportConfigurationDTO) async {
|
||||
final path = await _localPath;
|
||||
new File('$path/'+exportConfigurationDTO.label+'.json').createSync(recursive: true);
|
||||
|
||||
// Write the file
|
||||
File file = File('$path/'+exportConfigurationDTO.label+'.json');
|
||||
return file.writeAsString(jsonEncode(exportConfigurationDTO.toJson()));
|
||||
}
|
||||
|
||||
Future<void> importConfiguration(String path, Client client, context) async {
|
||||
// Gets the file
|
||||
File file = File(path);
|
||||
|
||||
final contents = await file.readAsString();
|
||||
|
||||
ExportConfigurationDTO export = ExportConfigurationDTO.fromJson(jsonDecode(contents));
|
||||
try {
|
||||
String test = await client.configurationApi.configurationImport(export);
|
||||
if (test.contains("successfully")) {
|
||||
showNotification(kSuccess, kWhite, 'La configuration a été importée avec succès', context, null);
|
||||
} else {
|
||||
showNotification(kPrimaryColor, kWhite, 'Une erreur est survenue lors de l''import de la configuration', context, null);
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.toString().contains('409')) {
|
||||
showNotification(kSecond, kWhite, 'La configuration existe déjà dans le système', context, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<Session> readSession() async {
|
||||
try {
|
||||
final file = await _localFile;
|
||||
@ -299,9 +299,9 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
appContext.setContext(managerAppContext);
|
||||
|
||||
if (isTraduction) {
|
||||
showNotification(Colors.green, kWhite, 'Les traductions de la section ont été sauvegardées avec succès', context);
|
||||
showNotification(Colors.green, kWhite, 'Les traductions de la section ont été sauvegardées avec succès', context, null);
|
||||
} else {
|
||||
showNotification(Colors.green, kWhite, 'La section a été sauvegardée avec succès', context);
|
||||
showNotification(Colors.green, kWhite, 'La section a été sauvegardée avec succès', context, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/painting.dart';
|
||||
@ -8,6 +10,7 @@ import 'package:manager_app/Components/message_notification.dart';
|
||||
import 'package:manager_app/Components/multi_select_container.dart';
|
||||
import 'package:manager_app/Components/rounded_button.dart';
|
||||
import 'package:manager_app/Components/string_input_container.dart';
|
||||
import 'package:manager_app/Helpers/FileHelper.dart';
|
||||
import 'package:manager_app/Models/managerContext.dart';
|
||||
import 'package:manager_app/Screens/Configurations/section_reorderList.dart';
|
||||
import 'package:manager_app/app_context.dart';
|
||||
@ -69,8 +72,29 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(configurationDTO.label, style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
try {
|
||||
// Export config
|
||||
Client clientAPI = appContext.getContext().clientAPI;
|
||||
ExportConfigurationDTO export = await clientAPI.configurationApi.configurationExport(configurationDTO.id);
|
||||
File test = await FileHelper().storeConfiguration(export);
|
||||
showNotification(Colors.green, kWhite, "l'export de la configuration a réussi, le document se trouve là : " + test.path, context, 3000);
|
||||
} catch(e) {
|
||||
showNotification(kPrimaryColor, kWhite, "l'export de la configuration a échoué", context, null);
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 5.0),
|
||||
child: Icon(Icons.cloud_download, color: kPrimaryColor)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Text(DateFormat('dd/MM/yyyy').format(configurationDTO.dateCreation), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w200)),
|
||||
@ -184,7 +208,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
} else {
|
||||
return Center(
|
||||
child: Container(
|
||||
height: size.height * 0.2,
|
||||
height: size.height * 0.15,
|
||||
child: Loading()
|
||||
)
|
||||
);
|
||||
@ -308,7 +332,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
managerAppContext.selectedConfiguration = configuration;
|
||||
appContext.setContext(managerAppContext);
|
||||
|
||||
showNotification(Colors.green, kWhite, 'La configuration a été sauvegardée avec succès', context);
|
||||
showNotification(Colors.green, kWhite, 'La configuration a été sauvegardée avec succès', context, null);
|
||||
}
|
||||
|
||||
Future<ConfigurationDTO> getConfiguration(ConfigurationDetailScreen widget, Client client) async {
|
||||
|
||||
@ -43,7 +43,7 @@ class _ConfigurationsScreenState extends State<ConfigurationsScreen> {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
var tempOutput = new List<ConfigurationDTO>.from(snapshot.data);
|
||||
tempOutput.add(ConfigurationDTO(id: null));
|
||||
return bodyGrid(tempOutput, size, appContext);
|
||||
return bodyGrid(tempOutput, size, appContext, context);
|
||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||
return Text("No data");
|
||||
} else {
|
||||
@ -60,7 +60,7 @@ class _ConfigurationsScreenState extends State<ConfigurationsScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Widget bodyGrid(data, Size size, AppContext appContext) {
|
||||
Widget bodyGrid(data, Size size, AppContext appContext, BuildContext mainContext) {
|
||||
return GridView.builder(
|
||||
shrinkWrap: true,
|
||||
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
|
||||
@ -70,7 +70,13 @@ class _ConfigurationsScreenState extends State<ConfigurationsScreen> {
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (data[index].id == null) {
|
||||
showNewConfiguration(appContext, context);
|
||||
showNewConfiguration(appContext, (bool) {
|
||||
if (bool) {
|
||||
setState(() {
|
||||
// Thanks future builder for the refresh..
|
||||
});
|
||||
}
|
||||
}, context, mainContext);
|
||||
} else {
|
||||
setState(() {
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
import 'package:filepicker_windows/filepicker_windows.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/Components/message_notification.dart';
|
||||
import 'package:manager_app/Components/rounded_button.dart';
|
||||
import 'package:manager_app/Components/string_input_container.dart';
|
||||
import 'package:manager_app/Helpers/FileHelper.dart';
|
||||
import 'package:manager_app/Models/managerContext.dart';
|
||||
import 'package:manager_app/app_context.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:managerapi/api.dart';
|
||||
|
||||
void showNewConfiguration(AppContext appContext, BuildContext context) {
|
||||
void showNewConfiguration(AppContext appContext, ValueChanged<bool> isImport, BuildContext context, BuildContext mainContext) {
|
||||
ConfigurationDTO configurationDTO = new ConfigurationDTO();
|
||||
showDialog(
|
||||
builder: (BuildContext context) => AlertDialog(
|
||||
@ -29,6 +31,33 @@ void showNewConfiguration(AppContext appContext, BuildContext context) {
|
||||
),
|
||||
],
|
||||
),
|
||||
Text("ou"),
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 5.0),
|
||||
child: Text("Importer", style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300)),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
String result = filePicker();
|
||||
if (result != null) {
|
||||
await FileHelper().importConfiguration(result, appContext.getContext().clientAPI, mainContext);
|
||||
isImport(true);
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Icon(
|
||||
Icons.file_upload,
|
||||
color: kPrimaryColor,
|
||||
size: 30
|
||||
),
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -76,6 +105,21 @@ void showNewConfiguration(AppContext appContext, BuildContext context) {
|
||||
);
|
||||
}
|
||||
|
||||
String filePicker() {
|
||||
final file = OpenFilePicker()
|
||||
..filterSpecification = {
|
||||
'Fichier (*.json)': '*.json',
|
||||
//'Video (*.mp4)': '*.mp4',
|
||||
//'All Files': '*.*'
|
||||
}
|
||||
..defaultFilterIndex = 0
|
||||
..title = 'Sélectionner un fichier';
|
||||
|
||||
final result = file.getFile();
|
||||
|
||||
return result != null ? result.path : null;
|
||||
}
|
||||
|
||||
void create(ConfigurationDTO configurationDTO, AppContext appContext, context) async {
|
||||
if (configurationDTO.label != null) {
|
||||
|
||||
@ -84,7 +128,7 @@ void create(ConfigurationDTO configurationDTO, AppContext appContext, context) a
|
||||
managerAppContext.selectedConfiguration = null;
|
||||
appContext.setContext(managerAppContext);
|
||||
|
||||
showNotification(Colors.green, kWhite, 'La configuration a été créée avec succès', context);
|
||||
showNotification(Colors.green, kWhite, 'La configuration a été créée avec succès', context, null);
|
||||
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ void create(SectionDTO sectionDTO, AppContext appContext, BuildContext context,
|
||||
}
|
||||
managerAppContext.selectedConfiguration.sectionIds.add(newSection.id);*/
|
||||
appContext.setContext(managerAppContext);
|
||||
showNotification(Colors.green, kWhite, 'La section a été créée avec succès !', context);
|
||||
showNotification(Colors.green, kWhite, 'La section a été créée avec succès !', context, null);
|
||||
} else {
|
||||
sendSubSection(newSection);
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import 'package:manager_app/constants.dart';
|
||||
import 'package:managerapi/api.dart';
|
||||
|
||||
dynamic showNewResource(AppContext appContext, BuildContext context) async {
|
||||
ResourceDetailDTO resourceDetailDTO = new ResourceDetailDTO();
|
||||
ResourceDTO resourceDetailDTO = new ResourceDTO();
|
||||
Size size = MediaQuery.of(context).size;
|
||||
var fileName;
|
||||
File fileToSend;
|
||||
@ -42,7 +42,7 @@ dynamic showNewResource(AppContext appContext, BuildContext context) async {
|
||||
width: size.width *0.5,
|
||||
height: size.height *0.5,
|
||||
child: ResourceTab(
|
||||
resourceDetailDTO: resourceDetailDTO,
|
||||
resourceDTO: resourceDetailDTO,
|
||||
onFileUpload: (File file) {
|
||||
fileToSend = file;
|
||||
},
|
||||
@ -87,10 +87,10 @@ dynamic showNewResource(AppContext appContext, BuildContext context) async {
|
||||
if (fileToSend != null) {
|
||||
Navigator.pop(context, [resourceDetailDTO, fileToSend]);
|
||||
} else {
|
||||
showNotification(Colors.orange, kWhite, 'Aucun fichier n\'a été chargé', context);
|
||||
showNotification(Colors.orange, kWhite, 'Aucun fichier n\'a été chargé', context, null);
|
||||
}
|
||||
} else {
|
||||
showNotification(Colors.orange, kWhite, 'Veuillez donner un nom à la ressource', context);
|
||||
showNotification(Colors.orange, kWhite, 'Veuillez donner un nom à la ressource', context, null);
|
||||
}
|
||||
//Navigator.of(context).pop();
|
||||
//create(resourceDetailDTO, fileToSend, appContext, context);
|
||||
|
||||
@ -85,8 +85,8 @@ Future<List<ResourceDTO>> getResources(Function onGetResult, bool isImage, dynam
|
||||
return resources;
|
||||
}
|
||||
|
||||
Future<ResourceDTO> create(ResourceDetailDTO resourceDetailDTO, File file, AppContext appContext, context) async {
|
||||
switch(resourceDetailDTO.type) {
|
||||
Future<ResourceDTO> create(ResourceDTO resourceDTO, File file, AppContext appContext, context) async {
|
||||
switch(resourceDTO.type) {
|
||||
case ResourceType.image:
|
||||
case ResourceType.video:
|
||||
var request = http.MultipartRequest('POST', Uri.parse(appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/upload"));
|
||||
@ -101,7 +101,7 @@ Future<ResourceDTO> create(ResourceDetailDTO resourceDetailDTO, File file, AppCo
|
||||
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
request.headers["authorization"]="Bearer ${managerAppContext.token.accessToken}";
|
||||
request.fields['label'] = resourceDetailDTO.label;
|
||||
request.fields['label'] = resourceDTO.label;
|
||||
request.fields['type'] = ResourceType.image.toString();
|
||||
|
||||
var res = await request.send();
|
||||
@ -109,35 +109,35 @@ Future<ResourceDTO> create(ResourceDetailDTO resourceDetailDTO, File file, AppCo
|
||||
|
||||
if (res.statusCode == 200) {
|
||||
var result = ResourceDTO.fromJson(jsonDecode(respStr));
|
||||
showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context);
|
||||
showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context, null);
|
||||
|
||||
return result;
|
||||
} else {
|
||||
showNotification(kPrimaryColor, kWhite, 'Une erreur est survenue lors de la création de la ressource', context);
|
||||
showNotification(kPrimaryColor, kWhite, 'Une erreur est survenue lors de la création de la ressource', context, null);
|
||||
}
|
||||
break;
|
||||
case ResourceType.imageUrl:
|
||||
case ResourceType.videoUrl:
|
||||
if (resourceDetailDTO.data != null) {
|
||||
if (resourceDTO.data != null) {
|
||||
// test if Correct url
|
||||
bool _validURL = Uri.parse(resourceDetailDTO.data).isAbsolute;
|
||||
bool _validURL = Uri.parse(resourceDTO.data).isAbsolute;
|
||||
if(_validURL) {
|
||||
Navigator.of(context).pop();
|
||||
|
||||
ResourceDTO newResource = await appContext.getContext().clientAPI.resourceApi.resourceCreate(resourceDetailDTO);
|
||||
ResourceDTO newResource = await appContext.getContext().clientAPI.resourceApi.resourceCreate(resourceDTO);
|
||||
|
||||
// To refresh only (UGLY COOOOODE)
|
||||
/*ManagerAppContext managerAppContext = appContext.getContext();
|
||||
appContext.setContext(managerAppContext);*/
|
||||
|
||||
showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context);
|
||||
showNotification(Colors.green, kWhite, 'La ressource a été créée avec succès', context, null);
|
||||
|
||||
return newResource;
|
||||
} else {
|
||||
showNotification(Colors.orange, kWhite, 'L\'url est invalide', context);
|
||||
showNotification(Colors.orange, kWhite, 'L\'url est invalide', context, null);
|
||||
}
|
||||
} else {
|
||||
showNotification(Colors.orange, kWhite, 'Veuillez remplir le champ URL', context);
|
||||
showNotification(Colors.orange, kWhite, 'Veuillez remplir le champ URL', context, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ Future<void> delete(ResourceDTO resourceDTO, AppContext appContext, context) asy
|
||||
appContext.setContext(managerAppContext);
|
||||
Navigator.of(context).pop();
|
||||
|
||||
showNotification(Colors.green, kWhite, 'La ressource a été supprimée avec succès', context);
|
||||
showNotification(Colors.green, kWhite, 'La ressource a été supprimée avec succès', context, null);
|
||||
},
|
||||
context
|
||||
);
|
||||
|
||||
@ -4,7 +4,7 @@ import 'package:manager_app/Components/message_notification.dart';
|
||||
import 'package:manager_app/Components/rounded_button.dart';
|
||||
import 'package:manager_app/Components/rounded_input_field.dart';
|
||||
import 'package:manager_app/Components/rounded_password_field.dart';
|
||||
import 'package:manager_app/Helpers/SessionHelper.dart';
|
||||
import 'package:manager_app/Helpers/FileHelper.dart';
|
||||
import 'package:manager_app/Models/managerContext.dart';
|
||||
import 'package:manager_app/Models/session.dart';
|
||||
import 'package:manager_app/Screens/Main/main_screen.dart';
|
||||
@ -55,10 +55,10 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
Session updatedSession = new Session(rememberMe: isRememberMe, host: host, email: email, password: password);
|
||||
print("REMBER ME TEST SESSIOn");
|
||||
// update JSON FILE
|
||||
SessionHelper().writeSession(updatedSession);
|
||||
FileHelper().writeSession(updatedSession);
|
||||
}
|
||||
|
||||
showNotification(Colors.lightGreen, kWhite, 'Connexion réussie', context);
|
||||
showNotification(Colors.lightGreen, kWhite, 'Connexion réussie', context, null);
|
||||
|
||||
// Set the appContext
|
||||
if (appContext.getContext() == null) {
|
||||
@ -89,7 +89,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
catch (e) {
|
||||
print("error auth");
|
||||
print(e);
|
||||
showNotification(Colors.orange, kWhite, 'Un problème est survenu lors de la connexion', context);
|
||||
showNotification(Colors.orange, kWhite, 'Un problème est survenu lors de la connexion', context, null);
|
||||
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
|
||||
@ -11,6 +11,7 @@ const kTextLightColor = Color(0xFFFCFDFD);
|
||||
const kSecond = Color(0xFFC2C9D6);
|
||||
const kWhite = Color(0xFFFFFFFF);
|
||||
const kBlack = Color(0xFF000000);
|
||||
const kSuccess = Color(0xFF8bc34a);
|
||||
|
||||
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu"];
|
||||
const List<String> map_types = ["none", "normal", "satellite", "terrain", "hybrid"];
|
||||
|
||||
@ -4,7 +4,7 @@ import 'package:manager_app/Models/managerContext.dart';
|
||||
import 'package:manager_app/Screens/Main/main_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'Helpers/SessionHelper.dart';
|
||||
import 'Helpers/FileHelper.dart';
|
||||
import 'Models/session.dart';
|
||||
import 'Screens/login_screen.dart';
|
||||
import 'app_context.dart';
|
||||
@ -75,7 +75,7 @@ class _MyAppState extends State<MyApp> {
|
||||
}
|
||||
|
||||
Future<Session> loadJsonSessionFile() async {
|
||||
Session session = await SessionHelper().readSession();
|
||||
Session session = await FileHelper().readSession();
|
||||
print(session);
|
||||
return session;
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@ doc/DeviceApi.md
|
||||
doc/DeviceDTO.md
|
||||
doc/DeviceDetailDTO.md
|
||||
doc/DeviceDetailDTOAllOf.md
|
||||
doc/ExportConfigurationDTO.md
|
||||
doc/ExportConfigurationDTOAllOf.md
|
||||
doc/GeoPointDTO.md
|
||||
doc/ImageDTO.md
|
||||
doc/ImageGeoPoint.md
|
||||
@ -18,7 +20,6 @@ doc/MenuDTO.md
|
||||
doc/PlayerMessageDTO.md
|
||||
doc/ResourceApi.md
|
||||
doc/ResourceDTO.md
|
||||
doc/ResourceDetailDTO.md
|
||||
doc/ResourceType.md
|
||||
doc/SectionApi.md
|
||||
doc/SectionDTO.md
|
||||
@ -51,6 +52,8 @@ lib/model/configuration_dto.dart
|
||||
lib/model/device_detail_dto.dart
|
||||
lib/model/device_detail_dto_all_of.dart
|
||||
lib/model/device_dto.dart
|
||||
lib/model/export_configuration_dto.dart
|
||||
lib/model/export_configuration_dto_all_of.dart
|
||||
lib/model/geo_point_dto.dart
|
||||
lib/model/image_dto.dart
|
||||
lib/model/image_geo_point.dart
|
||||
@ -59,7 +62,6 @@ lib/model/map_dto.dart
|
||||
lib/model/map_type_app.dart
|
||||
lib/model/menu_dto.dart
|
||||
lib/model/player_message_dto.dart
|
||||
lib/model/resource_detail_dto.dart
|
||||
lib/model/resource_dto.dart
|
||||
lib/model/resource_type.dart
|
||||
lib/model/section_dto.dart
|
||||
@ -72,3 +74,5 @@ lib/model/user_detail_dto.dart
|
||||
lib/model/video_dto.dart
|
||||
lib/model/web_dto.dart
|
||||
pubspec.yaml
|
||||
test/export_configuration_dto_all_of_test.dart
|
||||
test/export_configuration_dto_test.dart
|
||||
|
||||
@ -68,8 +68,10 @@ Class | Method | HTTP request | Description
|
||||
*AuthenticationApi* | [**authenticationAuthenticateWithJson**](doc\/AuthenticationApi.md#authenticationauthenticatewithjson) | **POST** /api/Authentication/Authenticate |
|
||||
*ConfigurationApi* | [**configurationCreate**](doc\/ConfigurationApi.md#configurationcreate) | **POST** /api/Configuration |
|
||||
*ConfigurationApi* | [**configurationDelete**](doc\/ConfigurationApi.md#configurationdelete) | **DELETE** /api/Configuration/{id} |
|
||||
*ConfigurationApi* | [**configurationExport**](doc\/ConfigurationApi.md#configurationexport) | **GET** /api/Configuration/{id}/export |
|
||||
*ConfigurationApi* | [**configurationGet**](doc\/ConfigurationApi.md#configurationget) | **GET** /api/Configuration |
|
||||
*ConfigurationApi* | [**configurationGetDetail**](doc\/ConfigurationApi.md#configurationgetdetail) | **GET** /api/Configuration/{id} |
|
||||
*ConfigurationApi* | [**configurationImport**](doc\/ConfigurationApi.md#configurationimport) | **POST** /api/Configuration/import |
|
||||
*ConfigurationApi* | [**configurationUpdate**](doc\/ConfigurationApi.md#configurationupdate) | **PUT** /api/Configuration |
|
||||
*DeviceApi* | [**deviceCreate**](doc\/DeviceApi.md#devicecreate) | **POST** /api/Device |
|
||||
*DeviceApi* | [**deviceDelete**](doc\/DeviceApi.md#devicedelete) | **DELETE** /api/Device/{id} |
|
||||
@ -112,6 +114,8 @@ Class | Method | HTTP request | Description
|
||||
- [DeviceDTO](doc\/DeviceDTO.md)
|
||||
- [DeviceDetailDTO](doc\/DeviceDetailDTO.md)
|
||||
- [DeviceDetailDTOAllOf](doc\/DeviceDetailDTOAllOf.md)
|
||||
- [ExportConfigurationDTO](doc\/ExportConfigurationDTO.md)
|
||||
- [ExportConfigurationDTOAllOf](doc\/ExportConfigurationDTOAllOf.md)
|
||||
- [GeoPointDTO](doc\/GeoPointDTO.md)
|
||||
- [ImageDTO](doc\/ImageDTO.md)
|
||||
- [ImageGeoPoint](doc\/ImageGeoPoint.md)
|
||||
@ -121,7 +125,6 @@ Class | Method | HTTP request | Description
|
||||
- [MenuDTO](doc\/MenuDTO.md)
|
||||
- [PlayerMessageDTO](doc\/PlayerMessageDTO.md)
|
||||
- [ResourceDTO](doc\/ResourceDTO.md)
|
||||
- [ResourceDetailDTO](doc\/ResourceDetailDTO.md)
|
||||
- [ResourceType](doc\/ResourceType.md)
|
||||
- [SectionDTO](doc\/SectionDTO.md)
|
||||
- [SectionType](doc\/SectionType.md)
|
||||
|
||||
@ -11,8 +11,10 @@ Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**configurationCreate**](ConfigurationApi.md#configurationcreate) | **POST** /api/Configuration |
|
||||
[**configurationDelete**](ConfigurationApi.md#configurationdelete) | **DELETE** /api/Configuration/{id} |
|
||||
[**configurationExport**](ConfigurationApi.md#configurationexport) | **GET** /api/Configuration/{id}/export |
|
||||
[**configurationGet**](ConfigurationApi.md#configurationget) | **GET** /api/Configuration |
|
||||
[**configurationGetDetail**](ConfigurationApi.md#configurationgetdetail) | **GET** /api/Configuration/{id} |
|
||||
[**configurationImport**](ConfigurationApi.md#configurationimport) | **POST** /api/Configuration/import |
|
||||
[**configurationUpdate**](ConfigurationApi.md#configurationupdate) | **PUT** /api/Configuration |
|
||||
|
||||
|
||||
@ -102,6 +104,49 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **configurationExport**
|
||||
> ExportConfigurationDTO configurationExport(id)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:managerapi/api.dart';
|
||||
// TODO Configure OAuth2 access token for authorization: bearer
|
||||
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
final api_instance = ConfigurationApi();
|
||||
final id = id_example; // String |
|
||||
|
||||
try {
|
||||
final result = api_instance.configurationExport(id);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling ConfigurationApi->configurationExport: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**id** | **String**| |
|
||||
|
||||
### Return type
|
||||
|
||||
[**ExportConfigurationDTO**](ExportConfigurationDTO.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)
|
||||
|
||||
# **configurationGet**
|
||||
> List<ConfigurationDTO> configurationGet()
|
||||
|
||||
@ -184,6 +229,49 @@ Name | Type | Description | Notes
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **configurationImport**
|
||||
> String configurationImport(exportConfigurationDTO)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:managerapi/api.dart';
|
||||
// TODO Configure OAuth2 access token for authorization: bearer
|
||||
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
final api_instance = ConfigurationApi();
|
||||
final exportConfigurationDTO = ExportConfigurationDTO(); // ExportConfigurationDTO |
|
||||
|
||||
try {
|
||||
final result = api_instance.configurationImport(exportConfigurationDTO);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling ConfigurationApi->configurationImport: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**exportConfigurationDTO** | [**ExportConfigurationDTO**](ExportConfigurationDTO.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### 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)
|
||||
|
||||
# **configurationUpdate**
|
||||
> ConfigurationDTO configurationUpdate(configurationDTO)
|
||||
|
||||
|
||||
22
manager_api/doc/ExportConfigurationDTO.md
Normal file
22
manager_api/doc/ExportConfigurationDTO.md
Normal file
@ -0,0 +1,22 @@
|
||||
# managerapi.model.ExportConfigurationDTO
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:managerapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **String** | | [optional]
|
||||
**label** | **String** | | [optional]
|
||||
**primaryColor** | **String** | | [optional]
|
||||
**secondaryColor** | **String** | | [optional]
|
||||
**languages** | **List<String>** | | [optional] [default to const []]
|
||||
**dateCreation** | [**DateTime**](DateTime.md) | | [optional]
|
||||
**sections** | [**List<SectionDTO>**](SectionDTO.md) | | [optional] [default to const []]
|
||||
**resources** | [**List<ResourceDTO>**](ResourceDTO.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)
|
||||
|
||||
|
||||
16
manager_api/doc/ExportConfigurationDTOAllOf.md
Normal file
16
manager_api/doc/ExportConfigurationDTOAllOf.md
Normal file
@ -0,0 +1,16 @@
|
||||
# managerapi.model.ExportConfigurationDTOAllOf
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:managerapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**sections** | [**List<SectionDTO>**](SectionDTO.md) | | [optional] [default to const []]
|
||||
**resources** | [**List<ResourceDTO>**](ResourceDTO.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)
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **resourceCreate**
|
||||
> ResourceDetailDTO resourceCreate(resourceDetailDTO)
|
||||
> ResourceDTO resourceCreate(resourceDTO)
|
||||
|
||||
|
||||
|
||||
@ -30,10 +30,10 @@ import 'package:managerapi/api.dart';
|
||||
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
final api_instance = ResourceApi();
|
||||
final resourceDetailDTO = ResourceDetailDTO(); // ResourceDetailDTO |
|
||||
final resourceDTO = ResourceDTO(); // ResourceDTO |
|
||||
|
||||
try {
|
||||
final result = api_instance.resourceCreate(resourceDetailDTO);
|
||||
final result = api_instance.resourceCreate(resourceDTO);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling ResourceApi->resourceCreate: $e\n');
|
||||
@ -44,11 +44,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**resourceDetailDTO** | [**ResourceDetailDTO**](ResourceDetailDTO.md)| |
|
||||
**resourceDTO** | [**ResourceDTO**](ResourceDTO.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
[**ResourceDetailDTO**](ResourceDetailDTO.md)
|
||||
[**ResourceDTO**](ResourceDTO.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
@ -144,7 +144,7 @@ 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)
|
||||
|
||||
# **resourceGetDetail**
|
||||
> ResourceDetailDTO resourceGetDetail(id)
|
||||
> ResourceDTO resourceGetDetail(id)
|
||||
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Return type
|
||||
|
||||
[**ResourceDetailDTO**](ResourceDetailDTO.md)
|
||||
[**ResourceDTO**](ResourceDTO.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
@ -230,7 +230,7 @@ Name | Type | Description | Notes
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **resourceUpdate**
|
||||
> ResourceDetailDTO resourceUpdate(resourceDetailDTO)
|
||||
> ResourceDTO resourceUpdate(resourceDTO)
|
||||
|
||||
|
||||
|
||||
@ -241,10 +241,10 @@ import 'package:managerapi/api.dart';
|
||||
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
|
||||
|
||||
final api_instance = ResourceApi();
|
||||
final resourceDetailDTO = ResourceDetailDTO(); // ResourceDetailDTO |
|
||||
final resourceDTO = ResourceDTO(); // ResourceDTO |
|
||||
|
||||
try {
|
||||
final result = api_instance.resourceUpdate(resourceDetailDTO);
|
||||
final result = api_instance.resourceUpdate(resourceDTO);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling ResourceApi->resourceUpdate: $e\n');
|
||||
@ -255,11 +255,11 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**resourceDetailDTO** | [**ResourceDetailDTO**](ResourceDetailDTO.md)| |
|
||||
**resourceDTO** | [**ResourceDTO**](ResourceDTO.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
[**ResourceDetailDTO**](ResourceDetailDTO.md)
|
||||
[**ResourceDTO**](ResourceDTO.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ Name | Type | Description | Notes
|
||||
**id** | **String** | | [optional]
|
||||
**type** | [**ResourceType**](ResourceType.md) | | [optional]
|
||||
**label** | **String** | | [optional]
|
||||
**dateCreation** | [**DateTime**](DateTime.md) | | [optional]
|
||||
**data** | **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)
|
||||
|
||||
@ -38,6 +38,8 @@ part 'model/configuration_dto.dart';
|
||||
part 'model/device_dto.dart';
|
||||
part 'model/device_detail_dto.dart';
|
||||
part 'model/device_detail_dto_all_of.dart';
|
||||
part 'model/export_configuration_dto.dart';
|
||||
part 'model/export_configuration_dto_all_of.dart';
|
||||
part 'model/geo_point_dto.dart';
|
||||
part 'model/image_dto.dart';
|
||||
part 'model/image_geo_point.dart';
|
||||
@ -47,7 +49,6 @@ part 'model/map_type_app.dart';
|
||||
part 'model/menu_dto.dart';
|
||||
part 'model/player_message_dto.dart';
|
||||
part 'model/resource_dto.dart';
|
||||
part 'model/resource_detail_dto.dart';
|
||||
part 'model/resource_type.dart';
|
||||
part 'model/section_dto.dart';
|
||||
part 'model/section_type.dart';
|
||||
|
||||
@ -142,6 +142,70 @@ class ConfigurationApi {
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /api/Configuration/{id}/export' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<Response> configurationExportWithHttpInfo(String id) async {
|
||||
// Verify required params are set.
|
||||
if (id == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: id');
|
||||
}
|
||||
|
||||
final path = r'/api/Configuration/{id}/export'
|
||||
.replaceAll('{' + 'id' + '}', id.toString());
|
||||
|
||||
Object postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>[];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['bearer'];
|
||||
|
||||
if (
|
||||
nullableContentType != null &&
|
||||
nullableContentType.toLowerCase().startsWith('multipart/form-data')
|
||||
) {
|
||||
bool hasFields = false;
|
||||
final mp = MultipartRequest(null, null);
|
||||
if (hasFields) {
|
||||
postBody = mp;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<ExportConfigurationDTO> configurationExport(String id) async {
|
||||
final response = await configurationExportWithHttpInfo(id);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, _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 != null && response.statusCode != HttpStatus.noContent) {
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'ExportConfigurationDTO') as ExportConfigurationDTO;
|
||||
}
|
||||
return Future<ExportConfigurationDTO>.value(null);
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /api/Configuration' operation and returns the [Response].
|
||||
Future<Response> configurationGetWithHttpInfo() async {
|
||||
final path = r'/api/Configuration';
|
||||
@ -260,6 +324,69 @@ class ConfigurationApi {
|
||||
return Future<ConfigurationDTO>.value(null);
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'POST /api/Configuration/import' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [ExportConfigurationDTO] exportConfigurationDTO (required):
|
||||
Future<Response> configurationImportWithHttpInfo(ExportConfigurationDTO exportConfigurationDTO) async {
|
||||
// Verify required params are set.
|
||||
if (exportConfigurationDTO == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: exportConfigurationDTO');
|
||||
}
|
||||
|
||||
final path = r'/api/Configuration/import';
|
||||
|
||||
Object postBody = exportConfigurationDTO;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
final contentTypes = <String>['application/json'];
|
||||
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||
final authNames = <String>['bearer'];
|
||||
|
||||
if (
|
||||
nullableContentType != null &&
|
||||
nullableContentType.toLowerCase().startsWith('multipart/form-data')
|
||||
) {
|
||||
bool hasFields = false;
|
||||
final mp = MultipartRequest(null, null);
|
||||
if (hasFields) {
|
||||
postBody = mp;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
return await apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
nullableContentType,
|
||||
authNames,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [ExportConfigurationDTO] exportConfigurationDTO (required):
|
||||
Future<String> configurationImport(ExportConfigurationDTO exportConfigurationDTO) async {
|
||||
final response = await configurationImportWithHttpInfo(exportConfigurationDTO);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, _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 != null && response.statusCode != HttpStatus.noContent) {
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String;
|
||||
}
|
||||
return Future<String>.value(null);
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'PUT /api/Configuration' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
|
||||
@ -18,16 +18,16 @@ class ResourceApi {
|
||||
/// Performs an HTTP 'POST /api/Resource' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [ResourceDetailDTO] resourceDetailDTO (required):
|
||||
Future<Response> resourceCreateWithHttpInfo(ResourceDetailDTO resourceDetailDTO) async {
|
||||
/// * [ResourceDTO] resourceDTO (required):
|
||||
Future<Response> resourceCreateWithHttpInfo(ResourceDTO resourceDTO) async {
|
||||
// Verify required params are set.
|
||||
if (resourceDetailDTO == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: resourceDetailDTO');
|
||||
if (resourceDTO == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: resourceDTO');
|
||||
}
|
||||
|
||||
final path = r'/api/Resource';
|
||||
|
||||
Object postBody = resourceDetailDTO;
|
||||
Object postBody = resourceDTO;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
@ -63,9 +63,9 @@ class ResourceApi {
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [ResourceDetailDTO] resourceDetailDTO (required):
|
||||
Future<ResourceDetailDTO> resourceCreate(ResourceDetailDTO resourceDetailDTO) async {
|
||||
final response = await resourceCreateWithHttpInfo(resourceDetailDTO);
|
||||
/// * [ResourceDTO] resourceDTO (required):
|
||||
Future<ResourceDTO> resourceCreate(ResourceDTO resourceDTO) async {
|
||||
final response = await resourceCreateWithHttpInfo(resourceDTO);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
}
|
||||
@ -73,9 +73,9 @@ class ResourceApi {
|
||||
// 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), 'ResourceDetailDTO') as ResourceDetailDTO;
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'ResourceDTO') as ResourceDTO;
|
||||
}
|
||||
return Future<ResourceDetailDTO>.value(null);
|
||||
return Future<ResourceDTO>.value(null);
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'DELETE /api/Resource/{id}' operation and returns the [Response].
|
||||
@ -246,7 +246,7 @@ class ResourceApi {
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
Future<ResourceDetailDTO> resourceGetDetail(String id) async {
|
||||
Future<ResourceDTO> resourceGetDetail(String id) async {
|
||||
final response = await resourceGetDetailWithHttpInfo(id);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
@ -255,9 +255,9 @@ class ResourceApi {
|
||||
// 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), 'ResourceDetailDTO') as ResourceDetailDTO;
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'ResourceDTO') as ResourceDTO;
|
||||
}
|
||||
return Future<ResourceDetailDTO>.value(null);
|
||||
return Future<ResourceDTO>.value(null);
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /api/Resource/{id}' operation and returns the [Response].
|
||||
@ -327,16 +327,16 @@ class ResourceApi {
|
||||
/// Performs an HTTP 'PUT /api/Resource' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [ResourceDetailDTO] resourceDetailDTO (required):
|
||||
Future<Response> resourceUpdateWithHttpInfo(ResourceDetailDTO resourceDetailDTO) async {
|
||||
/// * [ResourceDTO] resourceDTO (required):
|
||||
Future<Response> resourceUpdateWithHttpInfo(ResourceDTO resourceDTO) async {
|
||||
// Verify required params are set.
|
||||
if (resourceDetailDTO == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: resourceDetailDTO');
|
||||
if (resourceDTO == null) {
|
||||
throw ApiException(HttpStatus.badRequest, 'Missing required param: resourceDTO');
|
||||
}
|
||||
|
||||
final path = r'/api/Resource';
|
||||
|
||||
Object postBody = resourceDetailDTO;
|
||||
Object postBody = resourceDTO;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
@ -372,9 +372,9 @@ class ResourceApi {
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [ResourceDetailDTO] resourceDetailDTO (required):
|
||||
Future<ResourceDetailDTO> resourceUpdate(ResourceDetailDTO resourceDetailDTO) async {
|
||||
final response = await resourceUpdateWithHttpInfo(resourceDetailDTO);
|
||||
/// * [ResourceDTO] resourceDTO (required):
|
||||
Future<ResourceDTO> resourceUpdate(ResourceDTO resourceDTO) async {
|
||||
final response = await resourceUpdateWithHttpInfo(resourceDTO);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||
}
|
||||
@ -382,9 +382,9 @@ class ResourceApi {
|
||||
// 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), 'ResourceDetailDTO') as ResourceDetailDTO;
|
||||
return apiClient.deserialize(_decodeBodyBytes(response), 'ResourceDTO') as ResourceDTO;
|
||||
}
|
||||
return Future<ResourceDetailDTO>.value(null);
|
||||
return Future<ResourceDTO>.value(null);
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'POST /api/Resource/upload' operation and returns the [Response].
|
||||
|
||||
@ -164,6 +164,10 @@ class ApiClient {
|
||||
return DeviceDetailDTO.fromJson(value);
|
||||
case 'DeviceDetailDTOAllOf':
|
||||
return DeviceDetailDTOAllOf.fromJson(value);
|
||||
case 'ExportConfigurationDTO':
|
||||
return ExportConfigurationDTO.fromJson(value);
|
||||
case 'ExportConfigurationDTOAllOf':
|
||||
return ExportConfigurationDTOAllOf.fromJson(value);
|
||||
case 'GeoPointDTO':
|
||||
return GeoPointDTO.fromJson(value);
|
||||
case 'ImageDTO':
|
||||
@ -183,8 +187,6 @@ class ApiClient {
|
||||
return PlayerMessageDTO.fromJson(value);
|
||||
case 'ResourceDTO':
|
||||
return ResourceDTO.fromJson(value);
|
||||
case 'ResourceDetailDTO':
|
||||
return ResourceDetailDTO.fromJson(value);
|
||||
case 'ResourceType':
|
||||
return ResourceTypeTypeTransformer().decode(value);
|
||||
|
||||
|
||||
138
manager_api/lib/model/export_configuration_dto.dart
Normal file
138
manager_api/lib/model/export_configuration_dto.dart
Normal file
@ -0,0 +1,138 @@
|
||||
//
|
||||
// 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 ExportConfigurationDTO {
|
||||
/// Returns a new [ExportConfigurationDTO] instance.
|
||||
ExportConfigurationDTO({
|
||||
this.id,
|
||||
this.label,
|
||||
this.primaryColor,
|
||||
this.secondaryColor,
|
||||
this.languages,
|
||||
this.dateCreation,
|
||||
this.sections,
|
||||
this.resources,
|
||||
});
|
||||
|
||||
String id;
|
||||
|
||||
String label;
|
||||
|
||||
String primaryColor;
|
||||
|
||||
String secondaryColor;
|
||||
|
||||
List<String> languages;
|
||||
|
||||
DateTime dateCreation;
|
||||
|
||||
List<SectionDTO> sections;
|
||||
|
||||
List<ResourceDTO> resources;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ExportConfigurationDTO &&
|
||||
other.id == id &&
|
||||
other.label == label &&
|
||||
other.primaryColor == primaryColor &&
|
||||
other.secondaryColor == secondaryColor &&
|
||||
other.languages == languages &&
|
||||
other.dateCreation == dateCreation &&
|
||||
other.sections == sections &&
|
||||
other.resources == resources;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(label == null ? 0 : label.hashCode) +
|
||||
(primaryColor == null ? 0 : primaryColor.hashCode) +
|
||||
(secondaryColor == null ? 0 : secondaryColor.hashCode) +
|
||||
(languages == null ? 0 : languages.hashCode) +
|
||||
(dateCreation == null ? 0 : dateCreation.hashCode) +
|
||||
(sections == null ? 0 : sections.hashCode) +
|
||||
(resources == null ? 0 : resources.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ExportConfigurationDTO[id=$id, label=$label, primaryColor=$primaryColor, secondaryColor=$secondaryColor, languages=$languages, dateCreation=$dateCreation, sections=$sections, resources=$resources]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (id != null) {
|
||||
json[r'id'] = id;
|
||||
}
|
||||
if (label != null) {
|
||||
json[r'label'] = label;
|
||||
}
|
||||
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();
|
||||
}
|
||||
if (sections != null) {
|
||||
json[r'sections'] = sections;
|
||||
}
|
||||
if (resources != null) {
|
||||
json[r'resources'] = resources;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [ExportConfigurationDTO] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ExportConfigurationDTO fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ExportConfigurationDTO(
|
||||
id: json[r'id'],
|
||||
label: json[r'label'],
|
||||
primaryColor: json[r'primaryColor'],
|
||||
secondaryColor: json[r'secondaryColor'],
|
||||
languages: json[r'languages'] == null
|
||||
? null
|
||||
: (json[r'languages'] as List).cast<String>(),
|
||||
dateCreation: json[r'dateCreation'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'dateCreation']),
|
||||
sections: SectionDTO.listFromJson(json[r'sections']),
|
||||
resources: ResourceDTO.listFromJson(json[r'resources']),
|
||||
);
|
||||
|
||||
static List<ExportConfigurationDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ExportConfigurationDTO>[]
|
||||
: json.map((v) => ExportConfigurationDTO.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, ExportConfigurationDTO> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, ExportConfigurationDTO>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) => map[key] = ExportConfigurationDTO.fromJson(v));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ExportConfigurationDTO-objects as value to a dart map
|
||||
static Map<String, List<ExportConfigurationDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ExportConfigurationDTO>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = ExportConfigurationDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
80
manager_api/lib/model/export_configuration_dto_all_of.dart
Normal file
80
manager_api/lib/model/export_configuration_dto_all_of.dart
Normal file
@ -0,0 +1,80 @@
|
||||
//
|
||||
// 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 ExportConfigurationDTOAllOf {
|
||||
/// Returns a new [ExportConfigurationDTOAllOf] instance.
|
||||
ExportConfigurationDTOAllOf({
|
||||
this.sections,
|
||||
this.resources,
|
||||
});
|
||||
|
||||
List<SectionDTO> sections;
|
||||
|
||||
List<ResourceDTO> resources;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ExportConfigurationDTOAllOf &&
|
||||
other.sections == sections &&
|
||||
other.resources == resources;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
(sections == null ? 0 : sections.hashCode) +
|
||||
(resources == null ? 0 : resources.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ExportConfigurationDTOAllOf[sections=$sections, resources=$resources]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (sections != null) {
|
||||
json[r'sections'] = sections;
|
||||
}
|
||||
if (resources != null) {
|
||||
json[r'resources'] = resources;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [ExportConfigurationDTOAllOf] instance and imports its values from
|
||||
/// [json] if it's non-null, null if [json] is null.
|
||||
static ExportConfigurationDTOAllOf fromJson(Map<String, dynamic> json) => json == null
|
||||
? null
|
||||
: ExportConfigurationDTOAllOf(
|
||||
sections: SectionDTO.listFromJson(json[r'sections']),
|
||||
resources: ResourceDTO.listFromJson(json[r'resources']),
|
||||
);
|
||||
|
||||
static List<ExportConfigurationDTOAllOf> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
||||
json == null || json.isEmpty
|
||||
? true == emptyIsNull ? null : <ExportConfigurationDTOAllOf>[]
|
||||
: json.map((v) => ExportConfigurationDTOAllOf.fromJson(v)).toList(growable: true == growable);
|
||||
|
||||
static Map<String, ExportConfigurationDTOAllOf> mapFromJson(Map<String, dynamic> json) {
|
||||
final map = <String, ExportConfigurationDTOAllOf>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) => map[key] = ExportConfigurationDTOAllOf.fromJson(v));
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of ExportConfigurationDTOAllOf-objects as value to a dart map
|
||||
static Map<String, List<ExportConfigurationDTOAllOf>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
||||
final map = <String, List<ExportConfigurationDTOAllOf>>{};
|
||||
if (json != null && json.isNotEmpty) {
|
||||
json.forEach((String key, dynamic v) {
|
||||
map[key] = ExportConfigurationDTOAllOf.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ class ResourceDTO {
|
||||
this.id,
|
||||
this.type,
|
||||
this.label,
|
||||
this.dateCreation,
|
||||
this.data,
|
||||
});
|
||||
|
||||
@ -24,6 +25,8 @@ class ResourceDTO {
|
||||
|
||||
String label;
|
||||
|
||||
DateTime dateCreation;
|
||||
|
||||
String data;
|
||||
|
||||
@override
|
||||
@ -31,6 +34,7 @@ class ResourceDTO {
|
||||
other.id == id &&
|
||||
other.type == type &&
|
||||
other.label == label &&
|
||||
other.dateCreation == dateCreation &&
|
||||
other.data == data;
|
||||
|
||||
@override
|
||||
@ -38,10 +42,11 @@ class ResourceDTO {
|
||||
(id == null ? 0 : id.hashCode) +
|
||||
(type == null ? 0 : type.hashCode) +
|
||||
(label == null ? 0 : label.hashCode) +
|
||||
(dateCreation == null ? 0 : dateCreation.hashCode) +
|
||||
(data == null ? 0 : data.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ResourceDTO[id=$id, type=$type, label=$label, data=$data]';
|
||||
String toString() => 'ResourceDTO[id=$id, type=$type, label=$label, dateCreation=$dateCreation, data=$data]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -54,6 +59,9 @@ class ResourceDTO {
|
||||
if (label != null) {
|
||||
json[r'label'] = label;
|
||||
}
|
||||
if (dateCreation != null) {
|
||||
json[r'dateCreation'] = dateCreation.toUtc().toIso8601String();
|
||||
}
|
||||
if (data != null) {
|
||||
json[r'data'] = data;
|
||||
}
|
||||
@ -68,6 +76,9 @@ class ResourceDTO {
|
||||
id: json[r'id'],
|
||||
type: ResourceType.fromJson(json[r'type']),
|
||||
label: json[r'label'],
|
||||
dateCreation: json[r'dateCreation'] == null
|
||||
? null
|
||||
: DateTime.parse(json[r'dateCreation']),
|
||||
data: json[r'data'],
|
||||
);
|
||||
|
||||
|
||||
@ -176,6 +176,92 @@ paths:
|
||||
type: string
|
||||
security:
|
||||
- bearer: []
|
||||
/api/Configuration/{id}/export:
|
||||
get:
|
||||
tags:
|
||||
- Configuration
|
||||
operationId: Configuration_Export
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
nullable: true
|
||||
x-position: 1
|
||||
responses:
|
||||
'200':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ExportConfigurationDTO'
|
||||
'400':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
'404':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
'500':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- bearer: []
|
||||
/api/Configuration/import:
|
||||
post:
|
||||
tags:
|
||||
- Configuration
|
||||
operationId: Configuration_Import
|
||||
requestBody:
|
||||
x-name: exportConfiguration
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ExportConfigurationDTO'
|
||||
required: true
|
||||
x-position: 1
|
||||
responses:
|
||||
'202':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
'400':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
'404':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
'409':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
'500':
|
||||
description: ''
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- bearer: []
|
||||
/api/Device:
|
||||
get:
|
||||
tags:
|
||||
@ -423,7 +509,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ResourceDetailDTO'
|
||||
$ref: '#/components/schemas/ResourceDTO'
|
||||
required: true
|
||||
x-position: 1
|
||||
responses:
|
||||
@ -432,7 +518,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ResourceDetailDTO'
|
||||
$ref: '#/components/schemas/ResourceDTO'
|
||||
'400':
|
||||
description: ''
|
||||
content:
|
||||
@ -462,7 +548,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ResourceDetailDTO'
|
||||
$ref: '#/components/schemas/ResourceDTO'
|
||||
required: true
|
||||
x-position: 1
|
||||
responses:
|
||||
@ -471,7 +557,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ResourceDetailDTO'
|
||||
$ref: '#/components/schemas/ResourceDTO'
|
||||
'400':
|
||||
description: ''
|
||||
content:
|
||||
@ -511,7 +597,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ResourceDetailDTO'
|
||||
$ref: '#/components/schemas/ResourceDTO'
|
||||
'404':
|
||||
description: ''
|
||||
content:
|
||||
@ -1305,103 +1391,22 @@ components:
|
||||
dateCreation:
|
||||
type: string
|
||||
format: date-time
|
||||
DeviceDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
nullable: true
|
||||
identifier:
|
||||
type: string
|
||||
nullable: true
|
||||
name:
|
||||
type: string
|
||||
nullable: true
|
||||
ipAddressWLAN:
|
||||
type: string
|
||||
nullable: true
|
||||
ipAddressETH:
|
||||
type: string
|
||||
nullable: true
|
||||
configurationId:
|
||||
type: string
|
||||
nullable: true
|
||||
configuration:
|
||||
type: string
|
||||
nullable: true
|
||||
connected:
|
||||
type: boolean
|
||||
dateCreation:
|
||||
type: string
|
||||
format: date-time
|
||||
dateUpdate:
|
||||
type: string
|
||||
format: date-time
|
||||
DeviceDetailDTO:
|
||||
ExportConfigurationDTO:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/DeviceDTO'
|
||||
- $ref: '#/components/schemas/ConfigurationDTO'
|
||||
- type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
connectionLevel:
|
||||
type: string
|
||||
sections:
|
||||
type: array
|
||||
nullable: true
|
||||
lastConnectionLevel:
|
||||
type: string
|
||||
format: date-time
|
||||
batteryLevel:
|
||||
type: string
|
||||
nullable: true
|
||||
lastBatteryLevel:
|
||||
type: string
|
||||
format: date-time
|
||||
ResourceDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
nullable: true
|
||||
type:
|
||||
$ref: '#/components/schemas/ResourceType'
|
||||
label:
|
||||
type: string
|
||||
nullable: true
|
||||
data:
|
||||
type: string
|
||||
nullable: true
|
||||
ResourceType:
|
||||
type: string
|
||||
description: ''
|
||||
x-enumNames:
|
||||
- Image
|
||||
- Video
|
||||
- ImageUrl
|
||||
- VideoUrl
|
||||
enum:
|
||||
- Image
|
||||
- Video
|
||||
- ImageUrl
|
||||
- VideoUrl
|
||||
ResourceDetailDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
nullable: true
|
||||
type:
|
||||
$ref: '#/components/schemas/ResourceType'
|
||||
label:
|
||||
type: string
|
||||
nullable: true
|
||||
dateCreation:
|
||||
type: string
|
||||
format: date-time
|
||||
data:
|
||||
type: string
|
||||
items:
|
||||
$ref: '#/components/schemas/SectionDTO'
|
||||
resources:
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/ResourceDTO'
|
||||
SectionDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
@ -1472,6 +1477,88 @@ components:
|
||||
- Video
|
||||
- Web
|
||||
- Menu
|
||||
ResourceDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
nullable: true
|
||||
type:
|
||||
$ref: '#/components/schemas/ResourceType'
|
||||
label:
|
||||
type: string
|
||||
nullable: true
|
||||
dateCreation:
|
||||
type: string
|
||||
format: date-time
|
||||
data:
|
||||
type: string
|
||||
nullable: true
|
||||
ResourceType:
|
||||
type: string
|
||||
description: ''
|
||||
x-enumNames:
|
||||
- Image
|
||||
- Video
|
||||
- ImageUrl
|
||||
- VideoUrl
|
||||
enum:
|
||||
- Image
|
||||
- Video
|
||||
- ImageUrl
|
||||
- VideoUrl
|
||||
DeviceDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
nullable: true
|
||||
identifier:
|
||||
type: string
|
||||
nullable: true
|
||||
name:
|
||||
type: string
|
||||
nullable: true
|
||||
ipAddressWLAN:
|
||||
type: string
|
||||
nullable: true
|
||||
ipAddressETH:
|
||||
type: string
|
||||
nullable: true
|
||||
configurationId:
|
||||
type: string
|
||||
nullable: true
|
||||
configuration:
|
||||
type: string
|
||||
nullable: true
|
||||
connected:
|
||||
type: boolean
|
||||
dateCreation:
|
||||
type: string
|
||||
format: date-time
|
||||
dateUpdate:
|
||||
type: string
|
||||
format: date-time
|
||||
DeviceDetailDTO:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/DeviceDTO'
|
||||
- type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
connectionLevel:
|
||||
type: string
|
||||
nullable: true
|
||||
lastConnectionLevel:
|
||||
type: string
|
||||
format: date-time
|
||||
batteryLevel:
|
||||
type: string
|
||||
nullable: true
|
||||
lastBatteryLevel:
|
||||
type: string
|
||||
format: date-time
|
||||
MapDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
|
||||
31
manager_api/test/export_configuration_dto_all_of_test.dart
Normal file
31
manager_api/test/export_configuration_dto_all_of_test.dart
Normal file
@ -0,0 +1,31 @@
|
||||
//
|
||||
// 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 ExportConfigurationDTOAllOf
|
||||
void main() {
|
||||
final instance = ExportConfigurationDTOAllOf();
|
||||
|
||||
group('test ExportConfigurationDTOAllOf', () {
|
||||
// List<SectionDTO> sections (default value: const [])
|
||||
test('to test the property `sections`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// List<ResourceDTO> resources (default value: const [])
|
||||
test('to test the property `resources`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
61
manager_api/test/export_configuration_dto_test.dart
Normal file
61
manager_api/test/export_configuration_dto_test.dart
Normal file
@ -0,0 +1,61 @@
|
||||
//
|
||||
// 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 ExportConfigurationDTO
|
||||
void main() {
|
||||
final instance = ExportConfigurationDTO();
|
||||
|
||||
group('test ExportConfigurationDTO', () {
|
||||
// String id
|
||||
test('to test the property `id`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String label
|
||||
test('to test the property `label`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String primaryColor
|
||||
test('to test the property `primaryColor`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String secondaryColor
|
||||
test('to test the property `secondaryColor`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// List<String> languages (default value: const [])
|
||||
test('to test the property `languages`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// DateTime dateCreation
|
||||
test('to test the property `dateCreation`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// List<SectionDTO> sections (default value: const [])
|
||||
test('to test the property `sections`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// List<ResourceDTO> resources (default value: const [])
|
||||
test('to test the property `resources`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user