Use paths as metric names

This commit is contained in:
Neil Alexander 2022-08-08 16:04:05 +01:00
parent 60e204ae45
commit a9323a6a34
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
5 changed files with 109 additions and 107 deletions

View file

@ -10,11 +10,11 @@ import (
func AddRoutes(a api.AppServiceInternalAPI, internalAPIMux *mux.Router) { func AddRoutes(a api.AppServiceInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
AppServiceRoomAliasExistsPath, AppServiceRoomAliasExistsPath,
httputil.MakeInternalRPCAPI("AppserviceRoomAliasExists", a.RoomAliasExists), httputil.MakeInternalRPCAPI(AppServiceRoomAliasExistsPath, a.RoomAliasExists),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
AppServiceUserIDExistsPath, AppServiceUserIDExistsPath,
httputil.MakeInternalRPCAPI("AppserviceUserIDExists", a.UserIDExists), httputil.MakeInternalRPCAPI(AppServiceUserIDExistsPath, a.UserIDExists),
) )
} }

View file

@ -17,33 +17,33 @@ import (
func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) { func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIQueryJoinedHostServerNamesInRoomPath, FederationAPIQueryJoinedHostServerNamesInRoomPath,
httputil.MakeInternalRPCAPI("QueryJoinedHostServerNamesInRoom", intAPI.QueryJoinedHostServerNamesInRoom), httputil.MakeInternalRPCAPI(FederationAPIQueryJoinedHostServerNamesInRoomPath, intAPI.QueryJoinedHostServerNamesInRoom),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIPerformInviteRequestPath, FederationAPIPerformInviteRequestPath,
httputil.MakeInternalRPCAPI("PerformInvite", intAPI.PerformInvite), httputil.MakeInternalRPCAPI(FederationAPIPerformInviteRequestPath, intAPI.PerformInvite),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIPerformLeaveRequestPath, FederationAPIPerformLeaveRequestPath,
httputil.MakeInternalRPCAPI("PerformLeave", intAPI.PerformLeave), httputil.MakeInternalRPCAPI(FederationAPIPerformLeaveRequestPath, intAPI.PerformLeave),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIPerformDirectoryLookupRequestPath, FederationAPIPerformDirectoryLookupRequestPath,
httputil.MakeInternalRPCAPI("PerformDirectoryLookupRequest", intAPI.PerformDirectoryLookup), httputil.MakeInternalRPCAPI(FederationAPIPerformDirectoryLookupRequestPath, intAPI.PerformDirectoryLookup),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIPerformBroadcastEDUPath, FederationAPIPerformBroadcastEDUPath,
httputil.MakeInternalRPCAPI("PerformBroadcastEDU", intAPI.PerformBroadcastEDU), httputil.MakeInternalRPCAPI(FederationAPIPerformBroadcastEDUPath, intAPI.PerformBroadcastEDU),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIPerformJoinRequestPath, FederationAPIPerformJoinRequestPath,
httputil.MakeInternalRPCAPI( httputil.MakeInternalRPCAPI(
"PerformJoinRequest", FederationAPIPerformJoinRequestPath,
func(ctx context.Context, req *api.PerformJoinRequest, res *api.PerformJoinResponse) error { func(ctx context.Context, req *api.PerformJoinRequest, res *api.PerformJoinResponse) error {
intAPI.PerformJoin(ctx, req, res) intAPI.PerformJoin(ctx, req, res)
return nil return nil
@ -54,7 +54,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIPerformJoinRequestPath, FederationAPIPerformJoinRequestPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"GetUserDevices", FederationAPIPerformJoinRequestPath,
func(ctx context.Context, req *getUserDevices) (*gomatrixserverlib.RespUserDevices, error) { func(ctx context.Context, req *getUserDevices) (*gomatrixserverlib.RespUserDevices, error) {
res, err := intAPI.GetUserDevices(ctx, req.S, req.UserID) res, err := intAPI.GetUserDevices(ctx, req.S, req.UserID)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -65,7 +65,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIClaimKeysPath, FederationAPIClaimKeysPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"ClaimKeys", FederationAPIClaimKeysPath,
func(ctx context.Context, req *claimKeys) (*gomatrixserverlib.RespClaimKeys, error) { func(ctx context.Context, req *claimKeys) (*gomatrixserverlib.RespClaimKeys, error) {
res, err := intAPI.ClaimKeys(ctx, req.S, req.OneTimeKeys) res, err := intAPI.ClaimKeys(ctx, req.S, req.OneTimeKeys)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -76,7 +76,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIQueryKeysPath, FederationAPIQueryKeysPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"QueryKeys", FederationAPIQueryKeysPath,
func(ctx context.Context, req *queryKeys) (*gomatrixserverlib.RespQueryKeys, error) { func(ctx context.Context, req *queryKeys) (*gomatrixserverlib.RespQueryKeys, error) {
res, err := intAPI.QueryKeys(ctx, req.S, req.Keys) res, err := intAPI.QueryKeys(ctx, req.S, req.Keys)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -87,7 +87,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIBackfillPath, FederationAPIBackfillPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"Backfill", FederationAPIBackfillPath,
func(ctx context.Context, req *backfill) (*gomatrixserverlib.Transaction, error) { func(ctx context.Context, req *backfill) (*gomatrixserverlib.Transaction, error) {
res, err := intAPI.Backfill(ctx, req.S, req.RoomID, req.Limit, req.EventIDs) res, err := intAPI.Backfill(ctx, req.S, req.RoomID, req.Limit, req.EventIDs)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -98,7 +98,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPILookupStatePath, FederationAPILookupStatePath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"LookupState", FederationAPILookupStatePath,
func(ctx context.Context, req *lookupState) (*gomatrixserverlib.RespState, error) { func(ctx context.Context, req *lookupState) (*gomatrixserverlib.RespState, error) {
res, err := intAPI.LookupState(ctx, req.S, req.RoomID, req.EventID, req.RoomVersion) res, err := intAPI.LookupState(ctx, req.S, req.RoomID, req.EventID, req.RoomVersion)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -109,7 +109,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPILookupStateIDsPath, FederationAPILookupStateIDsPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"LookupStateIDs", FederationAPILookupStateIDsPath,
func(ctx context.Context, req *lookupStateIDs) (*gomatrixserverlib.RespStateIDs, error) { func(ctx context.Context, req *lookupStateIDs) (*gomatrixserverlib.RespStateIDs, error) {
res, err := intAPI.LookupStateIDs(ctx, req.S, req.RoomID, req.EventID) res, err := intAPI.LookupStateIDs(ctx, req.S, req.RoomID, req.EventID)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -120,7 +120,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPILookupMissingEventsPath, FederationAPILookupMissingEventsPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"LookupMissingEvents", FederationAPILookupMissingEventsPath,
func(ctx context.Context, req *lookupMissingEvents) (*gomatrixserverlib.RespMissingEvents, error) { func(ctx context.Context, req *lookupMissingEvents) (*gomatrixserverlib.RespMissingEvents, error) {
res, err := intAPI.LookupMissingEvents(ctx, req.S, req.RoomID, req.Missing, req.RoomVersion) res, err := intAPI.LookupMissingEvents(ctx, req.S, req.RoomID, req.Missing, req.RoomVersion)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -131,7 +131,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIGetEventPath, FederationAPIGetEventPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"GetEvent", FederationAPIGetEventPath,
func(ctx context.Context, req *getEvent) (*gomatrixserverlib.Transaction, error) { func(ctx context.Context, req *getEvent) (*gomatrixserverlib.Transaction, error) {
res, err := intAPI.GetEvent(ctx, req.S, req.EventID) res, err := intAPI.GetEvent(ctx, req.S, req.EventID)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -142,7 +142,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIGetEventAuthPath, FederationAPIGetEventAuthPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"GetEventAuth", FederationAPIGetEventAuthPath,
func(ctx context.Context, req *getEventAuth) (*gomatrixserverlib.RespEventAuth, error) { func(ctx context.Context, req *getEventAuth) (*gomatrixserverlib.RespEventAuth, error) {
res, err := intAPI.GetEventAuth(ctx, req.S, req.RoomVersion, req.RoomID, req.EventID) res, err := intAPI.GetEventAuth(ctx, req.S, req.RoomVersion, req.RoomID, req.EventID)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -152,13 +152,13 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIQueryServerKeysPath, FederationAPIQueryServerKeysPath,
httputil.MakeInternalRPCAPI("QueryServerKeys", intAPI.QueryServerKeys), httputil.MakeInternalRPCAPI(FederationAPIQueryServerKeysPath, intAPI.QueryServerKeys),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPILookupServerKeysPath, FederationAPILookupServerKeysPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"LookupServerKeys", FederationAPILookupServerKeysPath,
func(ctx context.Context, req *lookupServerKeys) (*[]gomatrixserverlib.ServerKeys, error) { func(ctx context.Context, req *lookupServerKeys) (*[]gomatrixserverlib.ServerKeys, error) {
res, err := intAPI.LookupServerKeys(ctx, req.S, req.KeyRequests) res, err := intAPI.LookupServerKeys(ctx, req.S, req.KeyRequests)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -169,7 +169,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPIEventRelationshipsPath, FederationAPIEventRelationshipsPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"MSC2836EventRelationships", FederationAPIEventRelationshipsPath,
func(ctx context.Context, req *eventRelationships) (*gomatrixserverlib.MSC2836EventRelationshipsResponse, error) { func(ctx context.Context, req *eventRelationships) (*gomatrixserverlib.MSC2836EventRelationshipsResponse, error) {
res, err := intAPI.MSC2836EventRelationships(ctx, req.S, req.Req, req.RoomVer) res, err := intAPI.MSC2836EventRelationships(ctx, req.S, req.Req, req.RoomVer)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -180,7 +180,7 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
FederationAPISpacesSummaryPath, FederationAPISpacesSummaryPath,
httputil.MakeInternalProxyAPI( httputil.MakeInternalProxyAPI(
"MSC2946SpacesSummary", FederationAPISpacesSummaryPath,
func(ctx context.Context, req *spacesReq) (*gomatrixserverlib.MSC2946SpacesResponse, error) { func(ctx context.Context, req *spacesReq) (*gomatrixserverlib.MSC2946SpacesResponse, error) {
res, err := intAPI.MSC2946Spaces(ctx, req.S, req.RoomID, req.SuggestedOnly) res, err := intAPI.MSC2946Spaces(ctx, req.S, req.RoomID, req.SuggestedOnly)
return &res, federationClientError(err) return &res, federationClientError(err)
@ -189,8 +189,9 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
) )
// TODO: Look at this shape // TODO: Look at this shape
internalAPIMux.Handle(FederationAPIQueryPublicKeyPath, internalAPIMux.Handle(
httputil.MakeInternalAPI("queryPublicKeys", func(req *http.Request) util.JSONResponse { FederationAPIQueryPublicKeyPath,
httputil.MakeInternalAPI(FederationAPIQueryPublicKeyPath, func(req *http.Request) util.JSONResponse {
request := api.QueryPublicKeysRequest{} request := api.QueryPublicKeysRequest{}
response := api.QueryPublicKeysResponse{} response := api.QueryPublicKeysResponse{}
if err := json.NewDecoder(req.Body).Decode(&request); err != nil { if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
@ -206,8 +207,9 @@ func AddRoutes(intAPI api.FederationInternalAPI, internalAPIMux *mux.Router) {
) )
// TODO: Look at this shape // TODO: Look at this shape
internalAPIMux.Handle(FederationAPIInputPublicKeyPath, internalAPIMux.Handle(
httputil.MakeInternalAPI("inputPublicKeys", func(req *http.Request) util.JSONResponse { FederationAPIInputPublicKeyPath,
httputil.MakeInternalAPI(FederationAPIInputPublicKeyPath, func(req *http.Request) util.JSONResponse {
request := api.InputPublicKeysRequest{} request := api.InputPublicKeysRequest{}
response := api.InputPublicKeysResponse{} response := api.InputPublicKeysResponse{}
if err := json.NewDecoder(req.Body).Decode(&request); err != nil { if err := json.NewDecoder(req.Body).Decode(&request); err != nil {

View file

@ -23,51 +23,51 @@ import (
func AddRoutes(internalAPIMux *mux.Router, s api.KeyInternalAPI) { func AddRoutes(internalAPIMux *mux.Router, s api.KeyInternalAPI) {
internalAPIMux.Handle( internalAPIMux.Handle(
PerformClaimKeysPath, PerformClaimKeysPath,
httputil.MakeInternalRPCAPI("PerformClaimKeys", s.PerformClaimKeys), httputil.MakeInternalRPCAPI(PerformClaimKeysPath, s.PerformClaimKeys),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformClaimKeysPath, PerformClaimKeysPath,
httputil.MakeInternalRPCAPI("PerformDeleteKeys", s.PerformDeleteKeys), httputil.MakeInternalRPCAPI(PerformClaimKeysPath, s.PerformDeleteKeys),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformUploadKeysPath, PerformUploadKeysPath,
httputil.MakeInternalRPCAPI("PerformUploadKeys", s.PerformUploadKeys), httputil.MakeInternalRPCAPI(PerformUploadKeysPath, s.PerformUploadKeys),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformUploadDeviceKeysPath, PerformUploadDeviceKeysPath,
httputil.MakeInternalRPCAPI("PerformUploadDeviceKeys", s.PerformUploadDeviceKeys), httputil.MakeInternalRPCAPI(PerformUploadDeviceKeysPath, s.PerformUploadDeviceKeys),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformUploadDeviceSignaturesPath, PerformUploadDeviceSignaturesPath,
httputil.MakeInternalRPCAPI("PerformUploadDeviceSignatures", s.PerformUploadDeviceSignatures), httputil.MakeInternalRPCAPI(PerformUploadDeviceSignaturesPath, s.PerformUploadDeviceSignatures),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryKeysPath, QueryKeysPath,
httputil.MakeInternalRPCAPI("QueryKeys", s.QueryKeys), httputil.MakeInternalRPCAPI(QueryKeysPath, s.QueryKeys),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryOneTimeKeysPath, QueryOneTimeKeysPath,
httputil.MakeInternalRPCAPI("QueryOneTimeKeys", s.QueryOneTimeKeys), httputil.MakeInternalRPCAPI(QueryOneTimeKeysPath, s.QueryOneTimeKeys),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryDeviceMessagesPath, QueryDeviceMessagesPath,
httputil.MakeInternalRPCAPI("QueryDeviceMessages", s.QueryDeviceMessages), httputil.MakeInternalRPCAPI(QueryDeviceMessagesPath, s.QueryDeviceMessages),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryKeyChangesPath, QueryKeyChangesPath,
httputil.MakeInternalRPCAPI("queryKeyChanges", s.QueryKeyChanges), httputil.MakeInternalRPCAPI(QueryKeyChangesPath, s.QueryKeyChanges),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QuerySignaturesPath, QuerySignaturesPath,
httputil.MakeInternalRPCAPI("QuerySignatures", s.QuerySignatures), httputil.MakeInternalRPCAPI(QuerySignaturesPath, s.QuerySignatures),
) )
} }

View file

@ -11,191 +11,191 @@ import (
func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) { func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverInputRoomEventsPath, RoomserverInputRoomEventsPath,
httputil.MakeInternalRPCAPI("InputRoomEvents", r.InputRoomEvents), httputil.MakeInternalRPCAPI(RoomserverInputRoomEventsPath, r.InputRoomEvents),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformInvitePath, RoomserverPerformInvitePath,
httputil.MakeInternalRPCAPI("PerformInvite", r.PerformInvite), httputil.MakeInternalRPCAPI(RoomserverPerformInvitePath, r.PerformInvite),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformJoinPath, RoomserverPerformJoinPath,
httputil.MakeInternalRPCAPI("PerformJoin", r.PerformJoin), httputil.MakeInternalRPCAPI(RoomserverPerformJoinPath, r.PerformJoin),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformLeavePath, RoomserverPerformLeavePath,
httputil.MakeInternalRPCAPI("PerformLeave", r.PerformLeave), httputil.MakeInternalRPCAPI(RoomserverPerformLeavePath, r.PerformLeave),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformPeekPath, RoomserverPerformPeekPath,
httputil.MakeInternalRPCAPI("PerformPeek", r.PerformPeek), httputil.MakeInternalRPCAPI(RoomserverPerformPeekPath, r.PerformPeek),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformInboundPeekPath, RoomserverPerformInboundPeekPath,
httputil.MakeInternalRPCAPI("PerformInboundPeek", r.PerformInboundPeek), httputil.MakeInternalRPCAPI(RoomserverPerformInboundPeekPath, r.PerformInboundPeek),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformUnpeekPath, RoomserverPerformUnpeekPath,
httputil.MakeInternalRPCAPI("PerformUnpeek", r.PerformUnpeek), httputil.MakeInternalRPCAPI(RoomserverPerformUnpeekPath, r.PerformUnpeek),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformRoomUpgradePath, RoomserverPerformRoomUpgradePath,
httputil.MakeInternalRPCAPI("PerformRoomUpgrade", r.PerformRoomUpgrade), httputil.MakeInternalRPCAPI(RoomserverPerformRoomUpgradePath, r.PerformRoomUpgrade),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformPublishPath, RoomserverPerformPublishPath,
httputil.MakeInternalRPCAPI("PerformPublish", r.PerformPublish), httputil.MakeInternalRPCAPI(RoomserverPerformPublishPath, r.PerformPublish),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformAdminEvacuateRoomPath, RoomserverPerformAdminEvacuateRoomPath,
httputil.MakeInternalRPCAPI("PerformAdminEvacuateRoom", r.PerformAdminEvacuateRoom), httputil.MakeInternalRPCAPI(RoomserverPerformAdminEvacuateRoomPath, r.PerformAdminEvacuateRoom),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformAdminEvacuateUserPath, RoomserverPerformAdminEvacuateUserPath,
httputil.MakeInternalRPCAPI("PerformAdminEvacuateUser", r.PerformAdminEvacuateUser), httputil.MakeInternalRPCAPI(RoomserverPerformAdminEvacuateUserPath, r.PerformAdminEvacuateUser),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryPublishedRoomsPath, RoomserverQueryPublishedRoomsPath,
httputil.MakeInternalRPCAPI("QueryPublishedRooms", r.QueryPublishedRooms), httputil.MakeInternalRPCAPI(RoomserverQueryPublishedRoomsPath, r.QueryPublishedRooms),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryLatestEventsAndStatePath, RoomserverQueryLatestEventsAndStatePath,
httputil.MakeInternalRPCAPI("QueryLatestEventsAndState", r.QueryLatestEventsAndState), httputil.MakeInternalRPCAPI(RoomserverQueryLatestEventsAndStatePath, r.QueryLatestEventsAndState),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryStateAfterEventsPath, RoomserverQueryStateAfterEventsPath,
httputil.MakeInternalRPCAPI("QueryStateAfterEvents", r.QueryStateAfterEvents), httputil.MakeInternalRPCAPI(RoomserverQueryStateAfterEventsPath, r.QueryStateAfterEvents),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryEventsByIDPath, RoomserverQueryEventsByIDPath,
httputil.MakeInternalRPCAPI("QueryEventsByID", r.QueryEventsByID), httputil.MakeInternalRPCAPI(RoomserverQueryEventsByIDPath, r.QueryEventsByID),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryMembershipForUserPath, RoomserverQueryMembershipForUserPath,
httputil.MakeInternalRPCAPI("QueryMembershipForUser", r.QueryMembershipForUser), httputil.MakeInternalRPCAPI(RoomserverQueryMembershipForUserPath, r.QueryMembershipForUser),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryMembershipsForRoomPath, RoomserverQueryMembershipsForRoomPath,
httputil.MakeInternalRPCAPI("QueryMembershipsForRoom", r.QueryMembershipsForRoom), httputil.MakeInternalRPCAPI(RoomserverQueryMembershipsForRoomPath, r.QueryMembershipsForRoom),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryServerJoinedToRoomPath, RoomserverQueryServerJoinedToRoomPath,
httputil.MakeInternalRPCAPI("QueryServerJoinedToRoom", r.QueryServerJoinedToRoom), httputil.MakeInternalRPCAPI(RoomserverQueryServerJoinedToRoomPath, r.QueryServerJoinedToRoom),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryServerJoinedToRoomPath, RoomserverQueryServerJoinedToRoomPath,
httputil.MakeInternalRPCAPI("QueryServerJoinedToRoom", r.QueryServerJoinedToRoom), httputil.MakeInternalRPCAPI(RoomserverQueryServerJoinedToRoomPath, r.QueryServerJoinedToRoom),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryServerAllowedToSeeEventPath, RoomserverQueryServerAllowedToSeeEventPath,
httputil.MakeInternalRPCAPI("QueryServerAllowedToSeeEvent", r.QueryServerAllowedToSeeEvent), httputil.MakeInternalRPCAPI(RoomserverQueryServerAllowedToSeeEventPath, r.QueryServerAllowedToSeeEvent),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryMissingEventsPath, RoomserverQueryMissingEventsPath,
httputil.MakeInternalRPCAPI("QueryMissingEvents", r.QueryMissingEvents), httputil.MakeInternalRPCAPI(RoomserverQueryMissingEventsPath, r.QueryMissingEvents),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryStateAndAuthChainPath, RoomserverQueryStateAndAuthChainPath,
httputil.MakeInternalRPCAPI("QueryStateAndAuthChain", r.QueryStateAndAuthChain), httputil.MakeInternalRPCAPI(RoomserverQueryStateAndAuthChainPath, r.QueryStateAndAuthChain),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformBackfillPath, RoomserverPerformBackfillPath,
httputil.MakeInternalRPCAPI("PerformBackfill", r.PerformBackfill), httputil.MakeInternalRPCAPI(RoomserverPerformBackfillPath, r.PerformBackfill),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverPerformForgetPath, RoomserverPerformForgetPath,
httputil.MakeInternalRPCAPI("PerformForget", r.PerformForget), httputil.MakeInternalRPCAPI(RoomserverPerformForgetPath, r.PerformForget),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryRoomVersionCapabilitiesPath, RoomserverQueryRoomVersionCapabilitiesPath,
httputil.MakeInternalRPCAPI("QueryRoomVersionCapabilities", r.QueryRoomVersionCapabilities), httputil.MakeInternalRPCAPI(RoomserverQueryRoomVersionCapabilitiesPath, r.QueryRoomVersionCapabilities),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryRoomVersionForRoomPath, RoomserverQueryRoomVersionForRoomPath,
httputil.MakeInternalRPCAPI("QueryRoomVersionForRoom", r.QueryRoomVersionForRoom), httputil.MakeInternalRPCAPI(RoomserverQueryRoomVersionForRoomPath, r.QueryRoomVersionForRoom),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverSetRoomAliasPath, RoomserverSetRoomAliasPath,
httputil.MakeInternalRPCAPI("SetRoomAlias", r.SetRoomAlias), httputil.MakeInternalRPCAPI(RoomserverSetRoomAliasPath, r.SetRoomAlias),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverGetRoomIDForAliasPath, RoomserverGetRoomIDForAliasPath,
httputil.MakeInternalRPCAPI("GetRoomIDForAlias", r.GetRoomIDForAlias), httputil.MakeInternalRPCAPI(RoomserverGetRoomIDForAliasPath, r.GetRoomIDForAlias),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverGetAliasesForRoomIDPath, RoomserverGetAliasesForRoomIDPath,
httputil.MakeInternalRPCAPI("GetAliasesForRoomID", r.GetAliasesForRoomID), httputil.MakeInternalRPCAPI(RoomserverGetAliasesForRoomIDPath, r.GetAliasesForRoomID),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverRemoveRoomAliasPath, RoomserverRemoveRoomAliasPath,
httputil.MakeInternalRPCAPI("RemoveRoomAlias", r.RemoveRoomAlias), httputil.MakeInternalRPCAPI(RoomserverRemoveRoomAliasPath, r.RemoveRoomAlias),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryCurrentStatePath, RoomserverQueryCurrentStatePath,
httputil.MakeInternalRPCAPI("QueryCurrentState", r.QueryCurrentState), httputil.MakeInternalRPCAPI(RoomserverQueryCurrentStatePath, r.QueryCurrentState),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryRoomsForUserPath, RoomserverQueryRoomsForUserPath,
httputil.MakeInternalRPCAPI("QueryRoomsForUser", r.QueryRoomsForUser), httputil.MakeInternalRPCAPI(RoomserverQueryRoomsForUserPath, r.QueryRoomsForUser),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryBulkStateContentPath, RoomserverQueryBulkStateContentPath,
httputil.MakeInternalRPCAPI("QueryBulkStateContent", r.QueryBulkStateContent), httputil.MakeInternalRPCAPI(RoomserverQueryBulkStateContentPath, r.QueryBulkStateContent),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQuerySharedUsersPath, RoomserverQuerySharedUsersPath,
httputil.MakeInternalRPCAPI("QuerySharedUsers", r.QuerySharedUsers), httputil.MakeInternalRPCAPI(RoomserverQuerySharedUsersPath, r.QuerySharedUsers),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryKnownUsersPath, RoomserverQueryKnownUsersPath,
httputil.MakeInternalRPCAPI("QueryKnownUsers", r.QueryKnownUsers), httputil.MakeInternalRPCAPI(RoomserverQueryKnownUsersPath, r.QueryKnownUsers),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryServerBannedFromRoomPath, RoomserverQueryServerBannedFromRoomPath,
httputil.MakeInternalRPCAPI("QueryServerBannedFromRoom", r.QueryServerBannedFromRoom), httputil.MakeInternalRPCAPI(RoomserverQueryServerBannedFromRoomPath, r.QueryServerBannedFromRoom),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryAuthChainPath, RoomserverQueryAuthChainPath,
httputil.MakeInternalRPCAPI("QueryAuthChain", r.QueryAuthChain), httputil.MakeInternalRPCAPI(RoomserverQueryAuthChainPath, r.QueryAuthChain),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
RoomserverQueryRestrictedJoinAllowed, RoomserverQueryRestrictedJoinAllowed,
httputil.MakeInternalRPCAPI("QueryRestrictedJoinAllowed", r.QueryRestrictedJoinAllowed), httputil.MakeInternalRPCAPI(RoomserverQueryRestrictedJoinAllowed, r.QueryRestrictedJoinAllowed),
) )
} }

View file

@ -29,137 +29,137 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
internalAPIMux.Handle( internalAPIMux.Handle(
PerformAccountCreationPath, PerformAccountCreationPath,
httputil.MakeInternalRPCAPI("PerformAccountCreation", s.PerformAccountCreation), httputil.MakeInternalRPCAPI(PerformAccountCreationPath, s.PerformAccountCreation),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformPasswordUpdatePath, PerformPasswordUpdatePath,
httputil.MakeInternalRPCAPI("PerformPasswordUpdate", s.PerformPasswordUpdate), httputil.MakeInternalRPCAPI(PerformPasswordUpdatePath, s.PerformPasswordUpdate),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformDeviceCreationPath, PerformDeviceCreationPath,
httputil.MakeInternalRPCAPI("PerformDeviceCreation", s.PerformDeviceCreation), httputil.MakeInternalRPCAPI(PerformDeviceCreationPath, s.PerformDeviceCreation),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformLastSeenUpdatePath, PerformLastSeenUpdatePath,
httputil.MakeInternalRPCAPI("PerformLastSeenUpdate", s.PerformLastSeenUpdate), httputil.MakeInternalRPCAPI(PerformLastSeenUpdatePath, s.PerformLastSeenUpdate),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformDeviceUpdatePath, PerformDeviceUpdatePath,
httputil.MakeInternalRPCAPI("PerformDeviceUpdate", s.PerformDeviceUpdate), httputil.MakeInternalRPCAPI(PerformDeviceUpdatePath, s.PerformDeviceUpdate),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformDeviceDeletionPath, PerformDeviceDeletionPath,
httputil.MakeInternalRPCAPI("PerformDeviceDeletion", s.PerformDeviceDeletion), httputil.MakeInternalRPCAPI(PerformDeviceDeletionPath, s.PerformDeviceDeletion),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformAccountDeactivationPath, PerformAccountDeactivationPath,
httputil.MakeInternalRPCAPI("PerformAccountDeactivation", s.PerformAccountDeactivation), httputil.MakeInternalRPCAPI(PerformAccountDeactivationPath, s.PerformAccountDeactivation),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformOpenIDTokenCreationPath, PerformOpenIDTokenCreationPath,
httputil.MakeInternalRPCAPI("PerformOpenIDTokenCreation", s.PerformOpenIDTokenCreation), httputil.MakeInternalRPCAPI(PerformOpenIDTokenCreationPath, s.PerformOpenIDTokenCreation),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryProfilePath, QueryProfilePath,
httputil.MakeInternalRPCAPI("QueryProfile", s.QueryProfile), httputil.MakeInternalRPCAPI(QueryProfilePath, s.QueryProfile),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryAccessTokenPath, QueryAccessTokenPath,
httputil.MakeInternalRPCAPI("QueryAccessToken", s.QueryAccessToken), httputil.MakeInternalRPCAPI(QueryAccessTokenPath, s.QueryAccessToken),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryAccessTokenPath, QueryAccessTokenPath,
httputil.MakeInternalRPCAPI("QueryAccessToken", s.QueryAccessToken), httputil.MakeInternalRPCAPI(QueryAccessTokenPath, s.QueryAccessToken),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryDevicesPath, QueryDevicesPath,
httputil.MakeInternalRPCAPI("QueryDevices", s.QueryDevices), httputil.MakeInternalRPCAPI(QueryDevicesPath, s.QueryDevices),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryAccountDataPath, QueryAccountDataPath,
httputil.MakeInternalRPCAPI("QueryAccountData", s.QueryAccountData), httputil.MakeInternalRPCAPI(QueryAccountDataPath, s.QueryAccountData),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryDeviceInfosPath, QueryDeviceInfosPath,
httputil.MakeInternalRPCAPI("QueryDeviceInfos", s.QueryDeviceInfos), httputil.MakeInternalRPCAPI(QueryDeviceInfosPath, s.QueryDeviceInfos),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QuerySearchProfilesPath, QuerySearchProfilesPath,
httputil.MakeInternalRPCAPI("QuerySearchProfiles", s.QuerySearchProfiles), httputil.MakeInternalRPCAPI(QuerySearchProfilesPath, s.QuerySearchProfiles),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryOpenIDTokenPath, QueryOpenIDTokenPath,
httputil.MakeInternalRPCAPI("QueryOpenIDToken", s.QueryOpenIDToken), httputil.MakeInternalRPCAPI(QueryOpenIDTokenPath, s.QueryOpenIDToken),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
InputAccountDataPath, InputAccountDataPath,
httputil.MakeInternalRPCAPI("InputAccountData", s.InputAccountData), httputil.MakeInternalRPCAPI(InputAccountDataPath, s.InputAccountData),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryKeyBackupPath, QueryKeyBackupPath,
httputil.MakeInternalRPCAPI("QueryKeyBackup", s.QueryKeyBackup), httputil.MakeInternalRPCAPI(QueryKeyBackupPath, s.QueryKeyBackup),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformKeyBackupPath, PerformKeyBackupPath,
httputil.MakeInternalRPCAPI("PerformKeyBackup", s.PerformKeyBackup), httputil.MakeInternalRPCAPI(PerformKeyBackupPath, s.PerformKeyBackup),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryNotificationsPath, QueryNotificationsPath,
httputil.MakeInternalRPCAPI("QueryNotifications", s.QueryNotifications), httputil.MakeInternalRPCAPI(QueryNotificationsPath, s.QueryNotifications),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformPusherSetPath, PerformPusherSetPath,
httputil.MakeInternalRPCAPI("PerformPusherSet", s.PerformPusherSet), httputil.MakeInternalRPCAPI(PerformPusherSetPath, s.PerformPusherSet),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformPusherDeletionPath, PerformPusherDeletionPath,
httputil.MakeInternalRPCAPI("PerformPusherDeletion", s.PerformPusherDeletion), httputil.MakeInternalRPCAPI(PerformPusherDeletionPath, s.PerformPusherDeletion),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryPushersPath, QueryPushersPath,
httputil.MakeInternalRPCAPI("QueryPushers", s.QueryPushers), httputil.MakeInternalRPCAPI(QueryPushersPath, s.QueryPushers),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformPushRulesPutPath, PerformPushRulesPutPath,
httputil.MakeInternalRPCAPI("PerformPushRulesPut", s.PerformPushRulesPut), httputil.MakeInternalRPCAPI(PerformPushRulesPutPath, s.PerformPushRulesPut),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryPushRulesPath, QueryPushRulesPath,
httputil.MakeInternalRPCAPI("QueryPushRules", s.QueryPushRules), httputil.MakeInternalRPCAPI(QueryPushRulesPath, s.QueryPushRules),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformSetAvatarURLPath, PerformSetAvatarURLPath,
httputil.MakeInternalRPCAPI("PerformSetAvatarURL", s.SetAvatarURL), httputil.MakeInternalRPCAPI(PerformSetAvatarURLPath, s.SetAvatarURL),
) )
// TODO: Look at the shape of this // TODO: Look at the shape of this
internalAPIMux.Handle(QueryNumericLocalpartPath, internalAPIMux.Handle(QueryNumericLocalpartPath,
httputil.MakeInternalAPI("queryNumericLocalpart", func(req *http.Request) util.JSONResponse { httputil.MakeInternalAPI(QueryNumericLocalpartPath, func(req *http.Request) util.JSONResponse {
response := api.QueryNumericLocalpartResponse{} response := api.QueryNumericLocalpartResponse{}
if err := s.QueryNumericLocalpart(req.Context(), &response); err != nil { if err := s.QueryNumericLocalpart(req.Context(), &response); err != nil {
return util.ErrorResponse(err) return util.ErrorResponse(err)
@ -170,36 +170,36 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
internalAPIMux.Handle( internalAPIMux.Handle(
QueryAccountAvailabilityPath, QueryAccountAvailabilityPath,
httputil.MakeInternalRPCAPI("QueryAccountAvailability", s.QueryAccountAvailability), httputil.MakeInternalRPCAPI(QueryAccountAvailabilityPath, s.QueryAccountAvailability),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryAccountByPasswordPath, QueryAccountByPasswordPath,
httputil.MakeInternalRPCAPI("QueryAccountByPassword", s.QueryAccountByPassword), httputil.MakeInternalRPCAPI(QueryAccountByPasswordPath, s.QueryAccountByPassword),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformSetDisplayNamePath, PerformSetDisplayNamePath,
httputil.MakeInternalRPCAPI("SetDisplayName", s.SetDisplayName), httputil.MakeInternalRPCAPI(PerformSetDisplayNamePath, s.SetDisplayName),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryLocalpartForThreePIDPath, QueryLocalpartForThreePIDPath,
httputil.MakeInternalRPCAPI("QueryLocalpartForThreePID", s.QueryLocalpartForThreePID), httputil.MakeInternalRPCAPI(QueryLocalpartForThreePIDPath, s.QueryLocalpartForThreePID),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
QueryThreePIDsForLocalpartPath, QueryThreePIDsForLocalpartPath,
httputil.MakeInternalRPCAPI("QueryThreePIDsForLocalpart", s.QueryThreePIDsForLocalpart), httputil.MakeInternalRPCAPI(QueryThreePIDsForLocalpartPath, s.QueryThreePIDsForLocalpart),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformForgetThreePIDPath, PerformForgetThreePIDPath,
httputil.MakeInternalRPCAPI("PerformForgetThreePID", s.PerformForgetThreePID), httputil.MakeInternalRPCAPI(PerformForgetThreePIDPath, s.PerformForgetThreePID),
) )
internalAPIMux.Handle( internalAPIMux.Handle(
PerformSaveThreePIDAssociationPath, PerformSaveThreePIDAssociationPath,
httputil.MakeInternalRPCAPI("PerformSaveThreePIDAssociation", s.PerformSaveThreePIDAssociation), httputil.MakeInternalRPCAPI(PerformSaveThreePIDAssociationPath, s.PerformSaveThreePIDAssociation),
) )
} }