diff --git a/src/github.com/matrix-org/dendrite/appservice/routing/routing.go b/src/github.com/matrix-org/dendrite/appservice/routing/routing.go index f0b8461dc..0a379cbf2 100644 --- a/src/github.com/matrix-org/dendrite/appservice/routing/routing.go +++ b/src/github.com/matrix-org/dendrite/appservice/routing/routing.go @@ -51,11 +51,7 @@ func Setup( ).Methods(http.MethodGet, http.MethodOptions) appMux.Handle("/user", common.MakeExternalAPI("user", func(req *http.Request) util.JSONResponse { - // TODO: Implement - return util.JSONResponse{ - Code: http.StatusOK, - JSON: nil, - } + return URIToUID(req) }), ).Methods(http.MethodGet, http.MethodOptions) } diff --git a/src/github.com/matrix-org/dendrite/appservice/routing/user.go b/src/github.com/matrix-org/dendrite/appservice/routing/user.go new file mode 100644 index 000000000..2c167dc55 --- /dev/null +++ b/src/github.com/matrix-org/dendrite/appservice/routing/user.go @@ -0,0 +1,25 @@ +package routing + +import ( + "github.com/matrix-org/util" + "net/http" +) + +// represents response to an AppService URI to User Id +// (/_matrix/app/r0/user?uri={url_encoded_uri}) request +type URIToUIDResponse struct { + UserID string `json:"user_id"` +} + +// URIToUID implements `/_matrix/app/r0/user?uri={url_encoded_uri}`, which +// enables users to contact appservice users directly by taking an encoded +// URI and turning it into a Matrix ID on the homeserver. +// https://matrix.org/docs/spec/application_service/unstable.html#user-ids + +func URIToUID(req *http.Request) util.JSONResponse { + // TODO: Implement + return util.JSONResponse{ + Code: http.StatusOK, + JSON: nil, + } +}