Initial structuring for URIToUID API

This commit is contained in:
Derek Meer 2018-08-01 19:22:45 -07:00
parent 9cdd3a66e4
commit 25504f20f3
2 changed files with 26 additions and 5 deletions

View file

@ -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)
}

View file

@ -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,
}
}