mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
profile changes
This commit is contained in:
59
lib/services/api/profile_api.dart
Normal file
59
lib/services/api/profile_api.dart
Normal file
@ -0,0 +1,59 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/function_model.dart';
|
||||
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
||||
import 'package:syncrow_app/services/api/http_service.dart';
|
||||
|
||||
import '../../features/devices/model/create_temporary_password_model.dart';
|
||||
|
||||
class ProfileApi {
|
||||
static final HTTPService _httpService = HTTPService();
|
||||
static Future<Map<String, dynamic>> saveName(
|
||||
String newName, String userId) async {
|
||||
try {
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', userId),
|
||||
body: newName,
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> saveImage(
|
||||
File newName, String userId) async {
|
||||
try {
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', userId),
|
||||
body: newName,
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
static Future fetchUserInfo(String userId) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.groupBySpace.replaceAll('{unitUuid}', userId),
|
||||
// queryParameters: params,
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) => DevicesCategoryModel.fromJsonList(json),
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user