diff options
author | Kegsay <kegan@matrix.org> | 2020-06-04 15:43:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-04 15:43:07 +0100 |
commit | 9834ac97db042b0c78fbd72652aa534129ca3afe (patch) | |
tree | 4fd862ffba61e47f94b2fcc5685a0502e21b3c70 /roomserver/api/alias.go | |
parent | d785ad82b996989381657292fbd2c28b9fbb7df6 (diff) |
Convert everything but serverkeyapi to inthttp (#1096)
* Convert roomserver to new inthttp format
* Convert eduserver to new inthttp format
* Convert appservice to new inthttp format
Diffstat (limited to 'roomserver/api/alias.go')
-rw-r--r-- | roomserver/api/alias.go | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/roomserver/api/alias.go b/roomserver/api/alias.go index 54d2c633..61fdc611 100644 --- a/roomserver/api/alias.go +++ b/roomserver/api/alias.go @@ -14,13 +14,6 @@ package api -import ( - "context" - - internalHTTP "github.com/matrix-org/dendrite/internal/http" - opentracing "github.com/opentracing/opentracing-go" -) - // SetRoomAliasRequest is a request to SetRoomAlias type SetRoomAliasRequest struct { // ID of the user setting the alias @@ -83,83 +76,3 @@ type RemoveRoomAliasRequest struct { // RemoveRoomAliasResponse is a response to RemoveRoomAlias type RemoveRoomAliasResponse struct{} - -// RoomserverSetRoomAliasPath is the HTTP path for the SetRoomAlias API. -const RoomserverSetRoomAliasPath = "/roomserver/setRoomAlias" - -// RoomserverGetRoomIDForAliasPath is the HTTP path for the GetRoomIDForAlias API. -const RoomserverGetRoomIDForAliasPath = "/roomserver/GetRoomIDForAlias" - -// RoomserverGetAliasesForRoomIDPath is the HTTP path for the GetAliasesForRoomID API. -const RoomserverGetAliasesForRoomIDPath = "/roomserver/GetAliasesForRoomID" - -// RoomserverGetCreatorIDForAliasPath is the HTTP path for the GetCreatorIDForAlias API. -const RoomserverGetCreatorIDForAliasPath = "/roomserver/GetCreatorIDForAlias" - -// RoomserverRemoveRoomAliasPath is the HTTP path for the RemoveRoomAlias API. -const RoomserverRemoveRoomAliasPath = "/roomserver/removeRoomAlias" - -// SetRoomAlias implements RoomserverAliasAPI -func (h *httpRoomserverInternalAPI) SetRoomAlias( - ctx context.Context, - request *SetRoomAliasRequest, - response *SetRoomAliasResponse, -) error { - span, ctx := opentracing.StartSpanFromContext(ctx, "SetRoomAlias") - defer span.Finish() - - apiURL := h.roomserverURL + RoomserverSetRoomAliasPath - return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response) -} - -// GetRoomIDForAlias implements RoomserverAliasAPI -func (h *httpRoomserverInternalAPI) GetRoomIDForAlias( - ctx context.Context, - request *GetRoomIDForAliasRequest, - response *GetRoomIDForAliasResponse, -) error { - span, ctx := opentracing.StartSpanFromContext(ctx, "GetRoomIDForAlias") - defer span.Finish() - - apiURL := h.roomserverURL + RoomserverGetRoomIDForAliasPath - return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response) -} - -// GetAliasesForRoomID implements RoomserverAliasAPI -func (h *httpRoomserverInternalAPI) GetAliasesForRoomID( - ctx context.Context, - request *GetAliasesForRoomIDRequest, - response *GetAliasesForRoomIDResponse, -) error { - span, ctx := opentracing.StartSpanFromContext(ctx, "GetAliasesForRoomID") - defer span.Finish() - - apiURL := h.roomserverURL + RoomserverGetAliasesForRoomIDPath - return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response) -} - -// GetCreatorIDForAlias implements RoomserverAliasAPI -func (h *httpRoomserverInternalAPI) GetCreatorIDForAlias( - ctx context.Context, - request *GetCreatorIDForAliasRequest, - response *GetCreatorIDForAliasResponse, -) error { - span, ctx := opentracing.StartSpanFromContext(ctx, "GetCreatorIDForAlias") - defer span.Finish() - - apiURL := h.roomserverURL + RoomserverGetCreatorIDForAliasPath - return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response) -} - -// RemoveRoomAlias implements RoomserverAliasAPI -func (h *httpRoomserverInternalAPI) RemoveRoomAlias( - ctx context.Context, - request *RemoveRoomAliasRequest, - response *RemoveRoomAliasResponse, -) error { - span, ctx := opentracing.StartSpanFromContext(ctx, "RemoveRoomAlias") - defer span.Finish() - - apiURL := h.roomserverURL + RoomserverRemoveRoomAliasPath - return internalHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response) -} |