aboutsummaryrefslogtreecommitdiff
path: root/appservice
diff options
context:
space:
mode:
Diffstat (limited to 'appservice')
-rw-r--r--appservice/api/query.go36
-rw-r--r--appservice/appservice.go4
-rw-r--r--appservice/inthttp/client.go2
-rw-r--r--appservice/inthttp/server.go2
4 files changed, 22 insertions, 22 deletions
diff --git a/appservice/api/query.go b/appservice/api/query.go
index 6db8be85..4d1cf947 100644
--- a/appservice/api/query.go
+++ b/appservice/api/query.go
@@ -26,6 +26,23 @@ import (
"github.com/matrix-org/gomatrixserverlib"
)
+// AppServiceInternalAPI is used to query user and room alias data from application
+// services
+type AppServiceInternalAPI interface {
+ // Check whether a room alias exists within any application service namespaces
+ RoomAliasExists(
+ ctx context.Context,
+ req *RoomAliasExistsRequest,
+ resp *RoomAliasExistsResponse,
+ ) error
+ // Check whether a user ID exists within any application service namespaces
+ UserIDExists(
+ ctx context.Context,
+ req *UserIDExistsRequest,
+ resp *UserIDExistsResponse,
+ ) error
+}
+
// RoomAliasExistsRequest is a request to an application service
// about whether a room alias exists
type RoomAliasExistsRequest struct {
@@ -60,30 +77,13 @@ type UserIDExistsResponse struct {
UserIDExists bool `json:"exists"`
}
-// AppServiceQueryAPI is used to query user and room alias data from application
-// services
-type AppServiceQueryAPI interface {
- // Check whether a room alias exists within any application service namespaces
- RoomAliasExists(
- ctx context.Context,
- req *RoomAliasExistsRequest,
- resp *RoomAliasExistsResponse,
- ) error
- // Check whether a user ID exists within any application service namespaces
- UserIDExists(
- ctx context.Context,
- req *UserIDExistsRequest,
- resp *UserIDExistsResponse,
- ) error
-}
-
// RetrieveUserProfile is a wrapper that queries both the local database and
// application services for a given user's profile
// TODO: Remove this, it's called from federationapi and clientapi but is a pure function
func RetrieveUserProfile(
ctx context.Context,
userID string,
- asAPI AppServiceQueryAPI,
+ asAPI AppServiceInternalAPI,
profileAPI userapi.ClientUserAPI,
) (*authtypes.Profile, error) {
localpart, _, err := gomatrixserverlib.SplitID('@', userID)
diff --git a/appservice/appservice.go b/appservice/appservice.go
index e026a787..bd292767 100644
--- a/appservice/appservice.go
+++ b/appservice/appservice.go
@@ -38,7 +38,7 @@ import (
)
// AddInternalRoutes registers HTTP handlers for internal API calls
-func AddInternalRoutes(router *mux.Router, queryAPI appserviceAPI.AppServiceQueryAPI) {
+func AddInternalRoutes(router *mux.Router, queryAPI appserviceAPI.AppServiceInternalAPI) {
inthttp.AddRoutes(queryAPI, router)
}
@@ -48,7 +48,7 @@ func NewInternalAPI(
base *base.BaseDendrite,
userAPI userapi.AppserviceUserAPI,
rsAPI roomserverAPI.AppserviceRoomserverAPI,
-) appserviceAPI.AppServiceQueryAPI {
+) appserviceAPI.AppServiceInternalAPI {
client := gomatrixserverlib.NewClient(
gomatrixserverlib.WithTimeout(time.Second*30),
gomatrixserverlib.WithKeepAlives(false),
diff --git a/appservice/inthttp/client.go b/appservice/inthttp/client.go
index 7e3cb208..0a8baea9 100644
--- a/appservice/inthttp/client.go
+++ b/appservice/inthttp/client.go
@@ -29,7 +29,7 @@ type httpAppServiceQueryAPI struct {
func NewAppserviceClient(
appserviceURL string,
httpClient *http.Client,
-) (api.AppServiceQueryAPI, error) {
+) (api.AppServiceInternalAPI, error) {
if httpClient == nil {
return nil, errors.New("NewRoomserverAliasAPIHTTP: httpClient is <nil>")
}
diff --git a/appservice/inthttp/server.go b/appservice/inthttp/server.go
index 009b7b5d..645b4387 100644
--- a/appservice/inthttp/server.go
+++ b/appservice/inthttp/server.go
@@ -11,7 +11,7 @@ import (
)
// AddRoutes adds the AppServiceQueryAPI handlers to the http.ServeMux.
-func AddRoutes(a api.AppServiceQueryAPI, internalAPIMux *mux.Router) {
+func AddRoutes(a api.AppServiceInternalAPI, internalAPIMux *mux.Router) {
internalAPIMux.Handle(
AppServiceRoomAliasExistsPath,
httputil.MakeInternalAPI("appserviceRoomAliasExists", func(req *http.Request) util.JSONResponse {