Package org.vrspace.server.api
Class GroupController
java.lang.Object
org.vrspace.server.api.ApiBase
org.vrspace.server.api.ClientControllerBase
org.vrspace.server.api.GroupController
@RestController
@RequestMapping("/vrspace/api/groups")
public class GroupController
extends ClientControllerBase
Manipulate user groups. All of these operations require a session with a
valid user currently logged in. So: login with either github, fb, google, and
enter a world before trying any of these.
- Author:
- joe
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(long groupId, jakarta.servlet.http.HttpSession session) Accept invitation to a private group.void
allow
(long groupId, long clientId, jakarta.servlet.http.HttpSession session) Allow a user (who asked) to join a private group.void
ask
(long groupId, jakarta.servlet.http.HttpSession session) Ask to join a private group.Create a group.void
delete
(long groupId, jakarta.servlet.http.HttpSession session) Delete a group.protected Client
getAuthorisedClient
(jakarta.servlet.http.HttpSession session) void
Invite a user a private group.void
join
(long groupId, jakarta.servlet.http.HttpSession session) Join a public group.void
kick
(long groupId, long clientId, jakarta.servlet.http.HttpSession session) Kick a user from a group.void
leave
(long groupId, jakarta.servlet.http.HttpSession session) Leave a group.list
(jakarta.servlet.http.HttpSession session) List all user groups the user belongs to.listInvites
(jakarta.servlet.http.HttpSession session) List pending invitations to groups for the current user.listRequests
(long groupId, jakarta.servlet.http.HttpSession session) List pending requests to join the group.show
(long groupId, jakarta.servlet.http.HttpSession session) Show all members of a group.void
Write something to a group.Methods inherited from class org.vrspace.server.api.ClientControllerBase
findClient, isAuthenticated
Methods inherited from class org.vrspace.server.api.ApiBase
currentUserName, isAuthenticated
-
Field Details
-
PATH
- See Also:
-
-
Constructor Details
-
GroupController
public GroupController()
-
-
Method Details
-
list
List all user groups the user belongs to. -
create
@PostMapping(produces="application/json") @ResponseStatus(CREATED) public UserGroup create(String name, Optional<Boolean> isPrivate, jakarta.servlet.http.HttpSession session) Create a group.- Parameters:
name
- Group nameisPrivate
- Create a private group? Defaults to false.
-
delete
@DeleteMapping("/{groupId}") public void delete(@PathVariable long groupId, jakarta.servlet.http.HttpSession session) Delete a group. A group can only be deleted by the owner(s). -
show
@GetMapping("/{groupId}/show") public List<Client> show(@PathVariable long groupId, jakarta.servlet.http.HttpSession session) Show all members of a group. -
join
@PostMapping("/{groupId}/join") public void join(@PathVariable long groupId, jakarta.servlet.http.HttpSession session) Join a public group. -
invite
@PostMapping("/{groupId}/invite") public void invite(@PathVariable long groupId, Long clientId, jakarta.servlet.http.HttpSession session) Invite a user a private group. Only group owner(s) can invite users. Invited users have to accept invitation.- Parameters:
groupId
- Group to invite toclientId
- Client to invite
-
ask
@PostMapping("/{groupId}/ask") public void ask(@PathVariable long groupId, jakarta.servlet.http.HttpSession session) Ask to join a private group. Group owner needs to allow new members to join. -
accept
@PostMapping("/{groupId}/accept") public void accept(@PathVariable long groupId, jakarta.servlet.http.HttpSession session) Accept invitation to a private group. -
allow
@PostMapping("/{groupId}/allow") public void allow(@PathVariable long groupId, long clientId, jakarta.servlet.http.HttpSession session) Allow a user (who asked) to join a private group. Only group owner(s) can do that.- Parameters:
groupId
- Group to joinclientId
- Client that asked to join
-
leave
@PostMapping("/{groupId}/leave") public void leave(@PathVariable long groupId, jakarta.servlet.http.HttpSession session) Leave a group. Group owners can not leave. Also used to reject invitation to join the group. -
kick
@PostMapping("/{groupId}/kick") public void kick(@PathVariable long groupId, long clientId, jakarta.servlet.http.HttpSession session) Kick a user from a group. Only group owner(s) can do that. Also used to reject request to join.- Parameters:
groupId
- Where to kick fromclientId
- Whom to kick
-
write
@PostMapping("/{groupId}/write") public void write(@PathVariable long groupId, @RequestBody String text, jakarta.servlet.http.HttpSession session) Write something to a group.- Parameters:
groupId
- The grouptext
- The message
-
listRequests
@GetMapping("/{groupId}/requests") public List<GroupMember> listRequests(@PathVariable long groupId, jakarta.servlet.http.HttpSession session) List pending requests to join the group. Only group owners can do that.- Parameters:
groupId
-
-
listInvites
@GetMapping("/invitations") public List<UserGroup> listInvites(jakarta.servlet.http.HttpSession session) List pending invitations to groups for the current user.- Parameters:
session
-- Returns:
-
getAuthorisedClient
-