add login first request, update service generation, create main appbar + logic

This commit is contained in:
Fransolet Thomas 2022-04-09 22:08:11 +02:00
parent 2e3ada0eb3
commit 8a687ca076
76 changed files with 14724 additions and 4848 deletions

View File

@ -43,6 +43,7 @@ android {
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {
@ -50,6 +51,9 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
minifyEnabled true
shrinkResources true
debuggable false
}
}
}

View File

@ -2,7 +2,7 @@
package="be.myhomie.myhomie_app">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="myhomie_app"
android:label="MyHomie"
android:usesCleartextTraffic="true"
android:icon="@mipmap/ic_launcher">
<activity

View File

@ -0,0 +1,87 @@
import 'package:flutter/material.dart';
//import 'package:flutter_svg/svg.dart';
import 'package:myhomie_app/Screens/Main/MainPage.dart';
import 'package:myhomie_app/Screens/Main/index.dart';
import 'package:myhomie_app/constants.dart';
import 'package:provider/provider.dart';
import 'custom_clipper.dart';
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
final double _preferredHeight = 55;
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
final index = Provider.of<Index>(context);
final notchInset = MediaQuery.of(context).padding;
return Container(
alignment: Alignment.bottomCenter,
child: Stack(
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
/*Positioned(
top: -20,
left: -1,
child: SvgPicture.asset(
'assets/images/hungry/top_bar.svg',
width: size.width * 1.01,
)
),*/
Positioned(
bottom: 0,
child: ClipPath(
//clipper: WaveClipper(),
clipBehavior: Clip.hardEdge,
child: Container(
height: size.height * 0.4,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerRight,
end: Alignment.centerLeft,
colors: [
/*Color(0xFFDD79C2),
Color(0xFFB65FBE),
Color(0xFF9146BA),
Color(0xFF7633B8),
Color(0xFF6528B6),
Color(0xFF6025B6)*/
Color(0xFF306bac),
Color(0xFF308aae),
Color(0xFF309cb0),
],
),
),
),
),
),
Positioned.fill(
child: Padding(
padding: EdgeInsets.only(top: notchInset.top + 10),
child: Align(
alignment: Alignment.topCenter,
child: Text(
index.getTitle(),
style: kHeadingTextStyle,
),
),
),
),
/*IconButton(icon: Icon(Icons.menu), onPressed: () {}),
Text(
getPageTitle(),
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
),
IconButton(icon: Icon(Icons.favorite), onPressed: () {}),*/
],
),
);
}
@override
Size get preferredSize => Size.fromHeight(_preferredHeight);
getPageTitle() {
return currentIndex == 0 ? 'MyHomie' : 'other';
}
}

View File

@ -0,0 +1,131 @@
import 'package:flutter/material.dart';
import 'package:myhomie_app/Screens/Main/MainPage.dart';
import 'package:myhomie_app/constants.dart';
import 'custom_nav_item.dart';
class CustomBottomNavigationBar extends StatefulWidget {
@override
_CustomBottomNavigationBarState createState() =>
_CustomBottomNavigationBarState();
}
class _CustomBottomNavigationBarState extends State<CustomBottomNavigationBar> {
setPage() {
setState(() {
pageController.jumpToPage(currentIndex);
});
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return BottomAppBar( //bottom navigation bar on scaffold
color: kMainColor,
shape: CircularNotchedRectangle(), //shape of notch
notchMargin: 5, //notche margin between floating button and bottom appbar
child: Container(
/*decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
/*Color(0xFFDD79C2),
Color(0xFFB65FBE),
Color(0xFF9146BA),
Color(0xFF7633B8),
Color(0xFF6528B6),
Color(0xFF6025B6)*/
Color(0xFF306bac),
Color(0xFF308aae),
Color(0xFF309cb0),
],
),
),*/
child: Row( //children inside bottom appbar
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
width: size.width *0.4,
//color: Colors.greenAccent,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
CustomNavItem(setPage: setPage, icon: NavItemIcon.security, id: 1),
CustomNavItem(setPage: setPage, icon: NavItemIcon.automations, id: 2),
],
),
),
SizedBox(width: size.width *0.2, /*child: Container(color: Colors.green,)*/),
Container(
width: size.width *0.4,
//color: Colors.greenAccent,
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
CustomNavItem(setPage: setPage, icon: NavItemIcon.energy, id: 3),
CustomNavItem(setPage: setPage, icon: NavItemIcon.profile, id: 4),
],
),
),
],
),
),
);/*;*/
}
}
/*
SizedBox(
height: 75,
child: Material(
color: Colors.green,
child: Stack(
children: <Widget>[
Positioned(
bottom: 0,
child: Container(
height: size.height * 0.4,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
/*Color(0xFFDD79C2),
Color(0xFFB65FBE),
Color(0xFF9146BA),
Color(0xFF7633B8),
Color(0xFF6528B6),
Color(0xFF6025B6)*/
Color(0xFF306bac),
Color(0xFF308aae),
Color(0xFF309cb0),
],
),
),
),
),
Positioned(
bottom: 10,
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
CustomNavItem(setPage: setPage, icon: NavItemIcon.home, id: 0),
CustomNavItem(setPage: setPage, icon: NavItemIcon.security, id: 1),
CustomNavItem(setPage: setPage, icon: NavItemIcon.energy, id: 2),
CustomNavItem(setPage: setPage, icon: NavItemIcon.health, id: 3),
//CustomNavItem(setPage: setPage, icon: NavItemIcon.profile, id: 4),
],
),
),
],
),
),
)
* */

View File

@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
class WaveClipper extends CustomClipper<Path> {
@override
Path getClip(Size size) {
var controlPoint1 = Offset(size.width *0.2, size.height*0.75);
var controlPoint2 = Offset(size.width *0.55, size.height*0.76);
var endPoint = Offset(size.width *0.62, size.height*0.79);
var controlPoint12 = Offset(size.width *0.82, size.height*0.85);
var controlPoint21 = Offset(size.width *0.93, size.height*1.09);
var endPoint1 = Offset(size.width, size.height*0.78);
Path path = Path()
..lineTo(0, size.height)
..cubicTo(controlPoint1.dx, controlPoint1.dy, controlPoint2.dx,
controlPoint2.dy, endPoint.dx, endPoint.dy)
..cubicTo(controlPoint12.dx, controlPoint12.dy, controlPoint21.dx,
controlPoint21.dy, endPoint1.dx, endPoint1.dy)
//..lineTo(size.width, size.height)
..lineTo(size.width, 0)
..close();
return path;
}
@override
bool shouldReclip(CustomClipper<Path> oldClipper) => false;
}

View File

@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:flare_flutter/flare_actor.dart';
import 'package:myhomie_app/Screens/Main/MainPage.dart';
import 'package:myhomie_app/Screens/Main/index.dart';
import 'package:provider/provider.dart';
class CustomNavItem extends StatelessWidget {
final NavItemIcon icon;
final int id;
final Function setPage;
const CustomNavItem({this.setPage, this.icon, this.id});
@override
Widget build(BuildContext context) {
final index = Provider.of<Index>(context);
Size size = MediaQuery.of(context).size;
return GestureDetector(
onTap: () {
currentIndex = id;
index.setIndex(currentIndex);
setPage();
},
child: Container(
width: 50,
height: 50,
child: getIconSvg(icon, size.width * 0.1, index.getIndex()),
),
);
}
getIconSvg(NavItemIcon icon, double size, int index) {
switch(icon.name) {
case 'home':
return Icon(
Icons.home,
size: 25,
color: Colors.white,
);
case 'security':
return Icon(
Icons.security,
size: 25,
color: Colors.white,
);
case 'automations':
return Icon(
Icons.cable_rounded,
size: 25,
color: Colors.white,
);
case 'energy':
return Icon(
Icons.power,
size: 25,
color: Colors.white,
);
case 'profile': //Todo show user image ?
return Icon(
Icons.person,
size: 25,
color: Colors.white,
);
}
//return new FlareActor("assets/animations/bottom_navigation/"+ icon.toString().split(".").last +".flr", alignment:Alignment.center, fit:BoxFit.contain, animation: index == icon.index ? "Selected" : "Unselected"); //icon.index
}
}
enum NavItemIcon { home, security, automations, energy, profile }

View File

@ -0,0 +1,22 @@
import 'package:flare_flutter/flare_actor.dart';
import 'package:flutter/material.dart';
class Loading extends StatelessWidget {
Loading({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Container(
width: size.width,
height: size.height,
color: Colors.transparent,
child: FlareActor(
'assets/animations/MDLF_animation.flr',
alignment: Alignment.center,
fit: BoxFit.scaleDown,
animation: 'Rotate',
),
);
}
}

View File

@ -10,8 +10,7 @@ class DatabaseHelper {
static final table = 'homieAppContext';
static final columnId = 'id';
static final columnUserId = 'deviceId';
static final columnUserId = 'userId';
static final columnHomeId = 'homeId';
static final columnToken = 'token';
static final columnHost = 'host';
@ -37,44 +36,43 @@ class DatabaseHelper {
Future _onCreate(Database db, int version) async {
await db.execute('''
CREATE TABLE $table (
$columnId TEXT NOT NULL PRIMARY KEY,
$columnUserId TEXT NOT NULL,
$columnToken TEXT NOT NULL,
$columnHomeId TEXT NOT NULL,
$columnUserId TEXT NOT NULL PRIMARY KEY,
$columnHomeId TEXT,
$columnHost TEXT NOT NULL,
$columnLanguage TEXT NOT NULL
$columnLanguage TEXT NOT NULL,
$columnToken TEXT NOT NULL
)
''');
}
Future<int> insert(HomieAppContext tabletAppContext) async {
Future<int> insert(HomieAppContext homieAppContext) async {
Database db = await instance.database;
var res = await db.insert(table, tabletAppContext.toMap());
var res = await db.insert(table, homieAppContext.toMap());
return res;
}
Future<void> update(HomieAppContext tabletAppContext) async {
Future<void> update(HomieAppContext homieAppContext) async {
// Get a reference to the database.
final db = await instance.database;
await db.update(
'tabletAppContext',
tabletAppContext.toMap(),
where: "id = ?",
whereArgs: [tabletAppContext.id],
'homieAppContext',
homieAppContext.toMap(),
where: "$columnHomeId = ?",
whereArgs: [homieAppContext.userId],
);
}
Future<List<Map<String, dynamic>>> queryAllRows() async {
Database db = await instance.database;
var res = await db.query(table, orderBy: "$columnId DESC");
var res = await db.query(table, orderBy: "$columnUserId DESC");
return res;
}
Future<int> delete(String email) async {
Future<int> delete(String userId) async {
Database db = await instance.database;
return await db.delete(table, where: '$columnId = ?', whereArgs: [email]);
return await db.delete(table, where: '$columnUserId = ?', whereArgs: [userId]);
}
Future<void> clearTable() async {
@ -90,11 +88,10 @@ class DatabaseHelper {
print("DB - CONTEXT --- ");
homieAppContext = HomieAppContext(
id: element["id"],
userId: element["userId"],
homeId: element["homeId"],
token: element["token"],
host: element["host"],
homeId: element["homeId"],
language: element["language"]
);
});

View File

@ -5,6 +5,7 @@ import 'package:mqtt_client/mqtt_client.dart';
import 'package:mqtt_client/mqtt_server_client.dart';
import 'package:myhomie_app/Models/homieContext.dart';
import 'package:myhomie_app/app_context.dart';
import 'package:uuid/uuid.dart';
class MQTTHelper {
@ -74,8 +75,10 @@ class MQTTHelper {
homieAppContext = new HomieAppContext(host: '192.168.31.140', userId: 'TODO');
} // TO DEBUG
print(homieAppContext.host);
if(homieAppContext.host != null) {
homieAppContext.clientMQTT = MqttServerClient.withPort(homieAppContext.host.replaceAll('http://', ''), 'homie_app_'+homieAppContext.userId, 1883);
homieAppContext.clientMQTT = MqttServerClient.withPort(homieAppContext.host.replaceAll('http://', ''), 'homie_app_'+ Uuid().v1(), 1883);
isInstantiated = true;
homieAppContext.clientMQTT.logging(on: false);
@ -89,6 +92,8 @@ class MQTTHelper {
"connected": false
};
print("Try connect mqtt");
final connMessage = MqttConnectMessage().authenticateAs('user', 'user') // TODO ONLINE
.keepAliveFor(60)
.withWillTopic('player/status')
@ -101,7 +106,6 @@ class MQTTHelper {
homieAppContext.clientMQTT.autoReconnect = true;
try {
await homieAppContext.clientMQTT.connect();
} catch (e) {
print('Exception: $e');
homieAppContext.clientMQTT.disconnect();

View File

@ -8,19 +8,16 @@ import 'package:myhomie_app/client.dart';
class HomieAppContext with ChangeNotifier{
Client clientAPI;
MqttServerClient clientMQTT;
String id;
String host;
String language;
String userId;
String homeId;
String token;
String host;
String language;
HomieAppContext({this.id, this.userId, this.homeId, this.host, this.language, this.token});
HomieAppContext({this.userId, this.homeId, this.host, this.language, this.token});
Map<String, dynamic> toMap() {
return {
'id': id,
'userId': userId,
'homeId': homeId,
'host': host,
@ -31,7 +28,6 @@ class HomieAppContext with ChangeNotifier{
factory HomieAppContext.fromJson(Map<String, dynamic> json) {
return new HomieAppContext(
id: json['id'] as String,
userId: json['userId'] as String,
host: json['host'] as String,
homeId: json['homeId'] as String,
@ -43,6 +39,6 @@ class HomieAppContext with ChangeNotifier{
// Implement toString to make it easier to see information about
@override
String toString() {
return 'TabletAppContext{id: $id, userId: $userId, homeId: $homeId, language: $language, host: $host}';
return 'TabletAppContext{userId: $userId, homeId: $homeId, language: $language, host: $host}';
}
}

View File

@ -1,15 +1,19 @@
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:mqtt_client/mqtt_server_client.dart';
import 'package:mycoreapi/api.dart';
import 'package:myhomie_app/Components/Buttons/rounded_button.dart';
import 'package:myhomie_app/Components/rounded_input_field.dart';
import 'package:myhomie_app/Components/rounded_password_field.dart';
import 'package:myhomie_app/Models/homieContext.dart';
import 'package:myhomie_app/Screens/Home/HomePage.dart';
import 'package:myhomie_app/Screens/Main/MainPage.dart';
import 'package:myhomie_app/Screens/Login/components/background.dart';
import 'package:myhomie_app/app_context.dart';
import 'package:myhomie_app/client.dart';
import 'package:provider/provider.dart';
import 'package:uuid/uuid.dart';
import '../../../Helpers/DatabaseHelper.dart';
class Body extends StatefulWidget {
@ -23,7 +27,7 @@ class Body extends StatefulWidget {
class _BodyState extends State<Body> {
final clientAPI = Client('http://192.168.31.140'); // TODO field
TokenDTO token;
@override
Widget build(BuildContext context) {
final appContext = Provider.of<AppContext>(context);
@ -57,19 +61,50 @@ class _BodyState extends State<Body> {
var connected = await authenticateTRY();
if (connected) {
HomieAppContext homieAppContext = new HomieAppContext();
UserInfoDetailDTO user = await clientAPI.userApi.userGet("6182c472e20a6dbcfe8fe82c"); // TO replace user get by email
homieAppContext.host = "http://192.168.31.140";// TODO
homieAppContext.clientMQTT = new MqttServerClient(homieAppContext.host.replaceAll('http://', ''),'tablet_app_'+'TODODODO');
// homieAppContext.clientAPI = client; // TODO
homieAppContext.userId = "TODO"; // TODO
homieAppContext.clientMQTT = new MqttServerClient(homieAppContext.host.replaceAll('http://', ''),'my_homie_app_'+ Uuid().v1());
homieAppContext.clientAPI = clientAPI;
homieAppContext.userId = user.id;
homieAppContext.language = user.language;
homieAppContext.token = token.accessToken;
// TODO check if we select by default or ask user to select
if(user.homeIds.length > 0) {
homieAppContext.homeId = user.homeIds.first;
} else {
// TODO invite home creation
}
setState(() {
appContext.setContext(homieAppContext);
});
// STORE IT LOCALLY (SQLite)
HomieAppContext localContext = await DatabaseHelper.instance.getData();
if (localContext != null) { // Check if sql DB exist
await DatabaseHelper.instance.update(homieAppContext);
} else {
await DatabaseHelper.instance.insert(homieAppContext);
}
Fluttertoast.showToast(
msg: "Connexion réussie",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.lightGreen,
textColor: Colors.white,
fontSize: 16.0
);
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) {
return HomePage();
return MainPage();
},
),
(Route<dynamic> route) => false
@ -106,7 +141,7 @@ class _BodyState extends State<Body> {
try {
//LoginDTO loginDTO = new LoginDTO(email: "test@email.be", password: "kljqsdkljqsd");
LoginDTO loginDTO = new LoginDTO(email: "", password: "");
TokenDTO token = await clientAPI.authenticationApi.authenticationAuthenticateWithJson(loginDTO);
token = await clientAPI.authenticationApi.authenticationAuthenticateWithJson(loginDTO);
print("Token ??");
print(token);
print(token.accessToken);

View File

@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:myhomie_app/app_context.dart';
import 'package:provider/provider.dart';
class AutomationsScreen extends StatefulWidget {
AutomationsScreen({Key key}) : super(key: key);
@override
_AutomationsScreenState createState() => _AutomationsScreenState();
}
class _AutomationsScreenState extends State<AutomationsScreen> {
bool isLoading = true;
//List<Message> messages;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
return interfaceElements();
/*if(appContext.getContext().feed != null) {
return interfaceElements();
} else {
return FutureBuilder(
future: Message.getMessages(this.messages, appContext, false, true),
builder: (context, AsyncSnapshot<List<Message>> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return interfaceElements();
} else if (snapshot.connectionState == ConnectionState.none) {
print('ConnectionState.none');
return Text("No data");
} else {
return Container(height: size.height * 0.2, child: Loading());
}
}
);
}*/
}
interfaceElements() {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
return RefreshIndicator(
color: Theme.of(context).primaryColor,
displacement: 20,
onRefresh: () async {
print("TODO refresh");
//await Message.getMessages(this.messages, appContext, true, true);
},
child: Container(
height: size.height * 0.8,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("TODO Automations")
],
),
),
),
);
}
}

View File

@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:myhomie_app/app_context.dart';
import 'package:provider/provider.dart';
class EnergyScreen extends StatefulWidget {
EnergyScreen({Key key}) : super(key: key);
@override
_EnergyScreenState createState() => _EnergyScreenState();
}
class _EnergyScreenState extends State<EnergyScreen> {
bool isLoading = true;
//List<Message> messages;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
return interfaceElements();
/*if(appContext.getContext().feed != null) {
return interfaceElements();
} else {
return FutureBuilder(
future: Message.getMessages(this.messages, appContext, false, true),
builder: (context, AsyncSnapshot<List<Message>> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return interfaceElements();
} else if (snapshot.connectionState == ConnectionState.none) {
print('ConnectionState.none');
return Text("No data");
} else {
return Container(height: size.height * 0.2, child: Loading());
}
}
);
}*/
}
interfaceElements() {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
return RefreshIndicator(
color: Theme.of(context).primaryColor,
displacement: 20,
onRefresh: () async {
print("TODO refresh");
//await Message.getMessages(this.messages, appContext, true, true);
},
child: Container(
height: size.height * 0.8,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("TODO Energy")
],
),
),
),
);
}
}

View File

@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:myhomie_app/app_context.dart';
import 'package:provider/provider.dart';
class HomeScreen extends StatefulWidget {
HomeScreen({Key key}) : super(key: key);
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
bool isLoading = true;
//List<Message> messages;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
return interfaceElements();
/*if(appContext.getContext().feed != null) {
return interfaceElements();
} else {
return FutureBuilder(
future: Message.getMessages(this.messages, appContext, false, true),
builder: (context, AsyncSnapshot<List<Message>> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return interfaceElements();
} else if (snapshot.connectionState == ConnectionState.none) {
print('ConnectionState.none');
return Text("No data");
} else {
return Container(height: size.height * 0.2, child: Loading());
}
}
);
}*/
}
interfaceElements() {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
return RefreshIndicator(
color: Theme.of(context).primaryColor,
displacement: 20,
onRefresh: () async {
print("TODO refresh");
//await Message.getMessages(this.messages, appContext, true, true);
},
child: Container(
height: size.height * 0.8,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("TODO Home - coucou test")
],
),
),
),
);
}
}

View File

@ -2,31 +2,48 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:mqtt_client/mqtt_client.dart';
import 'package:mqtt_client/mqtt_server_client.dart';
import 'package:mycoreapi/api.dart';
import 'package:myhomie_app/Components/Custom_Navigation_Bar/custom_app_bar.dart';
import 'package:myhomie_app/Components/Custom_Navigation_Bar/custom_bottom_navigation_bar.dart';
import 'package:myhomie_app/Components/Custom_Navigation_Bar/custom_nav_item.dart';
import 'package:myhomie_app/Helpers/MQTTHelper.dart';
import 'package:myhomie_app/Screens/Debug/DebugPage.dart';
import 'package:myhomie_app/Screens/Main/Automations/automations.dart';
import 'package:myhomie_app/app_context.dart';
import 'package:myhomie_app/client.dart';
import 'package:myhomie_app/constants.dart';
import 'package:provider/provider.dart';
import '../../Models/homieContext.dart';
import 'Energy/energy.dart';
import 'Home/home.dart';
import 'Profile/profile.dart';
import 'Security/security.dart';
import 'index.dart';
class HomePage extends StatefulWidget {
HomePage({Key key}) : super(key: key);
PageController pageController = PageController(initialPage: 0);
int currentIndex = 0;
class MainPage extends StatefulWidget {
MainPage({Key key}) : super(key: key);
@override
_HomePageState createState() => _HomePageState();
_MainPageState createState() => _MainPageState();
}
class _HomePageState extends State<HomePage> {
class _MainPageState extends State<MainPage> {
int _counter = 0;
final MqttServerClient client = MqttServerClient.withPort('192.168.31.140', 'flutter_client', 1883); // TODO Add switch button or check online connexion if local broker available
setPage() {
setState(() {
pageController.jumpToPage(currentIndex);
});
}
//final MqttServerClient client = MqttServerClient.withPort('myhomie.be', 'flutter_client00', 1883); // TODO ONLINE
void _incrementCounter() {
/*void _incrementCounter() {
setState(() {
_counter++;
@ -38,10 +55,10 @@ class _HomePageState extends State<HomePage> {
client.publishMessage(pubTopic, MqttQos.atLeastOnce, builder.payload);
}
});
}
}*/
// connection succeeded
void onConnected() {
/* void onConnected() {
print('Connected !!!!!!!!!!!! ----------------------------------');
client.updates.listen((List<MqttReceivedMessage<MqttMessage>> c) {
@ -109,7 +126,7 @@ class _HomePageState extends State<HomePage> {
return client;
return null;
}
}*/
@override
Widget build(BuildContext context) {
@ -124,90 +141,90 @@ class _HomePageState extends State<HomePage> {
HomieAppContext homieAppContext = appContext.getContext();
return Scaffold(
appBar: AppBar(
title: Text("HomePage TODO"),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
return ChangeNotifierProvider<Index>(
create: (_) => Index(0, appContext.getContext()),
child: Scaffold(
extendBody: true,
appBar: CustomAppBar(),
body: PageView(
physics: NeverScrollableScrollPhysics(),
controller: pageController,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
HomeScreen(),
SecurityScreen(),
AutomationsScreen(),
EnergyScreen(),
ProfileScreen(),
],
),
),
drawer: Drawer(
child: ListView(
// Important: Remove any padding from the ListView.
padding: EdgeInsets.zero,
children: [
const DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
drawer: Drawer(
child: ListView(
// Important: Remove any padding from the ListView.
padding: EdgeInsets.zero,
children: [
const DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Text('Drawer Header'),
),
child: Text('Drawer Header'),
),
ListTile(
title: const Text('Debug screen'),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return DebugPage();
},
)
);
},
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
var message = {
"userId": homieAppContext.userId,
"width": size.width,
"height": size.height,
"action": "button0"
};
const pubTopic = 'rpiZero/test';
final builder = MqttClientPayloadBuilder();
builder.addString(jsonEncode(message));
homieAppContext.clientMQTT.publishMessage(pubTopic, MqttQos.atLeastOnce, builder.payload);
var message2 = {
"state": "toggle"
};
const pubTopic2 = 'zigbee2mqtt/GU10Bureau/set';
final builder2 = MqttClientPayloadBuilder();
builder2.addString(jsonEncode(message2));
homieAppContext.clientMQTT.publishMessage(pubTopic2, MqttQos.atLeastOnce, builder2.payload);
/*Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return DebugPage();
ListTile(
title: const Text('Debug screen'),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return DebugPage();
},
)
);
},
)
)*/
},
tooltip: 'Increment',
child: Icon(Icons.add),
),
],
),
),
floatingActionButton: FloatingActionButton(
backgroundColor: kMainColor,
onPressed: () {
var message = {
"userId": homieAppContext.userId,
"width": size.width,
"height": size.height,
"action": "button0"
};
const pubTopic = 'rpiZero/test';
final builder = MqttClientPayloadBuilder();
builder.addString(jsonEncode(message));
homieAppContext.clientMQTT.publishMessage(pubTopic, MqttQos.atLeastOnce, builder.payload);
var message2 = {
"state": "toggle"
};
const pubTopic2 = 'zigbee2mqtt/GU10Bureau/set';
final builder2 = MqttClientPayloadBuilder();
builder2.addString(jsonEncode(message2));
homieAppContext.clientMQTT.publishMessage(pubTopic2, MqttQos.atLeastOnce, builder2.payload);
/*Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return DebugPage();
},
)
)*/
},
child: CustomNavItem(setPage: setPage, icon: NavItemIcon.home, id: 0),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: CustomBottomNavigationBar(),
),
);
}

View File

@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:myhomie_app/app_context.dart';
import 'package:provider/provider.dart';
class ProfileScreen extends StatefulWidget {
ProfileScreen({Key key}) : super(key: key);
@override
_ProfileScreenState createState() => _ProfileScreenState();
}
class _ProfileScreenState extends State<ProfileScreen> {
bool isLoading = true;
//List<Message> messages;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
return interfaceElements();
/*if(appContext.getContext().feed != null) {
return interfaceElements();
} else {
return FutureBuilder(
future: Message.getMessages(this.messages, appContext, false, true),
builder: (context, AsyncSnapshot<List<Message>> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return interfaceElements();
} else if (snapshot.connectionState == ConnectionState.none) {
print('ConnectionState.none');
return Text("No data");
} else {
return Container(height: size.height * 0.2, child: Loading());
}
}
);
}*/
}
interfaceElements() {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
return RefreshIndicator(
color: Theme.of(context).primaryColor,
displacement: 20,
onRefresh: () async {
print("TODO refresh");
//await Message.getMessages(this.messages, appContext, true, true);
},
child: Container(
height: size.height * 0.8,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("TODO Profile")
],
),
),
),
);
}
}

View File

@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:myhomie_app/app_context.dart';
import 'package:provider/provider.dart';
class SecurityScreen extends StatefulWidget {
SecurityScreen({Key key}) : super(key: key);
@override
_SecurityScreenState createState() => _SecurityScreenState();
}
class _SecurityScreenState extends State<SecurityScreen> {
bool isLoading = true;
//List<Message> messages;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
return interfaceElements();
/*if(appContext.getContext().feed != null) {
return interfaceElements();
} else {
return FutureBuilder(
future: Message.getMessages(this.messages, appContext, false, true),
builder: (context, AsyncSnapshot<List<Message>> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return interfaceElements();
} else if (snapshot.connectionState == ConnectionState.none) {
print('ConnectionState.none');
return Text("No data");
} else {
return Container(height: size.height * 0.2, child: Loading());
}
}
);
}*/
}
interfaceElements() {
Size size = MediaQuery.of(context).size;
final appContext = Provider.of<AppContext>(context);
return RefreshIndicator(
color: Theme.of(context).primaryColor,
displacement: 20,
onRefresh: () async {
print("TODO refresh");
//await Message.getMessages(this.messages, appContext, true, true);
},
child: Container(
height: size.height * 0.8,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("TODO Security")
],
),
),
),
);
}
}

View File

@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:myhomie_app/Components/Custom_Navigation_Bar/custom_nav_item.dart';
import 'package:myhomie_app/Models/homieContext.dart';
class Index with ChangeNotifier {
int _index = 0;
HomieAppContext _homieAppContext = new HomieAppContext();
Index(this._index, this._homieAppContext);
getIndex() => _index;
setIndex(int index) {
_index = index;
notifyListeners();
}
getTitle() {
switch(NavItemIcon.values[_index]) {
case NavItemIcon.home:
return "Home";
case NavItemIcon.security:
return "Security";
case NavItemIcon.automations:
return "Automations";
case NavItemIcon.energy:
return "Energy";
case NavItemIcon.profile:
return "Profile";
/*case NavItemIcon.profile:
if (_homieAppContext == null) {
return '';
}
if (_homieAppContext.userId == null) {
return 'null';
}
return _homieAppContext.userId;
break;*/
}
}
}

View File

@ -6,9 +6,17 @@ const kTitleTextColor = Color(0xFF303030);
const kBodyTextColor = Color(0xFF4B4B4B); // TODO
const kTextLightColor = Color(0xFFCED5DF); // #ced5df
const kMainColor = Color(0xFF308aae);
/*
const kTextStyle = TextStyle(
fontSize: 23,
color: kPrimaryColor,
fontWeight: FontWeight.w600,
);*/
// Text Style
const kHeadingTextStyle = TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: Color(0xFFFFFFFF)
);

View File

@ -4,7 +4,7 @@ import 'package:provider/provider.dart';
import 'Helpers/DatabaseHelper.dart';
import 'Models/homieContext.dart';
import 'Screens/Home/HomePage.dart';
import 'Screens/Main/MainPage.dart';
import 'Screens/Login/login_screen.dart';
import 'app_context.dart';
import 'constants.dart';
@ -68,7 +68,7 @@ class _MyAppState extends State<MyApp> {
visualDensity: VisualDensity.adaptivePlatformDensity,
),
routes: {
'/home': (context) => HomePage(),
'/home': (context) => MainPage(),
'/login': (context) => LoginScreen()
}
),

View File

@ -41,6 +41,9 @@ doc/EventApi.md
doc/EventDTO.md
doc/EventDetailDTO.md
doc/EventDetailDTOAllOf.md
doc/EventFilter.md
doc/EventHomeFilter.md
doc/EventHomeFilterAllOf.md
doc/EventType.md
doc/FacebookApi.md
doc/FacebookAuthModel.md
@ -59,6 +62,7 @@ doc/HomeDetailDTO.md
doc/HomeDetailDTOAllOf.md
doc/IOTApi.md
doc/LayoutApi.md
doc/ListResponseOfEventDetailDTOAndEventHomeFilter.md
doc/LoginDTO.md
doc/MQTTApi.md
doc/MeansOfCommunication.md
@ -75,6 +79,8 @@ doc/ProviderType.md
doc/RoomApi.md
doc/RoomCreateOrUpdateDetailDTO.md
doc/RoomDetailDTO.md
doc/RoomMainDetailDTO.md
doc/RoomMainDetailDTOAllOf.md
doc/RoomSummaryDTO.md
doc/ScreenDevice.md
doc/ScreenDeviceApi.md
@ -158,6 +164,9 @@ lib/model/electricity_production.dart
lib/model/event_detail_dto.dart
lib/model/event_detail_dto_all_of.dart
lib/model/event_dto.dart
lib/model/event_filter.dart
lib/model/event_home_filter.dart
lib/model/event_home_filter_all_of.dart
lib/model/event_type.dart
lib/model/facebook_auth_model.dart
lib/model/geolocalized_mode.dart
@ -170,6 +179,7 @@ lib/model/group_summary_dto.dart
lib/model/home_detail_dto.dart
lib/model/home_detail_dto_all_of.dart
lib/model/home_dto.dart
lib/model/list_response_of_event_detail_dto_and_event_home_filter.dart
lib/model/login_dto.dart
lib/model/means_of_communication.dart
lib/model/mqtt_message_dto.dart
@ -182,6 +192,8 @@ lib/model/provider_dto.dart
lib/model/provider_type.dart
lib/model/room_create_or_update_detail_dto.dart
lib/model/room_detail_dto.dart
lib/model/room_main_detail_dto.dart
lib/model/room_main_detail_dto_all_of.dart
lib/model/room_summary_dto.dart
lib/model/screen_device.dart
lib/model/smart_garden_message.dart
@ -196,29 +208,9 @@ lib/model/user_info.dart
lib/model/user_info_detail_dto.dart
lib/model/view_by.dart
pubspec.yaml
test/alarm_api_test.dart
test/alarm_mode_create_or_update_detail_dto_all_of_test.dart
test/alarm_mode_create_or_update_detail_dto_test.dart
test/alarm_mode_detail_dto_all_of_test.dart
test/alarm_mode_detail_dto_test.dart
test/alarm_mode_dto_test.dart
test/alarm_mode_test.dart
test/alarm_triggered_test.dart
test/alarm_type_test.dart
test/automation_triggered_test.dart
test/create_or_update_home_dto_all_of_test.dart
test/create_or_update_home_dto_test.dart
test/device_state_test.dart
test/event_api_test.dart
test/event_detail_dto_all_of_test.dart
test/event_detail_dto_test.dart
test/event_dto_test.dart
test/event_type_test.dart
test/geolocalized_mode_test.dart
test/home_api_test.dart
test/home_detail_dto_all_of_test.dart
test/home_detail_dto_test.dart
test/home_dto_test.dart
test/programmed_mode_test.dart
test/provider_type_test.dart
test/time_period_alarm_test.dart
test/event_filter_test.dart
test/event_home_filter_all_of_test.dart
test/event_home_filter_test.dart
test/list_response_of_event_detail_dto_and_event_home_filter_test.dart
test/room_main_detail_dto_all_of_test.dart
test/room_main_detail_dto_test.dart

View File

@ -56,17 +56,17 @@ try {
## Documentation for API Endpoints
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AlarmApi* | [**alarmActivate**](doc\/AlarmApi.md#alarmactivate) | **POST** /api/alarm/activate/{alarmModeId} | Activate current alarm mode
*AlarmApi* | [**alarmActivate**](doc\/AlarmApi.md#alarmactivate) | **POST** /api/alarm/activate/{alarmModeId} | Activate specified alarm mode
*AlarmApi* | [**alarmCreate**](doc\/AlarmApi.md#alarmcreate) | **POST** /api/alarm | Create an alarm mode
*AlarmApi* | [**alarmCreateDefaultAlarms**](doc\/AlarmApi.md#alarmcreatedefaultalarms) | **POST** /api/alarm/defaults/{homeId} | Create default alarm modes
*AlarmApi* | [**alarmDelete**](doc\/AlarmApi.md#alarmdelete) | **DELETE** /api/alarm/{alarmModeId} | Delete an alarm mode
*AlarmApi* | [**alarmDeleteAllForHome**](doc\/AlarmApi.md#alarmdeleteallforhome) | **DELETE** /api/alarm/home/{homeId} | Delete all alarm mode for a specified home
*AlarmApi* | [**alarmGetAll**](doc\/AlarmApi.md#alarmgetall) | **GET** /api/alarm/{homeId} | Get all alarm modes for the specified home
*AlarmApi* | [**alarmGetDetail**](doc\/AlarmApi.md#alarmgetdetail) | **GET** /api/alarm/detail/{alarmId} | Get detail info of a specified alarm mode
*AlarmApi* | [**alarmGetDetail**](doc\/AlarmApi.md#alarmgetdetail) | **GET** /api/alarm/detail/{alarmModeId} | Get detail info of a specified alarm mode
*AlarmApi* | [**alarmUpdate**](doc\/AlarmApi.md#alarmupdate) | **PUT** /api/alarm | Update an alarm mode
*AuthenticationApi* | [**authenticationAuthenticateWithForm**](doc\/AuthenticationApi.md#authenticationauthenticatewithform) | **POST** /api/Authentication/Token | Authenticate with form parameters (used by Swagger test client)
*AuthenticationApi* | [**authenticationAuthenticateWithJson**](doc\/AuthenticationApi.md#authenticationauthenticatewithjson) | **POST** /api/Authentication/Authenticate | Authenticate with Json parameters (used by most clients)
@ -92,6 +92,7 @@ Class | Method | HTTP request | Description
*DeviceApi* | [**deviceGetDevicesByType**](doc\/DeviceApi.md#devicegetdevicesbytype) | **GET** /api/device/{homeId}/type/{type} | Get list of devices from a type
*DeviceApi* | [**deviceGetDevicesFromProvider**](doc\/DeviceApi.md#devicegetdevicesfromprovider) | **GET** /api/device/{homeId}/fromProvider/{providerId} | Get devices from provider
*DeviceApi* | [**deviceGetDevicesFromZigbee2Mqtt**](doc\/DeviceApi.md#devicegetdevicesfromzigbee2mqtt) | **GET** /api/device/zigbee2Mqtt/{homeId} | Get all zigbee2Mqtt devices
*DeviceApi* | [**deviceSendAction**](doc\/DeviceApi.md#devicesendaction) | **POST** /api/device/action | Send action to device
*DeviceApi* | [**deviceUpdate**](doc\/DeviceApi.md#deviceupdate) | **PUT** /api/device/{deviceId} | Update a device
*EnergyApi* | [**energyGetElectricityProduction**](doc\/EnergyApi.md#energygetelectricityproduction) | **GET** /api/energy/electricity | Get summary production of Kwh/Year
*EventApi* | [**eventDelete**](doc\/EventApi.md#eventdelete) | **DELETE** /api/event/{eventId} | Delete an event
@ -131,6 +132,7 @@ Class | Method | HTTP request | Description
*RoomApi* | [**roomDelete2**](doc\/RoomApi.md#roomdelete2) | **DELETE** /api/room/{roomId} | Delete a room
*RoomApi* | [**roomDeleteAllForHome**](doc\/RoomApi.md#roomdeleteallforhome) | **DELETE** /api/room/home/{homeId} | Delete all rooms for a specified home
*RoomApi* | [**roomGetAll**](doc\/RoomApi.md#roomgetall) | **GET** /api/room/{homeId} | Get all rooms for the specified home
*RoomApi* | [**roomGetAllWithMainDetails**](doc\/RoomApi.md#roomgetallwithmaindetails) | **GET** /api/room/{homeId}/details | Get all rooms main details for the specified home
*RoomApi* | [**roomGetDetail**](doc\/RoomApi.md#roomgetdetail) | **GET** /api/room/detail/{roomId} | Get detail info of a specified room
*RoomApi* | [**roomUpdate**](doc\/RoomApi.md#roomupdate) | **PUT** /api/room | Update a room
*ScreenDeviceApi* | [**screenDeviceCreateDevice**](doc\/ScreenDeviceApi.md#screendevicecreatedevice) | **POST** /api/device/screen | Create screen device
@ -145,6 +147,7 @@ Class | Method | HTTP request | Description
*UserApi* | [**userDeleteUser**](doc\/UserApi.md#userdeleteuser) | **DELETE** /api/user/{id} | Delete an user
*UserApi* | [**userGet**](doc\/UserApi.md#userget) | **GET** /api/user/{id} | Get a specific user
*UserApi* | [**userGetAll**](doc\/UserApi.md#usergetall) | **GET** /api/user | Get a list of user
*UserApi* | [**userGetByEmail**](doc\/UserApi.md#usergetbyemail) | **GET** /api/user/email/{email} | Get a specific user by email
*UserApi* | [**userUpdateUser**](doc\/UserApi.md#userupdateuser) | **PUT** /api/user | Update an user
*ValuesApi* | [**valuesDelete**](doc\/ValuesApi.md#valuesdelete) | **DELETE** /api/test/{id} |
*ValuesApi* | [**valuesGet**](doc\/ValuesApi.md#valuesget) | **GET** /api/test/{id} |
@ -187,6 +190,9 @@ Class | Method | HTTP request | Description
- [EventDTO](doc\/EventDTO.md)
- [EventDetailDTO](doc\/EventDetailDTO.md)
- [EventDetailDTOAllOf](doc\/EventDetailDTOAllOf.md)
- [EventFilter](doc\/EventFilter.md)
- [EventHomeFilter](doc\/EventHomeFilter.md)
- [EventHomeFilterAllOf](doc\/EventHomeFilterAllOf.md)
- [EventType](doc\/EventType.md)
- [FacebookAuthModel](doc\/FacebookAuthModel.md)
- [GeolocalizedMode](doc\/GeolocalizedMode.md)
@ -199,6 +205,7 @@ Class | Method | HTTP request | Description
- [HomeDTO](doc\/HomeDTO.md)
- [HomeDetailDTO](doc\/HomeDetailDTO.md)
- [HomeDetailDTOAllOf](doc\/HomeDetailDTOAllOf.md)
- [ListResponseOfEventDetailDTOAndEventHomeFilter](doc\/ListResponseOfEventDetailDTOAndEventHomeFilter.md)
- [LoginDTO](doc\/LoginDTO.md)
- [MeansOfCommunication](doc\/MeansOfCommunication.md)
- [MqttMessageDTO](doc\/MqttMessageDTO.md)
@ -211,6 +218,8 @@ Class | Method | HTTP request | Description
- [ProviderType](doc\/ProviderType.md)
- [RoomCreateOrUpdateDetailDTO](doc\/RoomCreateOrUpdateDetailDTO.md)
- [RoomDetailDTO](doc\/RoomDetailDTO.md)
- [RoomMainDetailDTO](doc\/RoomMainDetailDTO.md)
- [RoomMainDetailDTOAllOf](doc\/RoomMainDetailDTOAllOf.md)
- [RoomSummaryDTO](doc\/RoomSummaryDTO.md)
- [ScreenDevice](doc\/ScreenDevice.md)
- [SmartGardenMessage](doc\/SmartGardenMessage.md)

View File

@ -5,24 +5,24 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------
[**alarmActivate**](AlarmApi.md#alarmactivate) | **POST** /api/alarm/activate/{alarmModeId} | Activate current alarm mode
[**alarmActivate**](AlarmApi.md#alarmactivate) | **POST** /api/alarm/activate/{alarmModeId} | Activate specified alarm mode
[**alarmCreate**](AlarmApi.md#alarmcreate) | **POST** /api/alarm | Create an alarm mode
[**alarmCreateDefaultAlarms**](AlarmApi.md#alarmcreatedefaultalarms) | **POST** /api/alarm/defaults/{homeId} | Create default alarm modes
[**alarmDelete**](AlarmApi.md#alarmdelete) | **DELETE** /api/alarm/{alarmModeId} | Delete an alarm mode
[**alarmDeleteAllForHome**](AlarmApi.md#alarmdeleteallforhome) | **DELETE** /api/alarm/home/{homeId} | Delete all alarm mode for a specified home
[**alarmGetAll**](AlarmApi.md#alarmgetall) | **GET** /api/alarm/{homeId} | Get all alarm modes for the specified home
[**alarmGetDetail**](AlarmApi.md#alarmgetdetail) | **GET** /api/alarm/detail/{alarmId} | Get detail info of a specified alarm mode
[**alarmGetDetail**](AlarmApi.md#alarmgetdetail) | **GET** /api/alarm/detail/{alarmModeId} | Get detail info of a specified alarm mode
[**alarmUpdate**](AlarmApi.md#alarmupdate) | **PUT** /api/alarm | Update an alarm mode
# **alarmActivate**
> String alarmActivate(alarmModeId)
Activate current alarm mode
Activate specified alarm mode
### Example
```dart
@ -278,7 +278,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)
# **alarmGetDetail**
> AlarmModeDetailDTO alarmGetDetail(alarmId, alarmModeId)
> AlarmModeDetailDTO alarmGetDetail(alarmModeId)
Get detail info of a specified alarm mode
@ -289,11 +289,10 @@ import 'package:mycoreapi/api.dart';
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
final api_instance = AlarmApi();
final alarmId = alarmId_example; // String |
final alarmModeId = alarmModeId_example; // String | alarm id
try {
final result = api_instance.alarmGetDetail(alarmId, alarmModeId);
final result = api_instance.alarmGetDetail(alarmModeId);
print(result);
} catch (e) {
print('Exception when calling AlarmApi->alarmGetDetail: $e\n');
@ -304,8 +303,7 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**alarmId** | **String**| |
**alarmModeId** | **String**| alarm id | [optional]
**alarmModeId** | **String**| alarm id |
### Return type

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------
@ -19,6 +19,7 @@ Method | HTTP request | Description
[**deviceGetDevicesByType**](DeviceApi.md#devicegetdevicesbytype) | **GET** /api/device/{homeId}/type/{type} | Get list of devices from a type
[**deviceGetDevicesFromProvider**](DeviceApi.md#devicegetdevicesfromprovider) | **GET** /api/device/{homeId}/fromProvider/{providerId} | Get devices from provider
[**deviceGetDevicesFromZigbee2Mqtt**](DeviceApi.md#devicegetdevicesfromzigbee2mqtt) | **GET** /api/device/zigbee2Mqtt/{homeId} | Get all zigbee2Mqtt devices
[**deviceSendAction**](DeviceApi.md#devicesendaction) | **POST** /api/device/action | Send action to device
[**deviceUpdate**](DeviceApi.md#deviceupdate) | **PUT** /api/device/{deviceId} | Update a device
@ -460,6 +461,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)
# **deviceSendAction**
> String deviceSendAction(action)
Send action to device
### Example
```dart
import 'package:mycoreapi/api.dart';
// TODO Configure OAuth2 access token for authorization: bearer
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
final api_instance = DeviceApi();
final action = Action(); // Action | Action to sent
try {
final result = api_instance.deviceSendAction(action);
print(result);
} catch (e) {
print('Exception when calling DeviceApi->deviceSendAction: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**action** | [**Action**](Action.md)| Action to sent |
### 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)
# **deviceUpdate**
> DeviceDetailDTO deviceUpdate(deviceId, deviceDetailDTO)

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------
@ -102,7 +102,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)
# **eventGet**
> List<EventDetailDTO> eventGet(homeId, deviceId, roomId, startIndex, count, dateStart, dateEnd, eventType, deviceType)
> ListResponseOfEventDetailDTOAndEventHomeFilter eventGet(homeId, deviceId, roomId, startIndex, count, dateStart, dateEnd, eventType, deviceType)
Get events for the specified home
@ -147,7 +147,7 @@ Name | Type | Description | Notes
### Return type
[**List<EventDetailDTO>**](EventDetailDTO.md)
[**ListResponseOfEventDetailDTOAndEventHomeFilter**](ListResponseOfEventDetailDTOAndEventHomeFilter.md)
### Authorization

View File

@ -0,0 +1,20 @@
# mycoreapi.model.EventFilter
## Load the model package
```dart
import 'package:mycoreapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**startIndex** | **int** | | [optional]
**count** | **int** | | [optional]
**dateStart** | [**DateTime**](DateTime.md) | | [optional]
**dateEnd** | [**DateTime**](DateTime.md) | | [optional]
**eventType** | [**OneOfEventType**](OneOfEventType.md) | | [optional]
**deviceType** | [**OneOfDeviceType**](OneOfDeviceType.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,22 @@
# mycoreapi.model.EventHomeFilter
## Load the model package
```dart
import 'package:mycoreapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**startIndex** | **int** | | [optional]
**count** | **int** | | [optional]
**dateStart** | [**DateTime**](DateTime.md) | | [optional]
**dateEnd** | [**DateTime**](DateTime.md) | | [optional]
**eventType** | [**OneOfEventType**](OneOfEventType.md) | | [optional]
**deviceType** | [**OneOfDeviceType**](OneOfDeviceType.md) | | [optional]
**deviceId** | **String** | | [optional]
**roomId** | **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,16 @@
# mycoreapi.model.EventHomeFilterAllOf
## Load the model package
```dart
import 'package:mycoreapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**deviceId** | **String** | | [optional]
**roomId** | **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

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -0,0 +1,18 @@
# mycoreapi.model.ListResponseOfEventDetailDTOAndEventHomeFilter
## Load the model package
```dart
import 'package:mycoreapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**values** | [**List<EventDetailDTO>**](EventDetailDTO.md) | | [optional] [default to const []]
**requestParameters** | [**OneOfEventHomeFilter**](OneOfEventHomeFilter.md) | | [optional]
**totalCount** | **int** | | [optional]
**actualCount** | **int** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------
@ -14,6 +14,7 @@ Method | HTTP request | Description
[**roomDelete2**](RoomApi.md#roomdelete2) | **DELETE** /api/room/{roomId} | Delete a room
[**roomDeleteAllForHome**](RoomApi.md#roomdeleteallforhome) | **DELETE** /api/room/home/{homeId} | Delete all rooms for a specified home
[**roomGetAll**](RoomApi.md#roomgetall) | **GET** /api/room/{homeId} | Get all rooms for the specified home
[**roomGetAllWithMainDetails**](RoomApi.md#roomgetallwithmaindetails) | **GET** /api/room/{homeId}/details | Get all rooms main details for the specified home
[**roomGetDetail**](RoomApi.md#roomgetdetail) | **GET** /api/room/detail/{roomId} | Get detail info of a specified room
[**roomUpdate**](RoomApi.md#roomupdate) | **PUT** /api/room | Update a room
@ -235,6 +236,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)
# **roomGetAllWithMainDetails**
> List<RoomMainDetailDTO> roomGetAllWithMainDetails(homeId)
Get all rooms main details for the specified home
### Example
```dart
import 'package:mycoreapi/api.dart';
// TODO Configure OAuth2 access token for authorization: bearer
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
final api_instance = RoomApi();
final homeId = homeId_example; // String | Home Id
try {
final result = api_instance.roomGetAllWithMainDetails(homeId);
print(result);
} catch (e) {
print('Exception when calling RoomApi->roomGetAllWithMainDetails: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**homeId** | **String**| Home Id |
### Return type
[**List<RoomMainDetailDTO>**](RoomMainDetailDTO.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)
# **roomGetDetail**
> RoomDetailDTO roomGetDetail(roomId)

View File

@ -0,0 +1,21 @@
# mycoreapi.model.RoomMainDetailDTO
## Load the model package
```dart
import 'package:mycoreapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **String** | | [optional]
**homeId** | **String** | | [optional]
**name** | **String** | | [optional]
**createdDate** | [**DateTime**](DateTime.md) | | [optional]
**updatedDate** | [**DateTime**](DateTime.md) | | [optional]
**environmentalDevices** | [**List<DeviceDetailDTO>**](DeviceDetailDTO.md) | | [optional] [default to const []]
**securityDevices** | [**List<DeviceDetailDTO>**](DeviceDetailDTO.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)

View File

@ -0,0 +1,18 @@
# mycoreapi.model.RoomMainDetailDTOAllOf
## Load the model package
```dart
import 'package:mycoreapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**createdDate** | [**DateTime**](DateTime.md) | | [optional]
**updatedDate** | [**DateTime**](DateTime.md) | | [optional]
**environmentalDevices** | [**List<DeviceDetailDTO>**](DeviceDetailDTO.md) | | [optional] [default to const []]
**securityDevices** | [**List<DeviceDetailDTO>**](DeviceDetailDTO.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)

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------
@ -13,6 +13,7 @@ Method | HTTP request | Description
[**userDeleteUser**](UserApi.md#userdeleteuser) | **DELETE** /api/user/{id} | Delete an user
[**userGet**](UserApi.md#userget) | **GET** /api/user/{id} | Get a specific user
[**userGetAll**](UserApi.md#usergetall) | **GET** /api/user | Get a list of user
[**userGetByEmail**](UserApi.md#usergetbyemail) | **GET** /api/user/email/{email} | Get a specific user by email
[**userUpdateUser**](UserApi.md#userupdateuser) | **PUT** /api/user | Update an user
@ -184,6 +185,49 @@ 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)
# **userGetByEmail**
> UserInfoDetailDTO userGetByEmail(email)
Get a specific user by email
### Example
```dart
import 'package:mycoreapi/api.dart';
// TODO Configure OAuth2 access token for authorization: bearer
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
final api_instance = UserApi();
final email = email_example; // String | user email
try {
final result = api_instance.userGetByEmail(email);
print(result);
} catch (e) {
print('Exception when calling UserApi->userGetByEmail: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**email** | **String**| user email |
### Return type
[**UserInfoDetailDTO**](UserInfoDetailDTO.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)
# **userUpdateUser**
> UserInfoDetailDTO userUpdateUser(userInfo)

View File

@ -12,6 +12,8 @@ Name | Type | Description | Notes
**email** | **String** | | [optional]
**firstName** | **String** | | [optional]
**lastName** | **String** | | [optional]
**language** | **String** | | [optional]
**homeIds** | **List<String>** | | [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)

View File

@ -5,7 +5,7 @@
import 'package:mycoreapi/api.dart';
```
All URIs are relative to *http://192.168.31.140*
All URIs are relative to *https://localhost:5001*
Method | HTTP request | Description
------------- | ------------- | -------------

View File

@ -83,6 +83,9 @@ part 'model/electricity_production.dart';
part 'model/event_dto.dart';
part 'model/event_detail_dto.dart';
part 'model/event_detail_dto_all_of.dart';
part 'model/event_filter.dart';
part 'model/event_home_filter.dart';
part 'model/event_home_filter_all_of.dart';
part 'model/event_type.dart';
part 'model/facebook_auth_model.dart';
part 'model/geolocalized_mode.dart';
@ -95,6 +98,7 @@ part 'model/group_summary_dto.dart';
part 'model/home_dto.dart';
part 'model/home_detail_dto.dart';
part 'model/home_detail_dto_all_of.dart';
part 'model/list_response_of_event_detail_dto_and_event_home_filter.dart';
part 'model/login_dto.dart';
part 'model/means_of_communication.dart';
part 'model/mqtt_message_dto.dart';
@ -107,9 +111,10 @@ part 'model/provider_dto.dart';
part 'model/provider_type.dart';
part 'model/room_create_or_update_detail_dto.dart';
part 'model/room_detail_dto.dart';
part 'model/room_main_detail_dto.dart';
part 'model/room_main_detail_dto_all_of.dart';
part 'model/room_summary_dto.dart';
part 'model/screen_device.dart';
part 'model/screen_widget.dart';
part 'model/smart_garden_message.dart';
part 'model/smart_printer_message.dart';
part 'model/time_period_alarm.dart';

View File

@ -15,7 +15,7 @@ class AlarmApi {
final ApiClient apiClient;
/// Activate current alarm mode
/// Activate specified alarm mode
///
/// Note: This method returns the HTTP [Response].
///
@ -66,7 +66,7 @@ class AlarmApi {
);
}
/// Activate current alarm mode
/// Activate specified alarm mode
///
/// Parameters:
///
@ -448,18 +448,16 @@ class AlarmApi {
///
/// Parameters:
///
/// * [String] alarmId (required):
///
/// * [String] alarmModeId:
/// * [String] alarmModeId (required):
/// alarm id
Future<Response> alarmGetDetailWithHttpInfo(String alarmId, { String alarmModeId }) async {
Future<Response> alarmGetDetailWithHttpInfo(String alarmModeId) async {
// Verify required params are set.
if (alarmId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: alarmId');
if (alarmModeId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: alarmModeId');
}
final path = r'/api/alarm/detail/{alarmId}'
.replaceAll('{' + 'alarmId' + '}', alarmId.toString());
final path = r'/api/alarm/detail/{alarmModeId}'
.replaceAll('{' + 'alarmModeId' + '}', alarmModeId.toString());
Object postBody;
@ -467,10 +465,6 @@ class AlarmApi {
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (alarmModeId != null) {
queryParams.addAll(_convertParametersForCollectionFormat('', 'alarmModeId', alarmModeId));
}
final contentTypes = <String>[];
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
final authNames = <String>['bearer'];
@ -503,12 +497,10 @@ class AlarmApi {
///
/// Parameters:
///
/// * [String] alarmId (required):
///
/// * [String] alarmModeId:
/// * [String] alarmModeId (required):
/// alarm id
Future<AlarmModeDetailDTO> alarmGetDetail(String alarmId, { String alarmModeId }) async {
final response = await alarmGetDetailWithHttpInfo(alarmId, alarmModeId: alarmModeId );
Future<AlarmModeDetailDTO> alarmGetDetail(String alarmModeId) async {
final response = await alarmGetDetailWithHttpInfo(alarmModeId);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
}

View File

@ -774,6 +774,76 @@ class DeviceApi {
return Future<List<DeviceDetailDTO>>.value(null);
}
/// Send action to device
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [Action] action (required):
/// Action to sent
Future<Response> deviceSendActionWithHttpInfo(Action action) async {
// Verify required params are set.
if (action == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: action');
}
final path = r'/api/device/action';
Object postBody = action;
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,
);
}
/// Send action to device
///
/// Parameters:
///
/// * [Action] action (required):
/// Action to sent
Future<String> deviceSendAction(Action action) async {
final response = await deviceSendActionWithHttpInfo(action);
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);
}
/// Update a device
///
/// Note: This method returns the HTTP [Response].

View File

@ -271,7 +271,7 @@ class EventApi {
/// * [OneOfEventType] eventType:
///
/// * [OneOfDeviceType] deviceType:
Future<List<EventDetailDTO>> eventGet(String homeId, { String deviceId, String roomId, int startIndex, int count, DateTime dateStart, DateTime dateEnd, EventType eventType, DeviceType deviceType }) async {
Future<ListResponseOfEventDetailDTOAndEventHomeFilter> eventGet(String homeId, { String deviceId, String roomId, int startIndex, int count, DateTime dateStart, DateTime dateEnd, EventType eventType, DeviceType deviceType }) async {
final response = await eventGetWithHttpInfo(homeId, deviceId: deviceId, roomId: roomId, startIndex: startIndex, count: count, dateStart: dateStart, dateEnd: dateEnd, eventType: eventType, deviceType: deviceType );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
@ -280,11 +280,9 @@ class EventApi {
// 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<EventDetailDTO>') as List)
.cast<EventDetailDTO>()
.toList(growable: false);
}
return Future<List<EventDetailDTO>>.value(null);
return apiClient.deserialize(_decodeBodyBytes(response), 'ListResponseOfEventDetailDTOAndEventHomeFilter') as ListResponseOfEventDetailDTOAndEventHomeFilter;
}
return Future<ListResponseOfEventDetailDTOAndEventHomeFilter>.value(null);
}
/// Get detail info of a specified event

View File

@ -381,6 +381,79 @@ class RoomApi {
return Future<List<RoomSummaryDTO>>.value(null);
}
/// Get all rooms main details for the specified home
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] homeId (required):
/// Home Id
Future<Response> roomGetAllWithMainDetailsWithHttpInfo(String homeId) async {
// Verify required params are set.
if (homeId == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: homeId');
}
final path = r'/api/room/{homeId}/details'
.replaceAll('{' + 'homeId' + '}', homeId.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,
);
}
/// Get all rooms main details for the specified home
///
/// Parameters:
///
/// * [String] homeId (required):
/// Home Id
Future<List<RoomMainDetailDTO>> roomGetAllWithMainDetails(String homeId) async {
final response = await roomGetAllWithMainDetailsWithHttpInfo(homeId);
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<RoomMainDetailDTO>') as List)
.cast<RoomMainDetailDTO>()
.toList(growable: false);
}
return Future<List<RoomMainDetailDTO>>.value(null);
}
/// Get detail info of a specified room
///
/// Note: This method returns the HTTP [Response].

View File

@ -284,6 +284,77 @@ class UserApi {
return Future<List<UserInfo>>.value(null);
}
/// Get a specific user by email
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] email (required):
/// user email
Future<Response> userGetByEmailWithHttpInfo(String email) async {
// Verify required params are set.
if (email == null) {
throw ApiException(HttpStatus.badRequest, 'Missing required param: email');
}
final path = r'/api/user/email/{email}'
.replaceAll('{' + 'email' + '}', email.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,
);
}
/// Get a specific user by email
///
/// Parameters:
///
/// * [String] email (required):
/// user email
Future<UserInfoDetailDTO> userGetByEmail(String email) async {
final response = await userGetByEmailWithHttpInfo(email);
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), 'UserInfoDetailDTO') as UserInfoDetailDTO;
}
return Future<UserInfoDetailDTO>.value(null);
}
/// Update an user
///
/// Note: This method returns the HTTP [Response].

View File

@ -10,7 +10,7 @@
part of openapi.api;
class ApiClient {
ApiClient({this.basePath = 'http://192.168.31.140'}) {
ApiClient({this.basePath = 'https://localhost:5001'}) {
// Setup authentications (key: authentication name, value: authentication).
_authentications[r'bearer'] = OAuth();
}
@ -226,6 +226,12 @@ class ApiClient {
return EventDetailDTO.fromJson(value);
case 'EventDetailDTOAllOf':
return EventDetailDTOAllOf.fromJson(value);
case 'EventFilter':
return EventFilter.fromJson(value);
case 'EventHomeFilter':
return EventHomeFilter.fromJson(value);
case 'EventHomeFilterAllOf':
return EventHomeFilterAllOf.fromJson(value);
case 'EventType':
return EventTypeTypeTransformer().decode(value);
@ -251,6 +257,8 @@ class ApiClient {
return HomeDetailDTO.fromJson(value);
case 'HomeDetailDTOAllOf':
return HomeDetailDTOAllOf.fromJson(value);
case 'ListResponseOfEventDetailDTOAndEventHomeFilter':
return ListResponseOfEventDetailDTOAndEventHomeFilter.fromJson(value);
case 'LoginDTO':
return LoginDTO.fromJson(value);
case 'MeansOfCommunication':
@ -277,6 +285,10 @@ class ApiClient {
return RoomCreateOrUpdateDetailDTO.fromJson(value);
case 'RoomDetailDTO':
return RoomDetailDTO.fromJson(value);
case 'RoomMainDetailDTO':
return RoomMainDetailDTO.fromJson(value);
case 'RoomMainDetailDTOAllOf':
return RoomMainDetailDTOAllOf.fromJson(value);
case 'RoomSummaryDTO':
return RoomSummaryDTO.fromJson(value);
case 'ScreenDevice':

View File

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

View 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 EventHomeFilter {
/// Returns a new [EventHomeFilter] instance.
EventHomeFilter({
this.startIndex,
this.count,
this.dateStart,
this.dateEnd,
this.eventType,
this.deviceType,
this.deviceId,
this.roomId,
});
int startIndex;
int count;
DateTime dateStart;
DateTime dateEnd;
EventType eventType;
DeviceType deviceType;
String deviceId;
String roomId;
@override
bool operator ==(Object other) => identical(this, other) || other is EventHomeFilter &&
other.startIndex == startIndex &&
other.count == count &&
other.dateStart == dateStart &&
other.dateEnd == dateEnd &&
other.eventType == eventType &&
other.deviceType == deviceType &&
other.deviceId == deviceId &&
other.roomId == roomId;
@override
int get hashCode =>
(startIndex == null ? 0 : startIndex.hashCode) +
(count == null ? 0 : count.hashCode) +
(dateStart == null ? 0 : dateStart.hashCode) +
(dateEnd == null ? 0 : dateEnd.hashCode) +
(eventType == null ? 0 : eventType.hashCode) +
(deviceType == null ? 0 : deviceType.hashCode) +
(deviceId == null ? 0 : deviceId.hashCode) +
(roomId == null ? 0 : roomId.hashCode);
@override
String toString() => 'EventHomeFilter[startIndex=$startIndex, count=$count, dateStart=$dateStart, dateEnd=$dateEnd, eventType=$eventType, deviceType=$deviceType, deviceId=$deviceId, roomId=$roomId]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (startIndex != null) {
json[r'startIndex'] = startIndex;
}
if (count != null) {
json[r'count'] = count;
}
if (dateStart != null) {
json[r'dateStart'] = dateStart.toUtc().toIso8601String();
}
if (dateEnd != null) {
json[r'dateEnd'] = dateEnd.toUtc().toIso8601String();
}
if (eventType != null) {
json[r'eventType'] = eventType;
}
if (deviceType != null) {
json[r'deviceType'] = deviceType;
}
if (deviceId != null) {
json[r'deviceId'] = deviceId;
}
if (roomId != null) {
json[r'roomId'] = roomId;
}
return json;
}
/// Returns a new [EventHomeFilter] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static EventHomeFilter fromJson(Map<String, dynamic> json) => json == null
? null
: EventHomeFilter(
startIndex: json[r'startIndex'],
count: json[r'count'],
dateStart: json[r'dateStart'] == null
? null
: DateTime.parse(json[r'dateStart']),
dateEnd: json[r'dateEnd'] == null
? null
: DateTime.parse(json[r'dateEnd']),
eventType: EventType.fromJson(json[r'eventType']),
deviceType: DeviceType.fromJson(json[r'deviceType']),
deviceId: json[r'deviceId'],
roomId: json[r'roomId'],
);
static List<EventHomeFilter> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <EventHomeFilter>[]
: json.map((v) => EventHomeFilter.fromJson(v)).toList(growable: true == growable);
static Map<String, EventHomeFilter> mapFromJson(Map<String, dynamic> json) {
final map = <String, EventHomeFilter>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = EventHomeFilter.fromJson(v));
}
return map;
}
// maps a json object with a list of EventHomeFilter-objects as value to a dart map
static Map<String, List<EventHomeFilter>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<EventHomeFilter>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = EventHomeFilter.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}

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

View File

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

View File

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

View File

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

View File

@ -16,6 +16,8 @@ class UserInfoDetailDTO {
this.email,
this.firstName,
this.lastName,
this.language,
this.homeIds,
});
String id;
@ -26,22 +28,30 @@ class UserInfoDetailDTO {
String lastName;
String language;
List<String> homeIds;
@override
bool operator ==(Object other) => identical(this, other) || other is UserInfoDetailDTO &&
other.id == id &&
other.email == email &&
other.firstName == firstName &&
other.lastName == lastName;
other.lastName == lastName &&
other.language == language &&
other.homeIds == homeIds;
@override
int get hashCode =>
(id == null ? 0 : id.hashCode) +
(email == null ? 0 : email.hashCode) +
(firstName == null ? 0 : firstName.hashCode) +
(lastName == null ? 0 : lastName.hashCode);
(lastName == null ? 0 : lastName.hashCode) +
(language == null ? 0 : language.hashCode) +
(homeIds == null ? 0 : homeIds.hashCode);
@override
String toString() => 'UserInfoDetailDTO[id=$id, email=$email, firstName=$firstName, lastName=$lastName]';
String toString() => 'UserInfoDetailDTO[id=$id, email=$email, firstName=$firstName, lastName=$lastName, language=$language, homeIds=$homeIds]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -57,6 +67,12 @@ class UserInfoDetailDTO {
if (lastName != null) {
json[r'lastName'] = lastName;
}
if (language != null) {
json[r'language'] = language;
}
if (homeIds != null) {
json[r'homeIds'] = homeIds;
}
return json;
}
@ -69,6 +85,10 @@ class UserInfoDetailDTO {
email: json[r'email'],
firstName: json[r'firstName'],
lastName: json[r'lastName'],
language: json[r'language'],
homeIds: json[r'homeIds'] == null
? null
: (json[r'homeIds'] as List).cast<String>(),
);
static List<UserInfoDetailDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>

File diff suppressed because it is too large Load Diff

4625
mycore_api/swagger.yaml.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
//
// 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:mycoreapi/api.dart';
import 'package:test/test.dart';
// tests for EventFilter
void main() {
final instance = EventFilter();
group('test EventFilter', () {
// int startIndex
test('to test the property `startIndex`', () async {
// TODO
});
// int count
test('to test the property `count`', () async {
// TODO
});
// DateTime dateStart
test('to test the property `dateStart`', () async {
// TODO
});
// DateTime dateEnd
test('to test the property `dateEnd`', () async {
// TODO
});
// OneOfEventType eventType
test('to test the property `eventType`', () async {
// TODO
});
// OneOfDeviceType deviceType
test('to test the property `deviceType`', () async {
// TODO
});
});
}

View 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:mycoreapi/api.dart';
import 'package:test/test.dart';
// tests for EventHomeFilterAllOf
void main() {
final instance = EventHomeFilterAllOf();
group('test EventHomeFilterAllOf', () {
// String deviceId
test('to test the property `deviceId`', () async {
// TODO
});
// String roomId
test('to test the property `roomId`', () async {
// TODO
});
});
}

View 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:mycoreapi/api.dart';
import 'package:test/test.dart';
// tests for EventHomeFilter
void main() {
final instance = EventHomeFilter();
group('test EventHomeFilter', () {
// int startIndex
test('to test the property `startIndex`', () async {
// TODO
});
// int count
test('to test the property `count`', () async {
// TODO
});
// DateTime dateStart
test('to test the property `dateStart`', () async {
// TODO
});
// DateTime dateEnd
test('to test the property `dateEnd`', () async {
// TODO
});
// OneOfEventType eventType
test('to test the property `eventType`', () async {
// TODO
});
// OneOfDeviceType deviceType
test('to test the property `deviceType`', () async {
// TODO
});
// String deviceId
test('to test the property `deviceId`', () async {
// TODO
});
// String roomId
test('to test the property `roomId`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,41 @@
//
// 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:mycoreapi/api.dart';
import 'package:test/test.dart';
// tests for ListResponseOfEventDetailDTOAndEventHomeFilter
void main() {
final instance = ListResponseOfEventDetailDTOAndEventHomeFilter();
group('test ListResponseOfEventDetailDTOAndEventHomeFilter', () {
// List<EventDetailDTO> values (default value: const [])
test('to test the property `values`', () async {
// TODO
});
// OneOfEventHomeFilter requestParameters
test('to test the property `requestParameters`', () async {
// TODO
});
// int totalCount
test('to test the property `totalCount`', () async {
// TODO
});
// int actualCount
test('to test the property `actualCount`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,41 @@
//
// 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:mycoreapi/api.dart';
import 'package:test/test.dart';
// tests for RoomMainDetailDTOAllOf
void main() {
final instance = RoomMainDetailDTOAllOf();
group('test RoomMainDetailDTOAllOf', () {
// DateTime createdDate
test('to test the property `createdDate`', () async {
// TODO
});
// DateTime updatedDate
test('to test the property `updatedDate`', () async {
// TODO
});
// List<DeviceDetailDTO> environmentalDevices (default value: const [])
test('to test the property `environmentalDevices`', () async {
// TODO
});
// List<DeviceDetailDTO> securityDevices (default value: const [])
test('to test the property `securityDevices`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,56 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
import 'package:mycoreapi/api.dart';
import 'package:test/test.dart';
// tests for RoomMainDetailDTO
void main() {
final instance = RoomMainDetailDTO();
group('test RoomMainDetailDTO', () {
// String id
test('to test the property `id`', () async {
// TODO
});
// String homeId
test('to test the property `homeId`', () async {
// TODO
});
// String name
test('to test the property `name`', () async {
// TODO
});
// DateTime createdDate
test('to test the property `createdDate`', () async {
// TODO
});
// DateTime updatedDate
test('to test the property `updatedDate`', () async {
// TODO
});
// List<DeviceDetailDTO> environmentalDevices (default value: const [])
test('to test the property `environmentalDevices`', () async {
// TODO
});
// List<DeviceDetailDTO> securityDevices (default value: const [])
test('to test the property `securityDevices`', () async {
// TODO
});
});
}

View File

@ -97,6 +97,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_svg:
dependency: "direct main"
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "0.18.1"
flutter_test:
dependency: "direct dev"
description: flutter
@ -191,6 +198,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1+1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
pedantic:
dependency: transitive
description:
@ -198,6 +219,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
provider:
dependency: "direct main"
description:
@ -287,6 +315,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
uuid:
dependency: "direct main"
description:
name: uuid
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.2"
vector_math:
dependency: transitive
description:
@ -294,6 +329,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.1"
sdks:
dart: ">=2.15.0 <3.0.0"
flutter: ">=1.16.0"
flutter: ">=1.18.0-6.0.pre"

View File

@ -28,9 +28,11 @@ dependencies:
sqflite:
provider: ^5.0.0
enum_to_string: ^2.0.1
flutter_svg: ^0.18.0
mqtt_client: ^8.1.0
rxdart: 0.22.0
flare_flutter: ^3.0.1
uuid: ^2.2.2
mycoreapi:
path: mycore_api
# The following adds the Cupertino Icons font to your application.