2024-06-22 10:05:41 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
)
|
|
|
|
|
2024-07-16 09:01:27 +00:00
|
|
|
func MapAPIs(app *fiber.App, baseURL string) {
|
|
|
|
api := app.Group(baseURL).Name("API")
|
2024-06-22 10:05:41 +00:00
|
|
|
{
|
|
|
|
channels := api.Group("/channels/:realm").Use(realmMiddleware).Name("Channels API")
|
|
|
|
{
|
|
|
|
channels.Get("/", listChannel)
|
|
|
|
channels.Get("/me", listOwnedChannel)
|
|
|
|
channels.Get("/me/available", listAvailableChannel)
|
|
|
|
channels.Get("/:channel", getChannel)
|
|
|
|
channels.Get("/:channel/me", getChannelIdentity)
|
|
|
|
|
|
|
|
channels.Post("/", createChannel)
|
|
|
|
channels.Post("/dm", createDirectChannel)
|
|
|
|
channels.Put("/:channelId", editChannel)
|
|
|
|
channels.Delete("/:channelId", deleteChannel)
|
|
|
|
|
|
|
|
channels.Get("/:channel/members", listChannelMembers)
|
|
|
|
channels.Get("/:channel/members/me", getMyChannelMembership)
|
|
|
|
channels.Put("/:channel/members/me", editMyChannelMembership)
|
|
|
|
channels.Post("/:channel/members", addChannelMember)
|
|
|
|
channels.Post("/:channel/members/me", joinChannel)
|
|
|
|
channels.Delete("/:channel/members", removeChannelMember)
|
|
|
|
channels.Delete("/:channel/members/me", leaveChannel)
|
|
|
|
|
2024-06-27 14:38:18 +00:00
|
|
|
channels.Get("/:channel/events", listEvent)
|
2024-11-16 14:26:23 +00:00
|
|
|
channels.Get("/:channel/events/update", checkHasNewEvent)
|
2024-06-27 20:34:49 +00:00
|
|
|
channels.Get("/:channel/events/:eventId", getEvent)
|
2024-06-27 14:38:18 +00:00
|
|
|
channels.Post("/:channel/events", newRawEvent)
|
|
|
|
|
|
|
|
channels.Post("/:channel/messages", newMessageEvent)
|
|
|
|
channels.Put("/:channel/messages/:messageId", editMessageEvent)
|
|
|
|
channels.Delete("/:channel/messages/:messageId", deleteMessageEvent)
|
2024-06-22 10:05:41 +00:00
|
|
|
|
|
|
|
channels.Get("/:channel/calls", listCall)
|
|
|
|
channels.Get("/:channel/calls/ongoing", getOngoingCall)
|
|
|
|
channels.Post("/:channel/calls", startCall)
|
|
|
|
channels.Delete("/:channel/calls/ongoing", endCall)
|
2024-07-17 03:03:35 +00:00
|
|
|
channels.Delete("/:channel/calls/ongoing/participant", kickParticipantInCall)
|
2024-06-22 10:05:41 +00:00
|
|
|
channels.Post("/:channel/calls/ongoing/token", exchangeCallToken)
|
|
|
|
}
|
2024-09-03 12:30:47 +00:00
|
|
|
|
|
|
|
api.Get("/whats-new", getWhatsNew)
|
2024-06-22 10:05:41 +00:00
|
|
|
}
|
|
|
|
}
|