Fix API paths

main
Neil Alexander 2020-05-22 14:14:39 +01:00
parent 0978630b55
commit 06d5f1e6dc
6 changed files with 12 additions and 22 deletions

View File

@ -84,10 +84,10 @@ type AppServiceQueryAPI interface {
}
// AppServiceRoomAliasExistsPath is the HTTP path for the RoomAliasExists API
const AppServiceRoomAliasExistsPath = "/api/appservice/RoomAliasExists"
const AppServiceRoomAliasExistsPath = "/appservice/RoomAliasExists"
// AppServiceUserIDExistsPath is the HTTP path for the UserIDExists API
const AppServiceUserIDExistsPath = "/api/appservice/UserIDExists"
const AppServiceUserIDExistsPath = "/appservice/UserIDExists"
// httpAppServiceQueryAPI contains the URL to an appservice query API and a
// reference to a httpClient used to reach it

View File

@ -55,7 +55,7 @@ type EDUServerInputAPI interface {
}
// EDUServerInputTypingEventPath is the HTTP path for the InputTypingEvent API.
const EDUServerInputTypingEventPath = "/api/eduserver/input"
const EDUServerInputTypingEventPath = "/eduserver/input"
// NewEDUServerInputAPIHTTP creates a EDUServerInputAPI implemented by talking to a HTTP POST API.
func NewEDUServerInputAPIHTTP(eduServerURL string, httpClient *http.Client) (EDUServerInputAPI, error) {

View File

@ -11,13 +11,13 @@ import (
const (
// FederationSenderPerformJoinRequestPath is the HTTP path for the PerformJoinRequest API.
FederationSenderPerformDirectoryLookupRequestPath = "/api/federationsender/performDirectoryLookup"
FederationSenderPerformDirectoryLookupRequestPath = "/federationsender/performDirectoryLookup"
// FederationSenderPerformJoinRequestPath is the HTTP path for the PerformJoinRequest API.
FederationSenderPerformJoinRequestPath = "/api/federationsender/performJoinRequest"
FederationSenderPerformJoinRequestPath = "/federationsender/performJoinRequest"
// FederationSenderPerformLeaveRequestPath is the HTTP path for the PerformLeaveRequest API.
FederationSenderPerformLeaveRequestPath = "/api/federationsender/performLeaveRequest"
FederationSenderPerformLeaveRequestPath = "/federationsender/performLeaveRequest"
)
type PerformDirectoryLookupRequest struct {

View File

@ -11,10 +11,10 @@ import (
)
// FederationSenderQueryJoinedHostsInRoomPath is the HTTP path for the QueryJoinedHostsInRoom API.
const FederationSenderQueryJoinedHostsInRoomPath = "/api/federationsender/queryJoinedHostsInRoom"
const FederationSenderQueryJoinedHostsInRoomPath = "/federationsender/queryJoinedHostsInRoom"
// FederationSenderQueryJoinedHostServerNamesInRoomPath is the HTTP path for the QueryJoinedHostServerNamesInRoom API.
const FederationSenderQueryJoinedHostServerNamesInRoomPath = "/api/federationsender/queryJoinedHostServerNamesInRoom"
const FederationSenderQueryJoinedHostServerNamesInRoomPath = "/federationsender/queryJoinedHostServerNamesInRoom"
// QueryJoinedHostsInRoomRequest is a request to QueryJoinedHostsInRoom
type QueryJoinedHostsInRoomRequest struct {

View File

@ -6,8 +6,6 @@ import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"strings"
opentracing "github.com/opentracing/opentracing-go"
"github.com/opentracing/opentracing-go/ext"
@ -23,14 +21,6 @@ func PostJSON(
return err
}
parsedAPIURL, err := url.Parse(apiURL)
if err != nil {
return err
}
parsedAPIURL.Path = "/api/" + strings.TrimLeft(parsedAPIURL.Path, "/")
apiURL = parsedAPIURL.String()
req, err := http.NewRequest(http.MethodPost, apiURL, bytes.NewReader(jsonBytes))
if err != nil {
return err

View File

@ -24,10 +24,10 @@ import (
)
const (
SyncAPIQuerySyncPath = "/api/syncapi/querySync"
SyncAPIQueryStatePath = "/api/syncapi/queryState"
SyncAPIQueryStateTypePath = "/api/syncapi/queryStateType"
SyncAPIQueryMessagesPath = "/api/syncapi/queryMessages"
SyncAPIQuerySyncPath = "/syncapi/querySync"
SyncAPIQueryStatePath = "/syncapi/queryState"
SyncAPIQueryStateTypePath = "/syncapi/queryStateType"
SyncAPIQueryMessagesPath = "/syncapi/queryMessages"
)
func NewSyncQueryAPIHTTP(syncapiURL string, httpClient *http.Client) SyncQueryAPI {