Skip to content

Commit

Permalink
add requestbody
Browse files Browse the repository at this point in the history
  • Loading branch information
Yinnii committed Oct 4, 2024
1 parent aae07b9 commit a20dabc
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,13 @@ public ResponseEntity<JSONObject> biwibotMaterials(@RequestParam(value = "channe
@ApiResponse(responseCode = "500", description = "Setting materials failed.")
})
@PostMapping("/setBiwibotMaterials")
public ResponseEntity<JSONObject> setBiwibotMaterials(@RequestParam("material") String material, @RequestParam("channel") String channel) {
public ResponseEntity<JSONObject> setBiwibotMaterials(@RequestBody JSONObject body, @RequestParam(value= "material", defaultValue = "") String material, @RequestParam(value = "channel", defaultValue = "") String channel) {
//Clear hashmap after some time?
if (material == null || material.equals("")) {
material = body.getAsString("material");
channel = body.getAsString("channel");
}

selectedMaterial.put(channel, material);
System.out.println("Selected Materials are: " + selectedMaterial.toString());
JSONObject response = new JSONObject();
Expand All @@ -528,8 +533,11 @@ public ResponseEntity<JSONObject> setBiwibotMaterials(@RequestParam("material")
@ApiResponse(responseCode = "500", description = "Getting response failed.")
})
@PostMapping("/biwibot")
public ResponseEntity<JSONObject> biwibot(@RequestParam("msg") String msg, @RequestParam("channel") String channel, @RequestParam(value="sbfmUrl", defaultValue = "default") String sbfmUrl, @RequestParam(value = "material", defaultValue = "default") String material) throws IOException, InterruptedException {
System.out.println("Msg:" + msg);
public ResponseEntity<JSONObject> biwibot(@RequestBody JSONObject body, @RequestParam(value = "msg", defaultValue = "") String msg, @RequestParam("channel") String channel, @RequestParam(value="sbfmUrl", defaultValue = "default") String sbfmUrl, @RequestParam(value = "material", defaultValue = "default") String material) throws IOException, InterruptedException {
if (msg == null || msg.equals("")) {
msg = body.getAsString("msg");
}
System.out.println("Msg:" + body.getAsString("msg"));
System.out.println("Channel:" + channel);
System.out.println("Material:" + material);
Boolean contextOn = false;
Expand Down

0 comments on commit a20dabc

Please sign in to comment.