2 * In Samsung Ukraine R&D Center (SRK under a contract between)
3 * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
4 * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
6 package com.samsung.samserver.web.rest.controller;
8 import com.samsung.samserver.web.rest.service.*;
9 import org.springframework.http.*;
10 import org.springframework.web.bind.annotation.*;
11 import io.swagger.annotations.*;
13 import javax.validation.Valid;
14 import java.util.List;
17 * Rest Interface for device service.
19 * @author <A HREF="mailto:m.dalakov@samsung.com">Mykhailo Dalakov</A>
22 @RequestMapping("/api/device-service")
23 public interface IRestDevice {
26 * POST /device-service : Register a new device.
28 * @param DInfo the device view model
29 * @return the ResponseEntity with status 200 or with status 400 (Bad Request)
31 @ApiOperation(value = "registerDevice", notes = "The “Register device” operation is used for device registration. "
33 @ApiResponses(value = {
34 @ApiResponse(code = 200, message = "OK. Device is successfully registered"),
35 @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
36 @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
38 @RequestMapping(value ="/register-device", method = RequestMethod.POST)
39 public ResponseEntity<String> registerDevice(
40 @ApiParam(value = "Device info", required = true) @Valid @RequestBody RegisterDeviceRestService.DInfo DInfo);
46 @ApiOperation(value = "getUpdates", notes =
47 "The “Get updates” operation is used to obtain information about changes " +
48 "which should be applied on device. For example: policies, whitelist, blacklist, state, etc. "
50 @ApiResponses(value = {
51 @ApiResponse(code = 200, message = "OK. The updates are found and should apply by device."),
52 @ApiResponse(code = 304, message = "Not Modified. The updates aren’t required"),
53 @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
54 @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
56 @RequestMapping(value ="/get-updates", method = RequestMethod.GET, produces = {
57 MediaType.APPLICATION_JSON_VALUE })
58 public ResponseEntity<List<GetUpdatesRestService.UInfo>> getUpdates(
59 @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid);
65 @ApiOperation(value = "sendData", notes =
66 "The “Send data” operation is used to send data (like as reports, notifications, policies, states, etc)" +
69 @ApiResponses(value = {
70 @ApiResponse(code = 200, message = "OK. Send data was successful."),
71 @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
72 @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
74 @RequestMapping(value ="/send-data", method = RequestMethod.POST)
75 public ResponseEntity<Void> sendData(
76 @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid,
77 @Valid @ApiParam(value = "Device Data", required = true) @RequestBody SendDataRestService.Data data);
83 @ApiOperation(value = "getUData", notes =
84 "The “Get updates data” operation is used to obtain data " +
85 "which should be applied on device. For example: policies, whitelist, blacklist, state, etc. "
87 @ApiResponses(value = {
88 @ApiResponse(code = 200, message = "OK. The data are found and should apply by device."),
89 @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
90 @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
92 @RequestMapping(value ="/get-udata", method = RequestMethod.GET)
93 public ResponseEntity<String> getUData(
94 @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid,
95 @ApiParam(value = "Update identity", required = true) @RequestParam(value = "uuid") String uuid);
99 * POST send data confirm
101 @ApiOperation(value = "sendDataConfirm", notes =
102 "The “Send data confirm” operation is used to confirm that device applied updates."
104 @ApiResponses(value = {
105 @ApiResponse(code = 200, message = "OK. Confirmation is successfully."),
106 @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
107 @ApiResponse(code = 500, message = "Internal server error. The device has to repeat action")
109 @RequestMapping(value ="/send-data/confirm", method = RequestMethod.POST)
110 public ResponseEntity<Void> sendDataConfirm(
111 @ApiParam(value = "Device identity", required = true) @RequestParam(value = "duid") String duid,
112 @ApiParam(value = "Update identity", required = true) @RequestParam(value = "uuid") String uuid);