mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
refactor: update GMSL (#3058)
Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/364 Read this commit by commit to avoid going insane.
This commit is contained in:
parent
9fa39263c0
commit
72285b2659
306 changed files with 2117 additions and 1934 deletions
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/matrix-org/dendrite/userapi/types"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/gomatrixserverlib/fclient"
|
||||
"github.com/matrix-org/gomatrixserverlib/spec"
|
||||
|
||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||
"github.com/matrix-org/dendrite/internal/pushrules"
|
||||
|
@ -115,8 +116,8 @@ type ClientUserAPI interface {
|
|||
|
||||
type ProfileAPI interface {
|
||||
QueryProfile(ctx context.Context, userID string) (*authtypes.Profile, error)
|
||||
SetAvatarURL(ctx context.Context, localpart string, serverName gomatrixserverlib.ServerName, avatarURL string) (*authtypes.Profile, bool, error)
|
||||
SetDisplayName(ctx context.Context, localpart string, serverName gomatrixserverlib.ServerName, displayName string) (*authtypes.Profile, bool, error)
|
||||
SetAvatarURL(ctx context.Context, localpart string, serverName spec.ServerName, avatarURL string) (*authtypes.Profile, bool, error)
|
||||
SetDisplayName(ctx context.Context, localpart string, serverName spec.ServerName, displayName string) (*authtypes.Profile, bool, error)
|
||||
}
|
||||
|
||||
// custom api functions required by pinecone / p2p demos
|
||||
|
@ -312,9 +313,9 @@ type QuerySearchProfilesResponse struct {
|
|||
|
||||
// PerformAccountCreationRequest is the request for PerformAccountCreation
|
||||
type PerformAccountCreationRequest struct {
|
||||
AccountType AccountType // Required: whether this is a guest or user account
|
||||
Localpart string // Required: The localpart for this account. Ignored if account type is guest.
|
||||
ServerName gomatrixserverlib.ServerName // optional: if not specified, default server name used instead
|
||||
AccountType AccountType // Required: whether this is a guest or user account
|
||||
Localpart string // Required: The localpart for this account. Ignored if account type is guest.
|
||||
ServerName spec.ServerName // optional: if not specified, default server name used instead
|
||||
|
||||
AppServiceID string // optional: the application service ID (not user ID) creating this account, if any.
|
||||
Password string // optional: if missing then this account will be a passwordless account
|
||||
|
@ -329,10 +330,10 @@ type PerformAccountCreationResponse struct {
|
|||
|
||||
// PerformAccountCreationRequest is the request for PerformAccountCreation
|
||||
type PerformPasswordUpdateRequest struct {
|
||||
Localpart string // Required: The localpart for this account.
|
||||
ServerName gomatrixserverlib.ServerName // Required: The domain for this account.
|
||||
Password string // Required: The new password to set.
|
||||
LogoutDevices bool // Optional: Whether to log out all user devices.
|
||||
Localpart string // Required: The localpart for this account.
|
||||
ServerName spec.ServerName // Required: The domain for this account.
|
||||
Password string // Required: The new password to set.
|
||||
LogoutDevices bool // Optional: Whether to log out all user devices.
|
||||
}
|
||||
|
||||
// PerformAccountCreationResponse is the response for PerformAccountCreation
|
||||
|
@ -356,8 +357,8 @@ type PerformLastSeenUpdateResponse struct {
|
|||
// PerformDeviceCreationRequest is the request for PerformDeviceCreation
|
||||
type PerformDeviceCreationRequest struct {
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName // optional: if blank, default server name used
|
||||
AccessToken string // optional: if blank one will be made on your behalf
|
||||
ServerName spec.ServerName // optional: if blank, default server name used
|
||||
AccessToken string // optional: if blank one will be made on your behalf
|
||||
// optional: if nil an ID is generated for you. If set, replaces any existing device session,
|
||||
// which will generate a new access token and invalidate the old one.
|
||||
DeviceID *string
|
||||
|
@ -382,7 +383,7 @@ type PerformDeviceCreationResponse struct {
|
|||
// PerformAccountDeactivationRequest is the request for PerformAccountDeactivation
|
||||
type PerformAccountDeactivationRequest struct {
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName // optional: if blank, default server name used
|
||||
ServerName spec.ServerName // optional: if blank, default server name used
|
||||
}
|
||||
|
||||
// PerformAccountDeactivationResponse is the response for PerformAccountDeactivation
|
||||
|
@ -432,7 +433,7 @@ type Device struct {
|
|||
AccountType AccountType
|
||||
}
|
||||
|
||||
func (d *Device) UserDomain() gomatrixserverlib.ServerName {
|
||||
func (d *Device) UserDomain() spec.ServerName {
|
||||
_, domain, err := gomatrixserverlib.SplitID('@', d.UserID)
|
||||
if err != nil {
|
||||
// This really is catastrophic because it means that someone
|
||||
|
@ -448,7 +449,7 @@ func (d *Device) UserDomain() gomatrixserverlib.ServerName {
|
|||
type Account struct {
|
||||
UserID string
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
AppServiceID string
|
||||
AccountType AccountType
|
||||
// TODO: Associations (e.g. with application services)
|
||||
|
@ -514,7 +515,7 @@ const (
|
|||
|
||||
type QueryPushersRequest struct {
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
}
|
||||
|
||||
type QueryPushersResponse struct {
|
||||
|
@ -524,13 +525,13 @@ type QueryPushersResponse struct {
|
|||
type PerformPusherSetRequest struct {
|
||||
Pusher // Anonymous field because that's how clientapi unmarshals it.
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
Append bool `json:"append"`
|
||||
}
|
||||
|
||||
type PerformPusherDeletionRequest struct {
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
SessionID int64
|
||||
}
|
||||
|
||||
|
@ -556,11 +557,11 @@ const (
|
|||
)
|
||||
|
||||
type QueryNotificationsRequest struct {
|
||||
Localpart string `json:"localpart"` // Required.
|
||||
ServerName gomatrixserverlib.ServerName `json:"server_name"` // Required.
|
||||
From string `json:"from,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
Only string `json:"only,omitempty"`
|
||||
Localpart string `json:"localpart"` // Required.
|
||||
ServerName spec.ServerName `json:"server_name"` // Required.
|
||||
From string `json:"from,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
Only string `json:"only,omitempty"`
|
||||
}
|
||||
|
||||
type QueryNotificationsResponse struct {
|
||||
|
@ -569,16 +570,16 @@ type QueryNotificationsResponse struct {
|
|||
}
|
||||
|
||||
type Notification struct {
|
||||
Actions []*pushrules.Action `json:"actions"` // Required.
|
||||
Event synctypes.ClientEvent `json:"event"` // Required.
|
||||
ProfileTag string `json:"profile_tag"` // Required by Sytest, but actually optional.
|
||||
Read bool `json:"read"` // Required.
|
||||
RoomID string `json:"room_id"` // Required.
|
||||
TS gomatrixserverlib.Timestamp `json:"ts"` // Required.
|
||||
Actions []*pushrules.Action `json:"actions"` // Required.
|
||||
Event synctypes.ClientEvent `json:"event"` // Required.
|
||||
ProfileTag string `json:"profile_tag"` // Required by Sytest, but actually optional.
|
||||
Read bool `json:"read"` // Required.
|
||||
RoomID string `json:"room_id"` // Required.
|
||||
TS spec.Timestamp `json:"ts"` // Required.
|
||||
}
|
||||
|
||||
type QueryNumericLocalpartRequest struct {
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
}
|
||||
|
||||
type QueryNumericLocalpartResponse struct {
|
||||
|
@ -587,7 +588,7 @@ type QueryNumericLocalpartResponse struct {
|
|||
|
||||
type QueryAccountAvailabilityRequest struct {
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
}
|
||||
|
||||
type QueryAccountAvailabilityResponse struct {
|
||||
|
@ -596,7 +597,7 @@ type QueryAccountAvailabilityResponse struct {
|
|||
|
||||
type QueryAccountByPasswordRequest struct {
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
PlaintextPassword string
|
||||
}
|
||||
|
||||
|
@ -611,12 +612,12 @@ type QueryLocalpartForThreePIDRequest struct {
|
|||
|
||||
type QueryLocalpartForThreePIDResponse struct {
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
}
|
||||
|
||||
type QueryThreePIDsForLocalpartRequest struct {
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
}
|
||||
|
||||
type QueryThreePIDsForLocalpartResponse struct {
|
||||
|
@ -628,13 +629,13 @@ type PerformForgetThreePIDRequest QueryLocalpartForThreePIDRequest
|
|||
type PerformSaveThreePIDAssociationRequest struct {
|
||||
ThreePID string
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
Medium string
|
||||
}
|
||||
|
||||
type QueryAccountByLocalpartRequest struct {
|
||||
Localpart string
|
||||
ServerName gomatrixserverlib.ServerName
|
||||
ServerName spec.ServerName
|
||||
}
|
||||
|
||||
type QueryAccountByLocalpartResponse struct {
|
||||
|
@ -944,6 +945,6 @@ type QuerySignaturesResponse struct {
|
|||
|
||||
type PerformMarkAsStaleRequest struct {
|
||||
UserID string
|
||||
Domain gomatrixserverlib.ServerName
|
||||
Domain spec.ServerName
|
||||
DeviceID string
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue