Class DataController

java.lang.Object
fr.sandro642.github.spring.controller.DataController

@RestController @RequestMapping("/api") @CrossOrigin(origins="*") public class DataController extends Object
DataController is a REST controller that provides endpoints to manage requests and retrieve status and routes.
  • Method Details

    • getInstance

      public static DataController getInstance()
      Get the singleton instance of DataController.
      Returns:
      the singleton instance
    • getStatus

      @GetMapping("/status") public Map<String,Object> getStatus()
      Endpoint to get the status of the ConnectLib.
      Returns:
      a map containing the initialization status and resource type
    • getRoutes

      @GetMapping("/routes") public Map<String,Object> getRoutes()
    • getRequests

      @GetMapping("/requests") public Map<String,Object> getRequests()
      Endpoint to get all requests.
      Returns:
      a list of Request objects
    • getConfig

      @GetMapping("/config") public Map<String,Object> getConfig()
    • createRequest

      public Request createRequest(String route, String branch)
      Endpoint to create a new request.
      Parameters:
      route - the route for the request
      branch - the branch for the request
      Returns:
      the created Request object
    • updateRequestStatus

      public Request updateRequestStatus(Long id, String status)
      Endpoint to update the status of an existing request.
      Parameters:
      id - the ID of the request to update
      status - the new status for the request
      Returns:
      the updated Request object, or null if not found