package com.example.test.rest_controllers;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.example.test.services.ElementEventService;
@RestController
@RequestMapping("/api/elements")
public class ElementsController {
private final ElementEventService elementEventService;
ElementsController(ElementEventService bs){
elementEventService = bs;
}
@PostMapping("/buttonPressed")
public void buttonPressed(@RequestParam("id") String id) {
elementEventService.onButtonPressed(id);
}
@PostMapping("/buttonReleased")
public void buttonReleased(@RequestParam("id") String id) {
elementEventService.onButtonReleased(id);
}
@PostMapping("/textChanged")
public void textChanged(@RequestParam("id") String id, @RequestParam("new_text") String newText) {
elementEventService.onTextChanged(id, newText);
}
}