Skip to content

Commit

Permalink
cleanup chat endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
astanik committed Jan 18, 2025
1 parent c7ce67d commit d1dae8f
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 145 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
public interface ChatEndpoint {

String SERVICE = "chat";
String SERVICE = "chats";

@POST
@Consumes(MediaType.APPLICATION_JSON)
Expand All @@ -36,7 +36,9 @@ public interface ChatEndpoint {
@APIResponse(responseCode = "404", description = "Project or task not found")
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response createChatSession();
Response createChatSession(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId);

@GET
@Path("/{sessionId}")
Expand All @@ -48,6 +50,8 @@ public interface ChatEndpoint {
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response getChatSession(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId);

@DELETE
Expand All @@ -60,6 +64,8 @@ Response getChatSession(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response deleteChatSession(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId);

@PUT
Expand All @@ -73,6 +79,8 @@ Response deleteChatSession(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response updateChatSessionStatus(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId,
@Parameter(description = "New status for the chat session", required = true)
@Valid @NotNull ChatSessionModel.Status status);
Expand All @@ -88,6 +96,8 @@ Response updateChatSessionStatus(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response joinChatSession(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId);

@GET
Expand All @@ -100,6 +110,8 @@ Response joinChatSession(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response getParticipants(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId);

@GET
Expand All @@ -112,6 +124,8 @@ Response getParticipants(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response getParticipant(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId,
@Parameter(description = "The participant ID", required = true) @PathParam("participantId")
@NotNull @UUID String participantId);
Expand All @@ -127,6 +141,8 @@ Response getParticipant(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response changeParticipantRole(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId,
@Parameter(description = "The participant ID", required = true) @PathParam("participantId")
@NotNull @UUID String participantId,
Expand All @@ -143,6 +159,8 @@ Response changeParticipantRole(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response removeParticipant(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId,
@Parameter(description = "The participant ID to remove", required = true)
@PathParam("participantId") @NotNull @UUID String participantId);
Expand All @@ -159,6 +177,8 @@ Response removeParticipant(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response sendMessage(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId,
@Parameter(description = "Message content", required = true) @Valid @NotNull ChatMessageJson message);

Expand All @@ -172,6 +192,8 @@ Response sendMessage(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response getChatMessage(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId,
@Parameter(description = "The chat message ID", required = true) @PathParam("messageId")
@NotNull @UUID String messageId) throws Exception;
Expand All @@ -188,6 +210,8 @@ Response getChatMessage(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response updateChatMessage(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId,
@Parameter(description = "The chat message ID", required = true) @PathParam("messageId")
@NotNull @UUID String messageId,
Expand All @@ -204,6 +228,8 @@ Response updateChatMessage(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response deleteChatMessage(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId,
@Parameter(description = "The chat message ID to delete", required = true) @PathParam("messageId")
@NotNull @UUID String messageId);
Expand All @@ -218,6 +244,8 @@ Response deleteChatMessage(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response getChatMessages(
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId);

@POST
Expand All @@ -232,8 +260,9 @@ Response getChatMessages(
@APIResponse(responseCode = "500", description = "Internal server error")
@APIResponse(responseCode = "401", description = "No user authentication provided via session cookie")
Response uploadFile(
@PathParam("sessionId") @NotNull @UUID String sessionId,
@Parameter(description = "Multipart file input", required = true) MultipartFormDataInput input)
throws Exception;
@Parameter(description = "ID of the project", required = true)
@PathParam("projectId") @NotNull @UUID String projectId,
@PathParam("sessionId") @NotNull @UUID String sessionId,
@Parameter(description = "Multipart file input", required = true) MultipartFormDataInput input);

}
Loading

0 comments on commit d1dae8f

Please sign in to comment.