update service generation + add vlc player (for local video) + show resource (image from service) + upload new resource

This commit is contained in:
Thomas Fransolet 2021-05-07 22:58:40 +02:00
parent 869c071de5
commit fa378695f8
36 changed files with 2692 additions and 311 deletions

View File

@ -33,7 +33,6 @@ android {
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "be.mdlf.manager_app"
minSdkVersion 16
targetSdkVersion 30

View File

@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:managerapi/api.dart';
IconData getResourceIcon(elementType) {
print(elementType);
switch(elementType) {
case ResourceType.image:
return Icons.image;
break;
case ResourceType.imageUrl:
return Icons.image_search; // art_track
break;
case ResourceType.video:
return Icons.slow_motion_video;
break;
case ResourceType.videoUrl:
return Icons.ondemand_video_sharp;
break;
}
return Icons.announcement;
}

View File

@ -0,0 +1,739 @@
import 'dart:io';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:dart_vlc/dart_vlc.dart';
class DartVLC extends StatefulWidget {
final Media file;
const DartVLC({
Key key,
this.file,
}) : super(key: key);
@override
_DartVLCState createState() => _DartVLCState();
}
class _DartVLCState extends State<DartVLC> {
Player player = Player(
id: 0,
videoWidth: 480,
videoHeight: 360,
);
MediaType mediaType = MediaType.file;
CurrentState current = new CurrentState();
PositionState position = new PositionState();
PlaybackState playback = new PlaybackState();
GeneralState general = new GeneralState();
List<Media> medias = <Media>[];
List<Device> devices = <Device>[];
TextEditingController controller = new TextEditingController();
TextEditingController metasController = new TextEditingController();
Media metasMedia;
@override
void initState() {
super.initState();
if (this.mounted) {
this.medias.add(widget.file);
this.player.open(
new Playlist(
medias: this.medias,
playlistMode:
PlaylistMode.loop),
);
/*this.player.currentStream.listen((current) {
this.setState(() => this.current = current);
});
this.player.positionStream.listen((position) {
this.setState(() => this.position = position);
});
this.player.playbackStream.listen((playback) {
this.setState(() => this.playback = playback);
});
this.player.generateStream.listen((general) {
this.setState(() => this.general = general);
});*/
}
}
@override
Future<void> didChangeDependencies() async {
super.didChangeDependencies();
//this.devices = await Devices.all;
this.setState(() {});
}
@override
Widget build(BuildContext context) {
return Video(
playerId: 0,
width: 640,
height: 480,
volumeThumbColor: Colors.blue,
volumeActiveColor: Colors.blue,
);
/*Scaffold(
body: ListView(
shrinkWrap: true,
padding: EdgeInsets.all(4.0),
children: [
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Card(
clipBehavior: Clip.antiAlias,
elevation: 2.0,
child: Video(
playerId: 0,
width: 640,
height: 480,
volumeThumbColor: Colors.blue,
volumeActiveColor: Colors.blue,
),
),
],
),
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Card(
elevation: 2.0,
margin: EdgeInsets.all(10.0),
child: Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text('Playlist creation.'),
Divider(
height: 8.0,
color: Colors.transparent,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: TextField(
controller: this.controller,
cursorWidth: 1.0,
autofocus: true,
style: TextStyle(
fontSize: 14.0,
),
decoration: InputDecoration.collapsed(
hintStyle: TextStyle(
fontSize: 14.0,
),
hintText:
'Media resource location.',
),
),
),
Container(
width: 152.0,
child: DropdownButton<MediaType>(
value: this.mediaType,
onChanged: (mediaType) => this
.setState(() =>
this.mediaType = mediaType),
items: [
DropdownMenuItem<MediaType>(
value: MediaType.file,
child: Text(
MediaType.file.toString(),
style: TextStyle(
fontSize: 14.0,
),
),
),
DropdownMenuItem<MediaType>(
value: MediaType.network,
child: Text(
MediaType.network.toString(),
style: TextStyle(
fontSize: 14.0,
),
),
),
DropdownMenuItem<MediaType>(
value: MediaType.asset,
child: Text(
MediaType.asset.toString(),
style: TextStyle(
fontSize: 14.0,
),
),
),
],
),
),
Padding(
padding: EdgeInsets.only(left: 10.0),
child: ElevatedButton(
onPressed: () async {
if (this.mediaType ==
MediaType.file) {
this.medias.add(
await Media.file(new File(
controller.text)),
);
} else if (this.mediaType ==
MediaType.network) {
this.medias.add(
await Media.network(
controller.text),
);
} else if (this.mediaType ==
MediaType.asset) {
this.medias.add(
await Media.asset(
controller.text),
);
}
this.setState(() {});
},
child: Text(
'Add',
style: TextStyle(
fontSize: 14.0,
),
),
),
),
],
),
Divider(
height: 12.0,
),
Divider(
height: 8.0,
color: Colors.transparent,
),
Text('Playlist'),
] +
this
.medias
.map(
(media) => ListTile(
title: Text(
media.resource,
style: TextStyle(
fontSize: 14.0,
),
),
subtitle: Text(
media.mediaType.toString(),
style: TextStyle(
fontSize: 14.0,
),
),
),
)
.toList() +
<Widget>[
Divider(
height: 8.0,
color: Colors.transparent,
),
Row(
children: [
ElevatedButton(
onPressed: () => this.setState(() {
this.player.open(
new Playlist(
medias: this.medias,
playlistMode:
PlaylistMode.loop),
);
}),
child: Text(
'Open',
style: TextStyle(
fontSize: 14.0,
),
),
),
SizedBox(width: 12.0),
ElevatedButton(
onPressed: () => this.setState(() {
this.medias.clear();
}),
child: Text(
'Clear',
style: TextStyle(
fontSize: 14.0,
),
),
),
],
),
],
),
),
),
Card(
elevation: 2.0,
margin: EdgeInsets.all(4.0),
child: Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Playback event listeners.'),
Divider(
height: 12.0,
color: Colors.transparent,
),
Divider(
height: 12.0,
),
Text('Playback position.'),
Divider(
height: 8.0,
color: Colors.transparent,
),
Slider(
min: 0,
max: this
.position
.duration
.inMilliseconds
.toDouble(),
value: this
.position
.position
.inMilliseconds
.toDouble(),
onChanged: (double position) {
this.player.seek(
Duration(
milliseconds: position.toInt()),
);
},
),
Text('Event streams.'),
Divider(
height: 8.0,
color: Colors.transparent,
),
Table(
children: [
TableRow(children: [
Text('player.general.volume'),
Text('${this.general.volume}')
]),
TableRow(children: [
Text('player.general.rate'),
Text('${this.general.rate}')
]),
TableRow(children: [
Text('player.position.position'),
Text('${this.position.position}')
]),
TableRow(children: [
Text('player.position.duration'),
Text('${this.position.duration}')
]),
TableRow(children: [
Text('player.playback.isCompleted'),
Text('${this.playback.isCompleted}')
]),
TableRow(children: [
Text('player.playback.isPlaying'),
Text('${this.playback.isPlaying}')
]),
TableRow(children: [
Text('player.playback.isSeekable'),
Text('${this.playback.isSeekable}')
]),
TableRow(children: [
Text('player.current.index'),
Text('${this.current.index}')
]),
TableRow(children: [
Text('player.current.media'),
Text('${this.current.media}')
]),
TableRow(children: [
Text('player.current.medias'),
Text('${this.current.medias}')
]),
],
),
],
),
),
),
Card(
elevation: 2.0,
margin: EdgeInsets.all(4.0),
child: Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Playback devices.'),
Divider(
height: 12.0,
color: Colors.transparent,
),
Divider(
height: 12.0,
),
] +
this
.devices
.map(
(device) => new ListTile(
title: Text(
device.name,
style: TextStyle(
fontSize: 14.0,
),
),
subtitle: Text(
device.id,
style: TextStyle(
fontSize: 14.0,
),
),
onTap: () =>
this.player.setDevice(device),
),
)
.toList(),
),
),
),
Card(
elevation: 2.0,
margin: EdgeInsets.all(4.0),
child: Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Metas parsing.'),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: TextField(
controller: this.metasController,
cursorWidth: 1.0,
autofocus: true,
style: TextStyle(
fontSize: 14.0,
),
decoration: InputDecoration.collapsed(
hintStyle: TextStyle(
fontSize: 14.0,
),
hintText: 'Media resource location.',
),
),
),
Container(
width: 152.0,
child: DropdownButton<MediaType>(
value: this.mediaType,
onChanged: (mediaType) => this.setState(
() => this.mediaType = mediaType),
items: [
DropdownMenuItem<MediaType>(
value: MediaType.file,
child: Text(
MediaType.file.toString(),
style: TextStyle(
fontSize: 14.0,
),
),
),
DropdownMenuItem<MediaType>(
value: MediaType.network,
child: Text(
MediaType.network.toString(),
style: TextStyle(
fontSize: 14.0,
),
),
),
DropdownMenuItem<MediaType>(
value: MediaType.asset,
child: Text(
MediaType.asset.toString(),
style: TextStyle(
fontSize: 14.0,
),
),
),
],
),
),
Padding(
padding: EdgeInsets.only(left: 16.0),
child: ElevatedButton(
onPressed: () async {
if (this.mediaType == MediaType.file) {
this.metasMedia = await Media.file(
new File(
this.metasController.text),
parse: true);
} else if (this.mediaType ==
MediaType.network) {
this.metasMedia = await Media.network(
this.metasController.text,
parse: true);
} else if (this.mediaType ==
MediaType.asset) {
this.metasMedia = await Media.asset(
this.metasController.text,
parse: true);
}
this.setState(() {});
},
child: Text(
'Parse',
style: TextStyle(
fontSize: 14.0,
),
),
),
),
],
),
Divider(
height: 12.0,
),
Divider(
height: 8.0,
color: Colors.transparent,
),
Text(
JsonEncoder.withIndent(' ')
.convert(this.metasMedia?.metas),
),
],
),
),
),
],
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Card(
elevation: 2.0,
margin: EdgeInsets.all(4.0),
child: Container(
margin: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Playback controls.'),
Divider(
height: 8.0,
color: Colors.transparent,
),
Row(
children: [
ElevatedButton(
onPressed: () => this.player.play(),
child: Text(
'play',
style: TextStyle(
fontSize: 14.0,
),
),
),
SizedBox(width: 12.0),
ElevatedButton(
onPressed: () => this.player.pause(),
child: Text(
'pause',
style: TextStyle(
fontSize: 14.0,
),
),
),
SizedBox(width: 12.0),
ElevatedButton(
onPressed: () => this.player.playOrPause(),
child: Text(
'playOrPause',
style: TextStyle(
fontSize: 14.0,
),
),
),
SizedBox(width: 12.0),
ElevatedButton(
onPressed: () => this.player.stop(),
child: Text(
'stop',
style: TextStyle(
fontSize: 14.0,
),
),
),
SizedBox(width: 12.0),
ElevatedButton(
onPressed: () => this.player.next(),
child: Text(
'next',
style: TextStyle(
fontSize: 14.0,
),
),
),
SizedBox(width: 12.0),
ElevatedButton(
onPressed: () => this.player.back(),
child: Text(
'back',
style: TextStyle(
fontSize: 14.0,
),
),
),
],
),
Divider(
height: 12.0,
color: Colors.transparent,
),
Divider(
height: 12.0,
),
Text('Volume control.'),
Divider(
height: 8.0,
color: Colors.transparent,
),
Slider(
min: 0.0,
max: 1.0,
value: this.player.general.volume ?? 0.5,
onChanged: (volume) {
this.player.setVolume(volume);
this.setState(() {});
},
),
Text('Playback rate control.'),
Divider(
height: 8.0,
color: Colors.transparent,
),
Slider(
min: 0.5,
max: 1.5,
value: this.player.general.rate ?? 0.5,
onChanged: (rate) {
this.player.setRate(rate);
this.setState(() {});
},
),
],
),
),
),
Card(
elevation: 2.0,
margin: EdgeInsets.all(4.0),
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(left: 16.0, top: 16.0),
alignment: Alignment.topLeft,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Playlist manipulation.'),
Divider(
height: 12.0,
color: Colors.transparent,
),
Divider(
height: 12.0,
),
],
),
),
Container(
height: 456.0,
child: ReorderableListView(
shrinkWrap: true,
onReorder:
(int initialIndex, int finalIndex) async {
/// 🙏🙏🙏
/// https://github.com/flutter/flutter/issues/24786
/// https://stackoverflow.com/a/54164333/12825435
if (finalIndex > this.current.medias.length)
finalIndex = this.current.medias.length;
if (initialIndex < finalIndex) finalIndex--;
await this
.player
.move(initialIndex, finalIndex);
this.setState(() {});
},
scrollDirection: Axis.vertical,
padding:
const EdgeInsets.symmetric(vertical: 8.0),
children: List.generate(
this.current.medias.length,
(int index) => new ListTile(
key: Key(index.toString()),
leading: Text(
index.toString(),
style: TextStyle(fontSize: 14.0),
),
title: Text(
this.current.medias[index].resource,
style: TextStyle(fontSize: 14.0),
),
subtitle: Text(
this
.current
.medias[index]
.mediaType
.toString(),
style: TextStyle(fontSize: 14.0),
),
),
growable: true,
),
),
),
],
),
),
),
],
),
),
],
)
],
),
);*/
}
}

View File

@ -0,0 +1,137 @@
import 'dart:io';
import 'package:manager_app/Screens/Resources/upload_image.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/Models/managerContext.dart';
import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
import 'package:managerapi/api.dart';
import 'package:http/http.dart' as http;
void showNewResource(AppContext appContext, BuildContext context) {
ResourceDetailDTO resourceDetailDTO = new ResourceDetailDTO();
var fileName;
File fileToSend;
showDialog(
builder: (BuildContext context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))
),
content: Container(
width: 400,
child: SingleChildScrollView(
child: Column(
children: [
Text("Nouvelle ressource", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)),
Column(
children: [
StringContainer(
label: "Nom :",
initialValue: resourceDetailDTO.label,
onChanged: (value) {
resourceDetailDTO.label = value;
},
),
if (fileName != null) new Text(fileName),
],
),
UploadImageContainer(
onChanged: (File file) {
print("ONCHANGED image");
print(file.path);
fileToSend = file;
resourceDetailDTO.type = ResourceType.image;
}
),
],
),
),
),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: 175,
height: 70,
child: RoundedButton(
text: "Annuler",
icon: Icons.undo,
color: kSecond,
press: () {
Navigator.of(context).pop();
},
fontSize: 20,
),
),
),
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: 150,
height: 70,
child: RoundedButton(
text: "Créer",
icon: Icons.check,
color: kPrimaryColor,
textColor: kWhite,
press: () {
create(resourceDetailDTO, fileToSend, appContext, context);
},
fontSize: 20,
),
),
),
],
),
],
), context: context
);
}
void create(ResourceDetailDTO resourceDetailDTO, File file, AppContext appContext, context) async {
if (resourceDetailDTO.label != null) {
Navigator.of(context).pop();
print(resourceDetailDTO.type);
if(resourceDetailDTO.type == ResourceType.image || resourceDetailDTO.type == ResourceType.video) {
var request = http.MultipartRequest('POST', Uri.parse(appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/upload"));
request.files.add(
await http.MultipartFile(
'picture',
file.readAsBytes().asStream(),
file.lengthSync(),
filename: file.path.toString().split("/").last
)
);
// Todo Add header with bearer token (get via managercontext - token value)
//request.headers.addEntries(newEntries)
request.fields['label'] = resourceDetailDTO.label;
request.fields['type'] = ResourceType.image.toString();
var res = await request.send();
print("RESULT");
print(res.statusCode);
// TODO add message if status code not ok
} else {
ResourceDetailDTO newResource = await appContext.getContext().clientAPI.resourceApi.resourceCreate(resourceDetailDTO);
}
// 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);
}
}

View File

@ -1,124 +0,0 @@
import 'package:file_picker/file_picker.dart';
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/Models/managerContext.dart';
import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
import 'package:managerapi/api.dart';
void showNewRessource(AppContext appContext, BuildContext context) {
RessourceDetailDTO ressourceDetailDTO = new RessourceDetailDTO();
dynamic url = null;
showDialog(
builder: (BuildContext context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))
),
content: SingleChildScrollView(
child: Column(
children: [
Text("Nouvelle ressource", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)),
Column(
children: [
StringContainer(
label: "Nom :",
initialValue: ressourceDetailDTO.label,
onChanged: (value) {
ressourceDetailDTO.label = value;
},
),
if (url != null) Image.network(url)
],
),
InkWell(
onTap: () async {
print("onTap upload");
final file = OpenFilePicker()
..filterSpecification = {
'Images (*.jpg; *.png)': '*.jpg;*.png',
'Video (*.mp4)': '*.mp4',
'All Files': '*.*'
}
..defaultFilterIndex = 0
..title = 'Sélectionner un fichier';
final result = file.getFile();
if (result != null) {
print(result.path);
print(result.uri);
// Read the file.
dynamic contents = await result.readAsBytes();
print(contents);
url = result.path;
}
},
child: Text("UPLOAD !"),
),
],
),
),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: 175,
height: 70,
child: RoundedButton(
text: "Annuler",
icon: Icons.undo,
color: kSecond,
press: () {
Navigator.of(context).pop();
},
fontSize: 20,
),
),
),
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: 150,
height: 70,
child: RoundedButton(
text: "Créer",
icon: Icons.check,
color: kPrimaryColor,
textColor: kWhite,
press: () {
create(ressourceDetailDTO, appContext, context);
},
fontSize: 20,
),
),
),
],
),
],
), context: context
);
}
void create(RessourceDetailDTO ressourceDetailDTO, AppContext appContext, context) async {
if (ressourceDetailDTO.label != null) {
Navigator.of(context).pop();
RessourceDetailDTO newRessource = await appContext.getContext().clientAPI.ressourceApi.ressourceCreate(ressourceDetailDTO);
print("newRessource");
print(newRessource);
// 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);
}
}

View File

@ -1,8 +1,10 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Components/fetch_resource_icon.dart';
import 'package:manager_app/Components/fetch_section_icon.dart';
import 'package:manager_app/Models/managerContext.dart';
import 'package:manager_app/Screens/Resources/new_ressource_popup.dart';
import 'package:manager_app/Screens/Resources/show_ressource_popup.dart';
import 'package:manager_app/Screens/Resources/new_resource_popup.dart';
import 'package:manager_app/Screens/Resources/show_resource_popup.dart';
import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
import 'package:managerapi/api.dart';
@ -29,8 +31,8 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
future: getResources(appContext),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
var tempOutput = new List<RessourceDTO>.from(snapshot.data);
tempOutput.add(RessourceDTO(id: null));
var tempOutput = new List<ResourceDTO>.from(snapshot.data);
tempOutput.add(ResourceDTO(id: null));
return bodyGrid(tempOutput, size, appContext);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
@ -47,16 +49,16 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
Widget bodyGrid(data, Size size, AppContext appContext) {
return GridView.builder(
shrinkWrap: true,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 8),
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
itemCount: data.length,
itemBuilder: (BuildContext context, int index) {
return // User Picture
InkWell(
onTap: () {
if (data[index].id == null) {
showNewRessource(appContext, context);
showNewResource(appContext, context);
} else {
showRessource(data[index], appContext, context);
showResource(data[index], appContext, context, size);
}
},
child: Container(
@ -65,7 +67,7 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
child: Align(
alignment: Alignment.center,
child: getElement(data[index], size)
child: getElement(data[index], size, appContext)
),
),
);
@ -73,26 +75,35 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
);
}
getElement(RessourceDTO ressource, Size size) {
if (ressource.id != null) {
getElement(ResourceDTO resource, Size size, AppContext appContext) {
if (resource.id != null) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Align(
alignment: Alignment.centerLeft,
alignment: Alignment.center,
child: AutoSizeText(
ressource.label,
style: new TextStyle(fontSize: 25),
resource.label == null ? "" : resource.label,
style: new TextStyle(fontSize: 20),
maxLines: 1,
),
),
Container(
height: size.height *0.08,
child: Center(
child: Image.network(
appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id,
fit:BoxFit.fill
),
),
),
Align(
alignment: Alignment.bottomRight,
child: AutoSizeText(
ressource.type.toString(),
style: new TextStyle(fontSize: 18, fontFamily: ""),
maxLines: 1,
child: Icon(
getResourceIcon(resource.type),
color: kPrimaryColor,
size: 25,
),
),
],
@ -107,9 +118,9 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
}
}
boxDecoration(RessourceDTO ressourceDTO) {
boxDecoration(ResourceDTO resourceDTO) {
return BoxDecoration(
color: ressourceDTO.id == null ? Colors.lightGreen : kTextLightColor,
color: resourceDTO.id == null ? Colors.lightGreen : kTextLightColor,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(25.0),
boxShadow: [
@ -123,11 +134,8 @@ boxDecoration(RessourceDTO ressourceDTO) {
);
}
Future<List<RessourceDTO>> getResources(dynamic appContext) async {
List<RessourceDTO> ressources = await appContext.getContext().clientAPI.ressourceApi.ressourceGet();
print("number of ressources " + ressources.length.toString());
ressources.forEach((element) {
print(element);
});
return ressources;
Future<List<ResourceDTO>> getResources(dynamic appContext) async {
List<ResourceDTO> resources = await appContext.getContext().clientAPI.resourceApi.resourceGet();
print(resources);
return resources;
}

View File

@ -0,0 +1,106 @@
import 'package:flutter/material.dart';
import 'package:manager_app/Components/confirmation_dialog.dart';
import 'package:manager_app/Components/message_notification.dart';
import 'package:manager_app/Components/rounded_button.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';
import 'package:intl/intl.dart';
void showResource(ResourceDTO resourceDTO,AppContext appContext, BuildContext context, Size size) {
showDialog(
builder: (BuildContext context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))
),
content: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
resourceDTO.label == null ? "" : resourceDTO.label,
style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)),
),
Container(
height: size.height *0.6,
child: Center(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
border: Border.all(width: 3, color: kSecond)
),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Image.network(
appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resourceDTO.id,
fit:BoxFit.scaleDown
),
),
),
),
),
],
),
),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: 175,
height: 70,
child: RoundedButton(
text: "Retour",
icon: Icons.undo,
color: kSecond,
press: () {
Navigator.of(context).pop();
},
fontSize: 20,
),
),
),
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: 200,
height: 70,
child: RoundedButton(
text: "Supprimer",
icon: Icons.delete,
color: kPrimaryColor,
textColor: kWhite,
press: () {
delete(resourceDTO, appContext, context);
},
fontSize: 20,
),
),
),
],
),
],
), context: context
);
}
Future<void> delete(ResourceDTO resourceDTO, AppContext appContext, context) async {
showConfirmationDialog(
"Êtes-vous sûr de vouloir supprimer cette ressource ?",
() {},
() async {
await appContext.getContext().clientAPI.resourceApi.resourceDelete(resourceDTO.id);
// just to refresh
ManagerAppContext managerAppContext = appContext.getContext();
appContext.setContext(managerAppContext);
Navigator.of(context).pop();
showNotification(Colors.green, kWhite, 'La ressource a été supprimée avec succès', context);
},
context
);
}

View File

@ -1,81 +0,0 @@
import 'package:flutter/material.dart';
import 'package:manager_app/Components/rounded_button.dart';
import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
import 'package:managerapi/api.dart';
import 'package:intl/intl.dart';
void showRessource(RessourceDTO ressourceDTO,AppContext appContext, BuildContext context) {
showDialog(
builder: (BuildContext context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))
),
content: SingleChildScrollView(
child: Column(
children: [
Text(ressourceDTO.label, style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)),
Text('TODO CHARGE IMAGE'),
Text("TODO SHOW IMAGE OR VIDEO")
],
),
),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: 175,
height: 70,
child: RoundedButton(
text: "Retour",
icon: Icons.undo,
color: kSecond,
press: () {
Navigator.of(context).pop();
},
fontSize: 20,
),
),
),
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: 200,
height: 70,
child: RoundedButton(
text: "Supprimer",
icon: Icons.delete,
color: kPrimaryColor,
textColor: kWhite,
press: () {
delete(ressourceDTO, appContext, context);
},
fontSize: 20,
),
),
),
],
),
],
), context: context
);
}
void delete(RessourceDTO ressourceDTO, AppContext appContext, context) async {
if (ressourceDTO.label != null) {
Navigator.of(context).pop();
//RessourceDetailDTO newRessource = await appContext.getContext().clientAPI.ressourceApi.ressourceCreate(ressourceDetailDTO);
print("TODO DELETE");
/*print(newRessource);
// 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);*/
}
}

View File

@ -0,0 +1,170 @@
import 'dart:io';
import 'dart:convert';
import 'package:dart_vlc/dart_vlc.dart';
import 'package:manager_app/Components/vlc_viewer.dart';
import 'package:manager_app/constants.dart';
import 'package:path/path.dart';
import 'package:async/async.dart';
import 'package:http/http.dart' as http;
import 'package:filepicker_windows/filepicker_windows.dart';
import 'package:flutter/material.dart';
class UploadImageContainer extends StatefulWidget {
final ValueChanged<File> onChanged;
const UploadImageContainer({
Key key,
this.onChanged,
}) : super(key: key);
@override
_UploadImageContainerState createState() => _UploadImageContainerState();
}
class _UploadImageContainerState extends State<UploadImageContainer> with SingleTickerProviderStateMixin {
var filePath;
File fileToShow;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
width: 500,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (fileToShow == null) InkWell(
onTap: () async {
filePicker();
},
child: Container(
decoration: BoxDecoration(
color: kPrimaryColor,
borderRadius: BorderRadius.circular(15)
),
child: Padding(
padding: const EdgeInsets.only(left: 25.0, right: 25.0, top: 15.0, bottom: 15.0),
child: Text(
"Ajouter un fichier",
style: new TextStyle(color: kWhite),
),
)
),
),
if (fileToShow != null)
Container(
margin: EdgeInsets.all(8.0),
child: Card(
color: kBackgroundColor,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8.0))),
child: InkWell(
onTap: () async {
filePicker();
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8.0),
topRight: Radius.circular(8.0),
),
child: showFile()
),
ListTile(
title: Text(getFileName(filePath)),
subtitle: Text(filePath),
),
],
),
),
),
),
],
),
);
}
String getFileName(filePath) {
return (filePath.toString().split('\\').last);
}
void filePicker() {
final file = OpenFilePicker()
..filterSpecification = {
'Images (*.jpg; *.png)': '*.jpg;*.png',
'Video (*.mp4)': '*.mp4',
'All Files': '*.*'
}
..defaultFilterIndex = 0
..title = 'Sélectionner un fichier';
final result = file.getFile();
if (result != null) {
setState(() {
filePath = result.path;
fileToShow = result;
widget.onChanged(result);
});
}
}
showFile() {
if (getFileName(filePath).contains(".mp4")) {
return FutureBuilder(
future: loadFile(fileToShow),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return Container(
height: 300,
child: DartVLC(file: snapshot.data)
);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
} else {
return Center(child: Container(height: 200, child: Text('LOADING TODO FRAISE')));
}
}
);
/*await Media.file(widget.file)*/
} else {
return Image.file(
fileToShow,
height: 200,
fit:BoxFit.scaleDown
);
}
}
loadFile(File fileToShow) async {
return await Media.file(fileToShow);
}
}
Upload(File imageFile) async {
var stream = new http.ByteStream(DelegatingStream.typed(imageFile.openRead()));
var length = await imageFile.length();
var uri = Uri.parse("upload URL TEST");
var request = new http.MultipartRequest("POST", uri);
var multipartFile = new http.MultipartFile('file', stream, length,
filename: basename(imageFile.path));
//contentType: new MediaType('image', 'png'));
request.files.add(multipartFile);
var response = await request.send();
print(response.statusCode);
response.stream.transform(utf8.decoder).listen((value) {
print(value);
});
}

View File

@ -84,9 +84,9 @@ class _LoginScreenState extends State<LoginScreen> {
SectionDTO section = await clientAPI.sectionApi.sectionGetDetail("60916249494b9eaf283b44f7");
print(section);
List<RessourceDTO> ressources = await clientAPI.ressourceApi.ressourceGet();
print("number of ressources " + ressources.length.toString());
ressources.forEach((element) {
List<ResourceDTO> resources = await clientAPI.resourceApi.resourceGet();
print("number of resources " + resources.length.toString());
resources.forEach((element) {
print(element);
});

View File

@ -17,8 +17,8 @@ class Client {
SectionApi _sectionApi;
SectionApi get sectionApi => _sectionApi;
RessourceApi _ressourceApi;
RessourceApi get ressourceApi => _ressourceApi;
ResourceApi _resourceApi;
ResourceApi get resourceApi => _resourceApi;
DeviceApi _deviceApi;
DeviceApi get deviceApi => _deviceApi;
@ -26,12 +26,12 @@ class Client {
Client() {
_apiClient = ApiClient(
basePath: "http://192.168.31.96");
//basePath: "http://localhost:25049");
//basePath: "https://localhost:44339");
_authenticationApi = AuthenticationApi(_apiClient);
_userApi = UserApi(_apiClient);
_configurationApi = ConfigurationApi(_apiClient);
_sectionApi = SectionApi(_apiClient);
_ressourceApi = RessourceApi(_apiClient);
_resourceApi = ResourceApi(_apiClient);
_deviceApi = DeviceApi(_apiClient);
}
}

View File

@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h"
#include <dart_vlc/dart_vlc_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) dart_vlc_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "DartVlcPlugin");
dart_vlc_plugin_register_with_registrar(dart_vlc_registrar);
}

View File

@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
dart_vlc
)
set(PLUGIN_BUNDLED_LIBRARIES)

View File

@ -7,6 +7,8 @@
import FlutterMacOS
import Foundation
import path_provider_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
}

View File

@ -9,10 +9,10 @@ doc/DeviceDTO.md
doc/DeviceDetailDTO.md
doc/DeviceDetailDTOAllOf.md
doc/LoginDTO.md
doc/RessourceApi.md
doc/RessourceDTO.md
doc/RessourceDetailDTO.md
doc/RessourceType.md
doc/ResourceApi.md
doc/ResourceDTO.md
doc/ResourceDetailDTO.md
doc/ResourceType.md
doc/SectionApi.md
doc/SectionDTO.md
doc/SectionType.md
@ -26,7 +26,7 @@ lib/api.dart
lib/api/authentication_api.dart
lib/api/configuration_api.dart
lib/api/device_api.dart
lib/api/ressource_api.dart
lib/api/resource_api.dart
lib/api/section_api.dart
lib/api/user_api.dart
lib/api_client.dart
@ -42,9 +42,9 @@ lib/model/device_detail_dto.dart
lib/model/device_detail_dto_all_of.dart
lib/model/device_dto.dart
lib/model/login_dto.dart
lib/model/ressource_detail_dto.dart
lib/model/ressource_dto.dart
lib/model/ressource_type.dart
lib/model/resource_detail_dto.dart
lib/model/resource_dto.dart
lib/model/resource_type.dart
lib/model/section_dto.dart
lib/model/section_type.dart
lib/model/token_dto.dart
@ -52,4 +52,4 @@ lib/model/translation_dto.dart
lib/model/user.dart
lib/model/user_detail_dto.dart
pubspec.yaml
test/translation_dto_test.dart
test/resource_type_test.dart

View File

@ -76,12 +76,13 @@ Class | Method | HTTP request | Description
*DeviceApi* | [**deviceGet**](doc\/DeviceApi.md#deviceget) | **GET** /api/Device |
*DeviceApi* | [**deviceGetDetail**](doc\/DeviceApi.md#devicegetdetail) | **GET** /api/Device/{id}/detail |
*DeviceApi* | [**deviceUpdate**](doc\/DeviceApi.md#deviceupdate) | **PUT** /api/Device |
*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 |
*RessourceApi* | [**ressourceGetDetail**](doc\/RessourceApi.md#ressourcegetdetail) | **GET** /api/Ressource/{id}/detail |
*RessourceApi* | [**ressourceShow**](doc\/RessourceApi.md#ressourceshow) | **GET** /api/Ressource/{id} |
*RessourceApi* | [**ressourceUpdate**](doc\/RessourceApi.md#ressourceupdate) | **PUT** /api/Ressource |
*ResourceApi* | [**resourceCreate**](doc\/ResourceApi.md#resourcecreate) | **POST** /api/Resource |
*ResourceApi* | [**resourceDelete**](doc\/ResourceApi.md#resourcedelete) | **DELETE** /api/Resource/{id} |
*ResourceApi* | [**resourceGet**](doc\/ResourceApi.md#resourceget) | **GET** /api/Resource |
*ResourceApi* | [**resourceGetDetail**](doc\/ResourceApi.md#resourcegetdetail) | **GET** /api/Resource/{id}/detail |
*ResourceApi* | [**resourceShow**](doc\/ResourceApi.md#resourceshow) | **GET** /api/Resource/{id} |
*ResourceApi* | [**resourceUpdate**](doc\/ResourceApi.md#resourceupdate) | **PUT** /api/Resource |
*ResourceApi* | [**resourceUpload**](doc\/ResourceApi.md#resourceupload) | **POST** /api/Resource/upload |
*SectionApi* | [**sectionCreate**](doc\/SectionApi.md#sectioncreate) | **POST** /api/Section |
*SectionApi* | [**sectionDelete**](doc\/SectionApi.md#sectiondelete) | **DELETE** /api/Section/{id} |
*SectionApi* | [**sectionDeleteAllForConfiguration**](doc\/SectionApi.md#sectiondeleteallforconfiguration) | **DELETE** /api/Section/configuration/{id} |
@ -104,9 +105,9 @@ Class | Method | HTTP request | Description
- [DeviceDetailDTO](doc\/DeviceDetailDTO.md)
- [DeviceDetailDTOAllOf](doc\/DeviceDetailDTOAllOf.md)
- [LoginDTO](doc\/LoginDTO.md)
- [RessourceDTO](doc\/RessourceDTO.md)
- [RessourceDetailDTO](doc\/RessourceDetailDTO.md)
- [RessourceType](doc\/RessourceType.md)
- [ResourceDTO](doc\/ResourceDTO.md)
- [ResourceDetailDTO](doc\/ResourceDetailDTO.md)
- [ResourceType](doc\/ResourceType.md)
- [SectionDTO](doc\/SectionDTO.md)
- [SectionType](doc\/SectionType.md)
- [TokenDTO](doc\/TokenDTO.md)

View File

@ -0,0 +1,319 @@
# managerapi.api.ResourceApi
## Load the API package
```dart
import 'package:managerapi/api.dart';
```
All URIs are relative to *http://192.168.31.96*
Method | HTTP request | Description
------------- | ------------- | -------------
[**resourceCreate**](ResourceApi.md#resourcecreate) | **POST** /api/Resource |
[**resourceDelete**](ResourceApi.md#resourcedelete) | **DELETE** /api/Resource/{id} |
[**resourceGet**](ResourceApi.md#resourceget) | **GET** /api/Resource |
[**resourceGetDetail**](ResourceApi.md#resourcegetdetail) | **GET** /api/Resource/{id}/detail |
[**resourceShow**](ResourceApi.md#resourceshow) | **GET** /api/Resource/{id} |
[**resourceUpdate**](ResourceApi.md#resourceupdate) | **PUT** /api/Resource |
[**resourceUpload**](ResourceApi.md#resourceupload) | **POST** /api/Resource/upload |
# **resourceCreate**
> ResourceDetailDTO resourceCreate(resourceDetailDTO)
### 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 = ResourceApi();
final resourceDetailDTO = ResourceDetailDTO(); // ResourceDetailDTO |
try {
final result = api_instance.resourceCreate(resourceDetailDTO);
print(result);
} catch (e) {
print('Exception when calling ResourceApi->resourceCreate: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**resourceDetailDTO** | [**ResourceDetailDTO**](ResourceDetailDTO.md)| |
### Return type
[**ResourceDetailDTO**](ResourceDetailDTO.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)
# **resourceDelete**
> String resourceDelete(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 = ResourceApi();
final id = id_example; // String |
try {
final result = api_instance.resourceDelete(id);
print(result);
} catch (e) {
print('Exception when calling ResourceApi->resourceDelete: $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)
# **resourceGet**
> List<ResourceDTO> resourceGet()
### 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 = ResourceApi();
try {
final result = api_instance.resourceGet();
print(result);
} catch (e) {
print('Exception when calling ResourceApi->resourceGet: $e\n');
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**List<ResourceDTO>**](ResourceDTO.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)
# **resourceGetDetail**
> ResourceDetailDTO resourceGetDetail(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 = ResourceApi();
final id = id_example; // String |
try {
final result = api_instance.resourceGetDetail(id);
print(result);
} catch (e) {
print('Exception when calling ResourceApi->resourceGetDetail: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **String**| |
### Return type
[**ResourceDetailDTO**](ResourceDetailDTO.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)
# **resourceShow**
> MultipartFile resourceShow(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 = ResourceApi();
final id = id_example; // String |
try {
final result = api_instance.resourceShow(id);
print(result);
} catch (e) {
print('Exception when calling ResourceApi->resourceShow: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **String**| |
### Return type
[**MultipartFile**](MultipartFile.md)
### Authorization
[bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/octet-stream, 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)
# **resourceUpdate**
> ResourceDetailDTO resourceUpdate(resourceDetailDTO)
### 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 = ResourceApi();
final resourceDetailDTO = ResourceDetailDTO(); // ResourceDetailDTO |
try {
final result = api_instance.resourceUpdate(resourceDetailDTO);
print(result);
} catch (e) {
print('Exception when calling ResourceApi->resourceUpdate: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**resourceDetailDTO** | [**ResourceDetailDTO**](ResourceDetailDTO.md)| |
### Return type
[**ResourceDetailDTO**](ResourceDetailDTO.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)
# **resourceUpload**
> String resourceUpload(label, type)
### 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 = ResourceApi();
final label = label_example; // String |
final type = type_example; // String |
try {
final result = api_instance.resourceUpload(label, type);
print(result);
} catch (e) {
print('Exception when calling ResourceApi->resourceUpload: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**label** | **String**| | [optional]
**type** | **String**| | [optional]
### Return type
**String**
### Authorization
[bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **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)

View File

@ -0,0 +1,17 @@
# managerapi.model.ResourceDTO
## Load the model package
```dart
import 'package:managerapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **String** | | [optional]
**type** | [**ResourceType**](ResourceType.md) | | [optional]
**label** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,19 @@
# managerapi.model.ResourceDetailDTO
## Load the model package
```dart
import 'package:managerapi/api.dart';
```
## Properties
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)

View File

@ -0,0 +1,14 @@
# managerapi.model.ResourceType
## Load the model package
```dart
import 'package:managerapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -30,7 +30,7 @@ part 'auth/http_bearer_auth.dart';
part 'api/authentication_api.dart';
part 'api/configuration_api.dart';
part 'api/device_api.dart';
part 'api/ressource_api.dart';
part 'api/resource_api.dart';
part 'api/section_api.dart';
part 'api/user_api.dart';
@ -39,9 +39,9 @@ part 'model/device_dto.dart';
part 'model/device_detail_dto.dart';
part 'model/device_detail_dto_all_of.dart';
part 'model/login_dto.dart';
part 'model/ressource_dto.dart';
part 'model/ressource_detail_dto.dart';
part 'model/ressource_type.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';
part 'model/token_dto.dart';

View File

@ -0,0 +1,467 @@
//
// 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 ResourceApi {
ResourceApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient;
final ApiClient apiClient;
/// Performs an HTTP 'POST /api/Resource' operation and returns the [Response].
/// Parameters:
///
/// * [ResourceDetailDTO] resourceDetailDTO (required):
Future<Response> resourceCreateWithHttpInfo(ResourceDetailDTO resourceDetailDTO) async {
// Verify required params are set.
if (resourceDetailDTO == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: resourceDetailDTO');
}
final path = r'/api/Resource';
Object postBody = resourceDetailDTO;
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:
///
/// * [ResourceDetailDTO] resourceDetailDTO (required):
Future<ResourceDetailDTO> resourceCreate(ResourceDetailDTO resourceDetailDTO) async {
final response = await resourceCreateWithHttpInfo(resourceDetailDTO);
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), 'ResourceDetailDTO') as ResourceDetailDTO;
}
return Future<ResourceDetailDTO>.value(null);
}
/// Performs an HTTP 'DELETE /api/Resource/{id}' operation and returns the [Response].
/// Parameters:
///
/// * [String] id (required):
Future<Response> resourceDeleteWithHttpInfo(String id) async {
// Verify required params are set.
if (id == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: id');
}
final path = r'/api/Resource/{id}'
.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,
'DELETE',
queryParams,
postBody,
headerParams,
formParams,
nullableContentType,
authNames,
);
}
/// Parameters:
///
/// * [String] id (required):
Future<String> resourceDelete(String id) async {
final response = await resourceDeleteWithHttpInfo(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), 'String') as String;
}
return Future<String>.value(null);
}
/// Performs an HTTP 'GET /api/Resource' operation and returns the [Response].
Future<Response> resourceGetWithHttpInfo() async {
final path = r'/api/Resource';
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,
);
}
Future<List<ResourceDTO>> resourceGet() async {
final response = await resourceGetWithHttpInfo();
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), 'List<ResourceDTO>') as List)
.cast<ResourceDTO>()
.toList(growable: false);
}
return Future<List<ResourceDTO>>.value(null);
}
/// Performs an HTTP 'GET /api/Resource/{id}/detail' operation and returns the [Response].
/// Parameters:
///
/// * [String] id (required):
Future<Response> resourceGetDetailWithHttpInfo(String id) async {
// Verify required params are set.
if (id == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: id');
}
final path = r'/api/Resource/{id}/detail'
.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<ResourceDetailDTO> resourceGetDetail(String id) async {
final response = await resourceGetDetailWithHttpInfo(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), 'ResourceDetailDTO') as ResourceDetailDTO;
}
return Future<ResourceDetailDTO>.value(null);
}
/// Performs an HTTP 'GET /api/Resource/{id}' operation and returns the [Response].
/// Parameters:
///
/// * [String] id (required):
Future<Response> resourceShowWithHttpInfo(String id) async {
// Verify required params are set.
if (id == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: id');
}
final path = r'/api/Resource/{id}'
.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<MultipartFile> resourceShow(String id) async {
final response = await resourceShowWithHttpInfo(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), 'MultipartFile') as MultipartFile;
}
return Future<MultipartFile>.value(null);
}
/// Performs an HTTP 'PUT /api/Resource' operation and returns the [Response].
/// Parameters:
///
/// * [ResourceDetailDTO] resourceDetailDTO (required):
Future<Response> resourceUpdateWithHttpInfo(ResourceDetailDTO resourceDetailDTO) async {
// Verify required params are set.
if (resourceDetailDTO == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: resourceDetailDTO');
}
final path = r'/api/Resource';
Object postBody = resourceDetailDTO;
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,
'PUT',
queryParams,
postBody,
headerParams,
formParams,
nullableContentType,
authNames,
);
}
/// Parameters:
///
/// * [ResourceDetailDTO] resourceDetailDTO (required):
Future<ResourceDetailDTO> resourceUpdate(ResourceDetailDTO resourceDetailDTO) async {
final response = await resourceUpdateWithHttpInfo(resourceDetailDTO);
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), 'ResourceDetailDTO') as ResourceDetailDTO;
}
return Future<ResourceDetailDTO>.value(null);
}
/// Performs an HTTP 'POST /api/Resource/upload' operation and returns the [Response].
/// Parameters:
///
/// * [String] label:
///
/// * [String] type:
Future<Response> resourceUploadWithHttpInfo({ String label, String type }) async {
// Verify required params are set.
final path = r'/api/Resource/upload';
Object postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
final contentTypes = <String>['multipart/form-data'];
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 (label != null) {
hasFields = true;
mp.fields[r'label'] = parameterToString(label);
}
if (type != null) {
hasFields = true;
mp.fields[r'type'] = parameterToString(type);
}
if (hasFields) {
postBody = mp;
}
} else {
if (label != null) {
formParams[r'label'] = parameterToString(label);
}
if (type != null) {
formParams[r'type'] = parameterToString(type);
}
}
return await apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
nullableContentType,
authNames,
);
}
/// Parameters:
///
/// * [String] label:
///
/// * [String] type:
Future<String> resourceUpload({ String label, String type }) async {
final response = await resourceUploadWithHttpInfo( label: label, type: type );
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);
}
}

View File

@ -166,12 +166,12 @@ class ApiClient {
return DeviceDetailDTOAllOf.fromJson(value);
case 'LoginDTO':
return LoginDTO.fromJson(value);
case 'RessourceDTO':
return RessourceDTO.fromJson(value);
case 'RessourceDetailDTO':
return RessourceDetailDTO.fromJson(value);
case 'RessourceType':
return RessourceTypeTypeTransformer().decode(value);
case 'ResourceDTO':
return ResourceDTO.fromJson(value);
case 'ResourceDetailDTO':
return ResourceDetailDTO.fromJson(value);
case 'ResourceType':
return ResourceTypeTypeTransformer().decode(value);
case 'SectionDTO':
return SectionDTO.fromJson(value);

View File

@ -58,8 +58,8 @@ String parameterToString(dynamic value) {
if (value is DateTime) {
return value.toUtc().toIso8601String();
}
if (value is RessourceType) {
return RessourceTypeTypeTransformer().encode(value).toString();
if (value is ResourceType) {
return ResourceTypeTypeTransformer().encode(value).toString();
}
if (value is SectionType) {
return SectionTypeTypeTransformer().encode(value).toString();

View File

@ -0,0 +1,109 @@
//
// 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 ResourceDetailDTO {
/// Returns a new [ResourceDetailDTO] instance.
ResourceDetailDTO({
this.id,
this.type,
this.label,
this.dateCreation,
this.data,
});
String id;
ResourceType type;
String label;
DateTime dateCreation;
String data;
@override
bool operator ==(Object other) => identical(this, other) || other is ResourceDetailDTO &&
other.id == id &&
other.type == type &&
other.label == label &&
other.dateCreation == dateCreation &&
other.data == data;
@override
int get hashCode =>
(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() => 'ResourceDetailDTO[id=$id, type=$type, label=$label, dateCreation=$dateCreation, data=$data]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (id != null) {
json[r'id'] = id;
}
if (type != null) {
json[r'type'] = type;
}
if (label != null) {
json[r'label'] = label;
}
if (dateCreation != null) {
json[r'dateCreation'] = dateCreation.toUtc().toIso8601String();
}
if (data != null) {
json[r'data'] = data;
}
return json;
}
/// Returns a new [ResourceDetailDTO] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static ResourceDetailDTO fromJson(Map<String, dynamic> json) => json == null
? null
: ResourceDetailDTO(
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'],
);
static List<ResourceDetailDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <ResourceDetailDTO>[]
: json.map((v) => ResourceDetailDTO.fromJson(v)).toList(growable: true == growable);
static Map<String, ResourceDetailDTO> mapFromJson(Map<String, dynamic> json) {
final map = <String, ResourceDetailDTO>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = ResourceDetailDTO.fromJson(v));
}
return map;
}
// maps a json object with a list of ResourceDetailDTO-objects as value to a dart map
static Map<String, List<ResourceDetailDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<ResourceDetailDTO>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = ResourceDetailDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}

View File

@ -0,0 +1,89 @@
//
// 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 ResourceDTO {
/// Returns a new [ResourceDTO] instance.
ResourceDTO({
this.id,
this.type,
this.label,
});
String id;
ResourceType type;
String label;
@override
bool operator ==(Object other) => identical(this, other) || other is ResourceDTO &&
other.id == id &&
other.type == type &&
other.label == label;
@override
int get hashCode =>
(id == null ? 0 : id.hashCode) +
(type == null ? 0 : type.hashCode) +
(label == null ? 0 : label.hashCode);
@override
String toString() => 'ResourceDTO[id=$id, type=$type, label=$label]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (id != null) {
json[r'id'] = id;
}
if (type != null) {
json[r'type'] = type;
}
if (label != null) {
json[r'label'] = label;
}
return json;
}
/// Returns a new [ResourceDTO] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static ResourceDTO fromJson(Map<String, dynamic> json) => json == null
? null
: ResourceDTO(
id: json[r'id'],
type: ResourceType.fromJson(json[r'type']),
label: json[r'label'],
);
static List<ResourceDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <ResourceDTO>[]
: json.map((v) => ResourceDTO.fromJson(v)).toList(growable: true == growable);
static Map<String, ResourceDTO> mapFromJson(Map<String, dynamic> json) {
final map = <String, ResourceDTO>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = ResourceDTO.fromJson(v));
}
return map;
}
// maps a json object with a list of ResourceDTO-objects as value to a dart map
static Map<String, List<ResourceDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<ResourceDTO>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = ResourceDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}

View File

@ -0,0 +1,82 @@
//
// 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 ResourceType {
/// Instantiate a new enum with the provided [value].
const ResourceType._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const image = ResourceType._(r'Image');
static const video = ResourceType._(r'Video');
static const imageUrl = ResourceType._(r'ImageUrl');
static const videoUrl = ResourceType._(r'VideoUrl');
/// List of all possible values in this [enum][ResourceType].
static const values = <ResourceType>[
image,
video,
imageUrl,
videoUrl,
];
static ResourceType fromJson(dynamic value) =>
ResourceTypeTypeTransformer().decode(value);
static List<ResourceType> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <ResourceType>[]
: json
.map((value) => ResourceType.fromJson(value))
.toList(growable: true == growable);
}
/// Transformation class that can [encode] an instance of [ResourceType] to String,
/// and [decode] dynamic data back to [ResourceType].
class ResourceTypeTypeTransformer {
const ResourceTypeTypeTransformer._();
factory ResourceTypeTypeTransformer() => _instance ??= ResourceTypeTypeTransformer._();
String encode(ResourceType data) => data.value;
/// Decodes a [dynamic value][data] to a ResourceType.
///
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
///
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
/// and users are still using an old app with the old code.
ResourceType decode(dynamic data, {bool allowNull}) {
switch (data) {
case r'Image': return ResourceType.image;
case r'Video': return ResourceType.video;
case r'ImageUrl': return ResourceType.imageUrl;
case r'VideoUrl': return ResourceType.videoUrl;
default:
if (allowNull == false) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
return null;
}
/// Singleton [ResourceTypeTypeTransformer] instance.
static ResourceTypeTypeTransformer _instance;
}

View File

@ -350,11 +350,11 @@ paths:
type: string
security:
- bearer: []
/api/Ressource:
/api/Resource:
get:
tags:
- Ressource
operationId: Ressource_Get
- Resource
operationId: Resource_Get
responses:
'200':
description: ''
@ -363,7 +363,7 @@ paths:
schema:
type: array
items:
$ref: '#/components/schemas/RessourceDTO'
$ref: '#/components/schemas/ResourceDTO'
'500':
description: ''
content:
@ -374,14 +374,14 @@ paths:
- bearer: []
post:
tags:
- Ressource
operationId: Ressource_Create
- Resource
operationId: Resource_Create
requestBody:
x-name: newRessource
x-name: newResource
content:
application/json:
schema:
$ref: '#/components/schemas/RessourceDetailDTO'
$ref: '#/components/schemas/ResourceDetailDTO'
required: true
x-position: 1
responses:
@ -390,7 +390,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/RessourceDetailDTO'
$ref: '#/components/schemas/ResourceDetailDTO'
'400':
description: ''
content:
@ -413,14 +413,14 @@ paths:
- bearer: []
put:
tags:
- Ressource
operationId: Ressource_Update
- Resource
operationId: Resource_Update
requestBody:
x-name: updatedRessource
x-name: updatedResource
content:
application/json:
schema:
$ref: '#/components/schemas/RessourceDetailDTO'
$ref: '#/components/schemas/ResourceDetailDTO'
required: true
x-position: 1
responses:
@ -429,7 +429,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/RessourceDetailDTO'
$ref: '#/components/schemas/ResourceDetailDTO'
'400':
description: ''
content:
@ -450,11 +450,11 @@ paths:
type: string
security:
- bearer: []
'/api/Ressource/{id}/detail':
'/api/Resource/{id}/detail':
get:
tags:
- Ressource
operationId: Ressource_GetDetail
- Resource
operationId: Resource_GetDetail
parameters:
- name: id
in: path
@ -469,7 +469,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/RessourceDetailDTO'
$ref: '#/components/schemas/ResourceDetailDTO'
'404':
description: ''
content:
@ -482,11 +482,11 @@ paths:
application/json:
schema:
type: string
'/api/Ressource/{id}':
'/api/Resource/{id}':
get:
tags:
- Ressource
operationId: Ressource_Show
- Resource
operationId: Resource_Show
parameters:
- name: id
in: path
@ -517,8 +517,8 @@ paths:
type: string
delete:
tags:
- Ressource
operationId: Ressource_Delete
- Resource
operationId: Resource_Delete
parameters:
- name: id
in: path
@ -554,6 +554,41 @@ paths:
type: string
security:
- bearer: []
/api/Resource/upload:
post:
tags:
- Resource
operationId: Resource_Upload
requestBody:
content:
multipart/form-data:
schema:
properties:
label:
type: string
nullable: true
type:
type: string
nullable: true
responses:
'200':
description: ''
content:
application/json:
schema:
type: string
'404':
description: ''
content:
application/json:
schema:
type: string
'500':
description: ''
content:
application/json:
schema:
type: string
/api/Section:
get:
tags:
@ -1146,7 +1181,7 @@ components:
lastBatteryLevel:
type: string
format: date-time
RessourceDTO:
ResourceDTO:
type: object
additionalProperties: false
properties:
@ -1154,11 +1189,11 @@ components:
type: string
nullable: true
type:
$ref: '#/components/schemas/RessourceType'
$ref: '#/components/schemas/ResourceType'
label:
type: string
nullable: true
RessourceType:
ResourceType:
type: string
description: ''
x-enumNames:
@ -1171,7 +1206,7 @@ components:
- Video
- ImageUrl
- VideoUrl
RessourceDetailDTO:
ResourceDetailDTO:
type: object
additionalProperties: false
properties:
@ -1179,7 +1214,7 @@ components:
type: string
nullable: true
type:
$ref: '#/components/schemas/RessourceType'
$ref: '#/components/schemas/ResourceType'
label:
type: string
nullable: true
@ -1343,8 +1378,8 @@ tags:
description: Configuration management
- name: Device
description: Device management
- name: Ressource
description: Ressource management
- name: Resource
description: Resource management
- name: Section
description: Section management
- name: User

View File

@ -0,0 +1,55 @@
//
// 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 ResourceApi
void main() {
final instance = ResourceApi();
group('tests for ResourceApi', () {
//Future<ResourceDetailDTO> resourceCreate(ResourceDetailDTO resourceDetailDTO) async
test('test resourceCreate', () async {
// TODO
});
//Future<String> resourceDelete(String id) async
test('test resourceDelete', () async {
// TODO
});
//Future<List<ResourceDTO>> resourceGet() async
test('test resourceGet', () async {
// TODO
});
//Future<ResourceDetailDTO> resourceGetDetail(String id) async
test('test resourceGetDetail', () async {
// TODO
});
//Future<MultipartFile> resourceShow(String id) async
test('test resourceShow', () async {
// TODO
});
//Future<ResourceDetailDTO> resourceUpdate(ResourceDetailDTO resourceDetailDTO) async
test('test resourceUpdate', () async {
// TODO
});
//Future<String> resourceUpload(ResourceDetailDTO resourceDetailDTO) async
test('test resourceUpload', () async {
// TODO
});
});
}

View File

@ -0,0 +1,46 @@
//
// 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 ResourceDetailDTO
void main() {
final instance = ResourceDetailDTO();
group('test ResourceDetailDTO', () {
// String id
test('to test the property `id`', () async {
// TODO
});
// RessourceType type
test('to test the property `type`', () async {
// TODO
});
// String label
test('to test the property `label`', () async {
// TODO
});
// DateTime dateCreation
test('to test the property `dateCreation`', () async {
// TODO
});
// String data
test('to test the property `data`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,36 @@
//
// 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 ResourceDTO
void main() {
final instance = ResourceDTO();
group('test ResourceDTO', () {
// String id
test('to test the property `id`', () async {
// TODO
});
// RessourceType type
test('to test the property `type`', () async {
// TODO
});
// String label
test('to test the property `label`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,20 @@
//
// 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 ResourceType
void main() {
group('test ResourceType', () {
});
}

View File

@ -8,6 +8,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0"
audio_video_progress_bar:
dependency: transitive
description:
name: audio_video_progress_bar
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.2"
auto_size_text:
dependency: "direct main"
description:
@ -64,6 +71,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
dart_vlc:
dependency: "direct main"
description:
name: dart_vlc
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.6"
fake_async:
dependency: transitive
description:
@ -78,13 +92,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
file_picker:
dependency: "direct main"
file:
dependency: transitive
description:
name: file_picker
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
version: "6.1.0"
filepicker_windows:
dependency: "direct main"
description:
@ -104,13 +118,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
flutter_test:
dependency: "direct dev"
description: flutter
@ -198,6 +205,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
pedantic:
dependency: transitive
description:
@ -205,6 +247,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
plugin_platform_interface:
dependency: transitive
description:
@ -212,6 +261,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.1"
provider:
dependency: "direct main"
description:
@ -287,6 +343,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
video_player:
dependency: "direct main"
description:
name: video_player
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
video_player_platform_interface:
dependency: transitive
description:
name: video_player_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
video_player_web:
dependency: transitive
description:
name: video_player_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
win32:
dependency: transitive
description:
@ -294,6 +371,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0"
flutter: ">=2.0.0"

View File

@ -33,6 +33,8 @@ dependencies:
convert: ^3.0.0
collection: any
filepicker_windows: ^2.0.0
dart_vlc: ^0.0.6
video_player: ^2.1.1
managerapi:
path: manager_api

View File

@ -6,6 +6,9 @@
#include "generated_plugin_registrant.h"
#include <dart_vlc/dart_vlc_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
DartVlcPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DartVlcPlugin"));
}

View File

@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
dart_vlc
)
set(PLUGIN_BUNDLED_LIBRARIES)