Move versions method to separate model

This commit is contained in:
nxshock 2019-07-20 22:10:43 +05:00
parent c084dce5ec
commit f07dfc3a33
3 changed files with 9 additions and 7 deletions

View File

@ -14,6 +14,7 @@ import (
login "github.com/nxshock/signaller/internal/models/login"
register "github.com/nxshock/signaller/internal/models/register"
mSync "github.com/nxshock/signaller/internal/models/sync"
"github.com/nxshock/signaller/internal/models/versions"
)
func RootHandler(w http.ResponseWriter, r *http.Request) {
@ -27,7 +28,7 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
return
}
response := models.VersionsReply{Versions: []string{Version}}
response := versions.Reply{Versions: []string{Version}}
sendJsonResponse(w, http.StatusOK, response)
}

View File

@ -4,12 +4,6 @@ import (
common "github.com/nxshock/signaller/internal/models/common"
)
// https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-versions
type VersionsReply struct {
Versions []string `json:"versions"` // The supported versions.
UnstableFeatures map[string]bool `json:"unstable_features,omitempty"`
}
// https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-account-whoami
type WhoAmIReply struct {
UserID string `json:"user_id"` // Required. The user id that owns the access token.

View File

@ -0,0 +1,7 @@
package versions
// https://matrix.org/docs/spec/client_server/latest#get-matrix-client-versions
type Reply struct {
Versions []string `json:"versions"` // The supported versions.
UnstableFeatures map[string]bool `json:"unstable_features,omitempty"` // Experimental features the server supports. Features not listed here, or the lack of this property all together, indicate that a feature is not supported.
}