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.domain.Device;
9 import com.samsung.samserver.web.rest.service.AccountService;
10 import com.samsung.samserver.web.rest.service.UserJWTService;
11 import org.springframework.http.HttpStatus;
12 import org.springframework.http.ResponseEntity;
13 import org.springframework.web.bind.annotation.*;
14 import io.swagger.annotations.*;
16 import javax.validation.Valid;
17 import java.util.List;
18 import com.samsung.samserver.web.rest.errors.UserServiceError;
21 * Rest Interface for dashboard.
23 * @author <A HREF="mailto:m.dalakov@samsung.com">Mykhailo Dalakov</A>
26 @RequestMapping("/dashboard")
27 public interface IRestDashboard {
30 * GET /devices : get all the devices.
32 * @return the ResponseEntity with status 200 (OK) and the list of devices in body
34 @ApiOperation(value = "getAllDevices", notes = "The “getAllDevices” operation is used to obtain all registered devices.")
35 @ApiResponses(value = {
36 @ApiResponse(code = 200, message = "OK. Request executed successfully."),
37 @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
38 @ApiResponse(code = 500, message = "Internal server error. The user has to repeat action.")
40 @RequestMapping(value ="/devices", method = RequestMethod.GET)
41 public List<Device> getAllDevices();
47 * @return the ResponseEntity with status 200 (OK) and JWT
49 @ApiOperation(value = "login", notes = "The “login” operation is used to authenticate user and receive JWT token.")
50 @ApiResponses(value = {
51 @ApiResponse(code = 200, message = "OK. Login was successful."),
52 @ApiResponse(code = 400, message = "Bad Request. The reason is contained in the tags “errorKey”, “message”, “title”"),
53 @ApiResponse(code = 500, message = "Internal server error. The user has to repeat action.")
55 @RequestMapping(value ="/auth/login", method = RequestMethod.POST)
56 public ResponseEntity<UserJWTService.JWTToken> login(
57 @Valid @ApiParam(value = "Login Data", required = true) @RequestBody UserJWTService.LoginVM loginVM);
61 * POST request register the user.
63 * @param managedUserVM the managed user View Model
64 * @throws UserServiceError.InvalidPasswordException 400 (Bad Request) if the password is incorrect
65 * @throws UserServiceError.EmailAlreadyUsedException 400 (Bad Request) if the email is already used
66 * @throws UserServiceError.LoginAlreadyUsedException 400 (Bad Request) if the login is already used
68 @ApiOperation(value = "register", notes = "The “register” operation is used to register new user.")
69 @ApiResponses(value = {
70 @ApiResponse(code = 201, message = "Register was successful. New User was created."),
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 user has to repeat action.")
74 @RequestMapping(value ="/auth/register", method = RequestMethod.POST)
75 @ResponseStatus(HttpStatus.CREATED)
76 public void registerAccount(
77 @Valid @ApiParam(value = "Managed User", required = true) @RequestBody AccountService.ManagedUserVM managedUserVM);