Package restapi.controllers
Class ContactPreferencesController
java.lang.Object
restapi.controllers.ContactPreferencesController
@RestController
@RequestMapping("/contact")
public class ContactPreferencesController
extends Object
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull ContactPreferencesService
private final @NonNull ContactService
private final @NonNull UserService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<RestResponse>
getContactPreferences
(LoggedUser user, long contactId) Endpoint to get the details of specific contact endpoint /contact/detailsorg.springframework.http.ResponseEntity<RestResponse>
getContacts
(LoggedUser user) Endpoint to get all contacts for User endpoint /contact/allorg.springframework.http.ResponseEntity<RestResponse>
updateContactBlocked
(LoggedUser user, long contactId, boolean blocked) Changes if a given contact is blocked by user or not, and updates the shared preferences.org.springframework.http.ResponseEntity<RestResponse>
updateContactRange
(LoggedUser user, long contactId, long range) Endpoint to update range for specific contact endpoint /contact/range
-
Field Details
-
userService
-
contactPreferencesService
-
contactService
-
-
Constructor Details
-
ContactPreferencesController
public ContactPreferencesController()
-
-
Method Details
-
getContacts
@GetMapping("/all") public org.springframework.http.ResponseEntity<RestResponse> getContacts(@AuthenticationPrincipal LoggedUser user) Endpoint to get all contacts for User endpoint /contact/all- Parameters:
user
- Authenticated LoggedUser from token- Returns:
- user's contacts
-
getContactPreferences
@GetMapping("/details") public org.springframework.http.ResponseEntity<RestResponse> getContactPreferences(@AuthenticationPrincipal LoggedUser user, @RequestParam long contactId) Endpoint to get the details of specific contact endpoint /contact/details- Parameters:
user
- Authenticated LoggedUser from tokencontactId
- id of contact to get the details from- Returns:
- contacts' details in form of ContactDTO
- See Also:
-
updateContactRange
@PutMapping("/range") public org.springframework.http.ResponseEntity<RestResponse> updateContactRange(@AuthenticationPrincipal LoggedUser user, @RequestParam long contactId, @RequestParam long range) Endpoint to update range for specific contact endpoint /contact/range- Parameters:
user
- Authenticated LoggedUser from tokencontactId
- Id of contact we want to change the range forrange
- New range to save on database- Returns:
- Rest Message OK or Error 404
-
updateContactBlocked
@PutMapping("/block") public org.springframework.http.ResponseEntity<RestResponse> updateContactBlocked(@AuthenticationPrincipal LoggedUser user, @RequestParam long contactId, @RequestParam boolean blocked) Changes if a given contact is blocked by user or not, and updates the shared preferences. The end result of blocked is given by the parameter blocked. endpoint /contact/block- Parameters:
user
- Authenticated LoggedUser from tokencontactId
- Id of contact we want to block or unblockblocked
- True if the user wants to block contact, false otherwise- Returns:
- Rest Message OK or Error 404
-