changed endpoint for create automation endpoint

This commit is contained in:
hannathkadher
2025-03-14 12:40:52 +04:00
parent cbf10bbf78
commit c2fc8fa0ae
3 changed files with 11 additions and 5 deletions

View File

@ -144,7 +144,7 @@ abstract class ApiEndpoints {
/// POST
static const String createScene = '/scene/tap-to-run';
static const String triggerScene = '/scene/tap-to-run/{sceneId}/trigger';
static const String createAutomation = '/automation';
static const String createAutomation = '/projects/{projectId}/automations';
/// GET
static const String getUnitScenes =

View File

@ -6,7 +6,6 @@ import 'package:syncrow_app/features/scene/model/scenes_model.dart';
import 'package:syncrow_app/features/scene/model/update_automation.dart';
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
import 'package:syncrow_app/services/api/http_service.dart';
import 'package:syncrow_app/utils/constants/temp_const.dart';
class SceneApi {
static final HTTPService _httpService = HTTPService();
@ -31,10 +30,11 @@ class SceneApi {
// create automation
static Future<Map<String, dynamic>> createAutomation(
CreateAutomationModel createAutomationModel) async {
CreateAutomationModel createAutomationModel, String projectId) async {
try {
final response = await _httpService.post(
path: ApiEndpoints.createAutomation,
path:
ApiEndpoints.createAutomation.replaceAll('{projectId}', projectId),
body: createAutomationModel.toMap(),
showServerMessage: false,
expectedResponseModel: (json) {