dendrite/roomserver/inthttp/server.go

202 lines
5.5 KiB
Go
Raw Normal View History

package inthttp
import (
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/internal/httputil"
"github.com/matrix-org/dendrite/roomserver/api"
)
// AddRoutes adds the RoomserverInternalAPI handlers to the http.ServeMux.
// nolint: gocyclo
func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) {
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverInputRoomEventsPath,
httputil.MakeInternalRPCAPI("InputRoomEvents", r.InputRoomEvents),
)
internalAPIMux.Handle(
RoomserverPerformInvitePath,
httputil.MakeInternalRPCAPI("PerformInvite", r.PerformInvite),
)
internalAPIMux.Handle(
RoomserverPerformJoinPath,
httputil.MakeInternalRPCAPI("PerformJoin", r.PerformJoin),
)
internalAPIMux.Handle(
RoomserverPerformLeavePath,
httputil.MakeInternalRPCAPI("PerformLeave", r.PerformLeave),
)
internalAPIMux.Handle(
RoomserverPerformPeekPath,
httputil.MakeInternalRPCAPI("PerformPeek", r.PerformPeek),
)
internalAPIMux.Handle(
RoomserverPerformInboundPeekPath,
httputil.MakeInternalRPCAPI("PerformInboundPeek", r.PerformInboundPeek),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverPerformUnpeekPath,
httputil.MakeInternalRPCAPI("PerformUnpeek", r.PerformUnpeek),
)
internalAPIMux.Handle(
RoomserverPerformRoomUpgradePath,
httputil.MakeInternalRPCAPI("PerformRoomUpgrade", r.PerformRoomUpgrade),
)
internalAPIMux.Handle(
RoomserverPerformPublishPath,
httputil.MakeInternalRPCAPI("PerformPublish", r.PerformPublish),
)
internalAPIMux.Handle(
RoomserverPerformAdminEvacuateRoomPath,
httputil.MakeInternalRPCAPI("PerformAdminEvacuateRoom", r.PerformAdminEvacuateRoom),
)
internalAPIMux.Handle(
RoomserverPerformAdminEvacuateUserPath,
httputil.MakeInternalRPCAPI("PerformAdminEvacuateUser", r.PerformAdminEvacuateUser),
)
internalAPIMux.Handle(
RoomserverQueryPublishedRoomsPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryPublishedRooms", r.QueryPublishedRooms),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryLatestEventsAndStatePath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryLatestEventsAndState", r.QueryLatestEventsAndState),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryStateAfterEventsPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryStateAfterEvents", r.QueryStateAfterEvents),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryEventsByIDPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryEventsByID", r.QueryEventsByID),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryMembershipForUserPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryMembershipForUser", r.QueryMembershipForUser),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryMembershipsForRoomPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryMembershipsForRoom", r.QueryMembershipsForRoom),
)
internalAPIMux.Handle(
RoomserverQueryServerJoinedToRoomPath,
httputil.MakeInternalRPCAPI("QueryServerJoinedToRoom", r.QueryServerJoinedToRoom),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryServerJoinedToRoomPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryServerJoinedToRoom", r.QueryServerJoinedToRoom),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryServerAllowedToSeeEventPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryServerAllowedToSeeEvent", r.QueryServerAllowedToSeeEvent),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryMissingEventsPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryMissingEvents", r.QueryMissingEvents),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryStateAndAuthChainPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryStateAndAuthChain", r.QueryStateAndAuthChain),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverPerformBackfillPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("PerformBackfill", r.PerformBackfill),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverPerformForgetPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("PerformForget", r.PerformForget),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryRoomVersionCapabilitiesPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryRoomVersionCapabilities", r.QueryRoomVersionCapabilities),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverQueryRoomVersionForRoomPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("QueryRoomVersionForRoom", r.QueryRoomVersionForRoom),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverSetRoomAliasPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("SetRoomAlias", r.SetRoomAlias),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverGetRoomIDForAliasPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("GetRoomIDForAlias", r.GetRoomIDForAlias),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverGetAliasesForRoomIDPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("GetAliasesForRoomID", r.GetAliasesForRoomID),
)
2022-08-08 09:36:14 -05:00
internalAPIMux.Handle(
RoomserverRemoveRoomAliasPath,
2022-08-08 09:36:14 -05:00
httputil.MakeInternalRPCAPI("RemoveRoomAlias", r.RemoveRoomAlias),
)
internalAPIMux.Handle(
RoomserverQueryCurrentStatePath,
httputil.MakeInternalRPCAPI("QueryCurrentState", r.QueryCurrentState),
)
internalAPIMux.Handle(
RoomserverQueryRoomsForUserPath,
httputil.MakeInternalRPCAPI("QueryRoomsForUser", r.QueryRoomsForUser),
)
internalAPIMux.Handle(
RoomserverQueryBulkStateContentPath,
httputil.MakeInternalRPCAPI("QueryBulkStateContent", r.QueryBulkStateContent),
)
internalAPIMux.Handle(
RoomserverQuerySharedUsersPath,
httputil.MakeInternalRPCAPI("QuerySharedUsers", r.QuerySharedUsers),
)
internalAPIMux.Handle(
RoomserverQueryKnownUsersPath,
httputil.MakeInternalRPCAPI("QueryKnownUsers", r.QueryKnownUsers),
)
internalAPIMux.Handle(
RoomserverQueryServerBannedFromRoomPath,
httputil.MakeInternalRPCAPI("QueryServerBannedFromRoom", r.QueryServerBannedFromRoom),
)
internalAPIMux.Handle(
RoomserverQueryAuthChainPath,
httputil.MakeInternalRPCAPI("QueryAuthChain", r.QueryAuthChain),
)
internalAPIMux.Handle(
RoomserverQueryRestrictedJoinAllowed,
httputil.MakeInternalRPCAPI("QueryRestrictedJoinAllowed", r.QueryRestrictedJoinAllowed),
)
}