2020-09-28 20:37:02 +00:00
|
|
|
package user
|
|
|
|
|
|
|
|
import (
|
|
|
|
"nutfactory.org/Matrix/entities/device"
|
|
|
|
)
|
|
|
|
|
|
|
|
type User struct {
|
2020-10-01 15:45:57 +00:00
|
|
|
Id string `json:"id,omitempty"`
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
Password string `json:"password,omitempty"`
|
|
|
|
Devices map[string]*device.Device `json:"devices,omitempty"`
|
2020-09-28 20:37:02 +00:00
|
|
|
}
|
2020-10-03 12:22:29 +00:00
|
|
|
|
|
|
|
type registerRequest struct {
|
|
|
|
Auth authentificationData `json:"auth,omitempty"`
|
|
|
|
Username string `json:"username,omitempty"`
|
|
|
|
Password string `json:"password,omitempty"`
|
|
|
|
DeviceId string `json:"device_id,omitempty"`
|
|
|
|
DeviceName string `json:"initial_device_display_name,omitempty"`
|
|
|
|
InhibitLogin bool `json:"inhibit_login,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type registerResponse struct {
|
|
|
|
UserId string `json:"user_id,omitempty"`
|
|
|
|
AccessToken string `json:"access_token,omitempty"`
|
|
|
|
HomeServer string `json:"home_server,omitempty"`
|
|
|
|
DeviceId string `json:"device_id,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type loginRequest struct {
|
|
|
|
LoginType string `json:"type,omitempty"`
|
|
|
|
Identifier identifier `json:"identifier,omitempty"`
|
|
|
|
Password string `json:"password,omitempty"`
|
|
|
|
Token string `json:"token,omitempty"`
|
|
|
|
DeviceId string `json:"device_id,omitempty"`
|
|
|
|
DeviceName string `json:"initial_device_display_name,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type loginResponse struct {
|
|
|
|
UserId string `json:"user_id,omitempty"`
|
|
|
|
AccessToken string `json:"access_token,omitempty"`
|
|
|
|
DeviceId string `json:"device_id,omitempty"`
|
|
|
|
DiscoveryInfo discoveryInformation `json:"well_known,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type deaktivateUserRequest struct {
|
|
|
|
Auth authentificationData `json:"auth,omitempty"`
|
|
|
|
IdentityServer string `json:"id_server,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type deaktivateUserResponse struct {
|
|
|
|
Unbind3PIDS string `json:"id_server_unbind_result,omitempty"` // success or no-support
|
|
|
|
}
|
|
|
|
|
|
|
|
type changePasswordRequest struct {
|
|
|
|
NewPassword string
|
|
|
|
LogoutDevices bool
|
|
|
|
Auth authentificationData
|
|
|
|
}
|
|
|
|
|
|
|
|
type errorResponse struct {
|
|
|
|
ErrorCode string `json:"errcode,omitempty"`
|
|
|
|
ErrorMessage string `json:"error,omitempty"`
|
|
|
|
RetryTime int `json:"retry_after_ms,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type identifier struct {
|
|
|
|
IdentifierType string `json:"type,omitempty"`
|
|
|
|
User string `json:"user,omitempty"`
|
|
|
|
Medium string `json:"medium,omitempty"`
|
|
|
|
Address string `json:"address,omitempty"`
|
|
|
|
Country string `json:"country,omitempty"`
|
|
|
|
Phone string `json:"phone,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type authentificationData struct {
|
|
|
|
LoginType string `json:"type,omitempty"`
|
|
|
|
Session string `json:"session,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type discoveryInformation struct {
|
|
|
|
Homeserver homeserverInformation `json:"m.homeserver,omitempty"`
|
|
|
|
IdentityServer identityServerInformation `json:"m.identity_server,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type homeserverInformation struct {
|
|
|
|
BaseUrl string `json:"base_url,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type identityServerInformation struct {
|
|
|
|
BaseUrl string `json:"base_url,omitempty"`
|
|
|
|
}
|