2020-09-28 20:37:02 +00:00
|
|
|
package user
|
|
|
|
|
|
|
|
import (
|
2020-10-12 14:16:28 +00:00
|
|
|
"git.nutfactory.org/hoernschen/Matrix/entities/device"
|
2020-09-28 20:37:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
2020-10-11 21:11:30 +00:00
|
|
|
type availableRequest struct {
|
|
|
|
Username string `json:"username,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type availableResponse struct {
|
|
|
|
Available bool `json:"available,omitempty"`
|
|
|
|
}
|
|
|
|
|
2020-10-12 14:16:28 +00:00
|
|
|
type RegisterRequest struct {
|
|
|
|
Auth AuthentificationData `json:"auth,omitempty"`
|
2020-10-03 12:22:29 +00:00
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
2020-10-12 14:16:28 +00:00
|
|
|
type RegisterResponse struct {
|
2020-10-03 12:22:29 +00:00
|
|
|
UserId string `json:"user_id,omitempty"`
|
|
|
|
AccessToken string `json:"access_token,omitempty"`
|
2020-10-17 10:07:39 +00:00
|
|
|
sqllite string `json:"home_server,omitempty"`
|
2020-10-03 12:22:29 +00:00
|
|
|
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 {
|
2020-10-12 14:16:28 +00:00
|
|
|
Auth AuthentificationData `json:"auth,omitempty"`
|
2020-10-03 12:22:29 +00:00
|
|
|
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
|
2020-10-12 14:16:28 +00:00
|
|
|
Auth AuthentificationData
|
2020-10-03 12:22:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
2020-10-12 14:16:28 +00:00
|
|
|
type AuthentificationData struct {
|
2020-10-03 12:22:29 +00:00
|
|
|
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"`
|
|
|
|
}
|