Package org.vrspace.server.api
Class Groups
java.lang.Object
org.vrspace.server.api.ApiBase
org.vrspace.server.api.ClientControllerBase
org.vrspace.server.api.Groups
@RestController
@RequestMapping("/vrspace/api/groups")
public class Groups
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. Only group members can read and
write group messages. Groups can public or private: everybody can join public
groups, and private groups require invitation by group owner(s). Temporary
groups are deleted after owner disconnects.
- Author:
- joe
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Accept invitation to a private group.void
Allow a user (who asked) to join a private group.void
Ask to join a private group.create
(String name, Optional<Boolean> isPublic, Optional<Boolean> isTemporary, jakarta.servlet.http.HttpSession session) Create a group.void
deleteGroup
(String groupId, jakarta.servlet.http.HttpSession session) Delete a group.Get a group.void
Invite a user to a group.void
Join a public group.void
Kick a user from a group.void
Leave a group.listInvites
(jakarta.servlet.http.HttpSession session) List pending invitations to groups for the current user.listMyGroups
(jakarta.servlet.http.HttpSession session) List all user groups the user is member of.listOwnedGroups
(jakarta.servlet.http.HttpSession session) List all user groups the user owns.listOwners
(String groupId, jakarta.servlet.http.HttpSession session) listRequests
(String groupId, jakarta.servlet.http.HttpSession session) List pending requests to join the group.listUnreadGroups
(jakarta.servlet.http.HttpSession session) listUnreadMessages
(String groupId, jakarta.servlet.http.HttpSession session) void
shareWorld
(String groupId, GroupMessage worldShare, jakarta.servlet.http.HttpSession session) Share a world link with the group.Show all members of a group.void
Update a group.void
Write something to a group.Methods inherited from class org.vrspace.server.api.ClientControllerBase
findClient, findClient, getAuthorisedClient, getAuthorisedClient, isAuthenticated
Methods inherited from class org.vrspace.server.api.ApiBase
currentUserName, isAuthenticated
-
Field Details
-
PATH
- See Also:
-
-
Constructor Details
-
Groups
public Groups()
-
-
Method Details
-
listMyGroups
@GetMapping @ResponseBody public List<UserGroup> listMyGroups(jakarta.servlet.http.HttpSession session) List all user groups the user is member of. -
listOwnedGroups
@GetMapping("/owned") @ResponseBody public List<UserGroup> listOwnedGroups(jakarta.servlet.http.HttpSession session) List all user groups the user owns. -
create
@PostMapping(produces="application/json") @ResponseStatus(CREATED) public UserGroup create(String name, Optional<Boolean> isPublic, Optional<Boolean> isTemporary, jakarta.servlet.http.HttpSession session) Create a group.- Parameters:
name
- Group nameisPublic
- Create a public group? Defaults to false.isTemporary
- Create a temporary group? Defaults to false.
-
update
@PutMapping(produces="application/json") public void update(@RequestBody UserGroup group, jakarta.servlet.http.HttpSession session) Update a group.- Parameters:
group
- updated group
-
deleteGroup
@DeleteMapping("/{groupId}") public void deleteGroup(@PathVariable String groupId, jakarta.servlet.http.HttpSession session) Delete a group. A group can only be deleted by the owner(s). -
getGroup
@GetMapping("/{groupId}") public UserGroup getGroup(@PathVariable String groupId, jakarta.servlet.http.HttpSession session) Get a group. -
show
@GetMapping("/{groupId}/show") public List<Client> show(@PathVariable String groupId, jakarta.servlet.http.HttpSession session) Show all members of a group. -
join
@PostMapping("/{groupId}/join") public void join(@PathVariable String groupId, jakarta.servlet.http.HttpSession session) Join a public group. -
invite
@PostMapping("/{groupId}/invite") public void invite(@PathVariable String groupId, String clientId, jakarta.servlet.http.HttpSession session) Invite a user to a group. Only group owner(s) can invite users to private groups. Invited users have to accept invitation. Offline users may get web push notification, if these are configured.- Parameters:
groupId
- Group to invite toclientId
- Client to invite
-
ask
@PostMapping("/{groupId}/ask") public void ask(@PathVariable String 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 String groupId, jakarta.servlet.http.HttpSession session) Accept invitation to a private group. -
allow
@PostMapping("/{groupId}/allow") public void allow(@PathVariable String groupId, String 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 String 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 String groupId, String 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 String groupId, @RequestBody String text, jakarta.servlet.http.HttpSession session) Write something to a group. Online users are notified right away over the web socket, offline users may get web push notification, if these are configured.- Parameters:
groupId
- The grouptext
- The message
-
listRequests
@GetMapping("/{groupId}/requests") public List<GroupMember> listRequests(@PathVariable String 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<GroupMember> listInvites(jakarta.servlet.http.HttpSession session) List pending invitations to groups for the current user.- Parameters:
session
-
-
listUnreadGroups
-
listUnreadMessages
@GetMapping("/{groupId}/unread") public List<GroupMessage> listUnreadMessages(@PathVariable String groupId, jakarta.servlet.http.HttpSession session) -
listOwners
-