summaryrefslogtreecommitdiff
path: root/lib/matrix_app_service/phoenix/router.ex
blob: b3e6c8f3120e9af8d1ec06a9cb265c35e3d5a969 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
defmodule MatrixAppService.Phoenix.Router do
  defmacro routes() do
    quote do
      pipeline :matrix_api do
        plug :accepts, ["json"]
        plug MatrixAppServiceWeb.AuthPlug
      end

      path = Application.compile_env(:matrix_app_service, :path, "/")

      scope path, MatrixAppServiceWeb.V1 do
        pipe_through :matrix_api

        put "/transactions/:txn_id", TransactionController, :create

        get "/users/:user_id", UserController, :show
        get "/rooms/:room_alias", RoomController, :show

        get "/thirdparty/protocol/:protocol", ThirdPartyController, :show
        get "/thirdparty/user/:protocol", ThirdPartyController, :show
        get "/thirdparty/location/:protocol", ThirdPartyController, :show
        get "/thirdparty/location", ThirdPartyController, :show
        get "/thirdparty/user", ThirdPartyController, :show
      end
    end
  end
end