Documentation ¶
Index ¶
- type Client
- func (cli *Client) BuildAdminURL(path ...any) string
- func (cli *Client) GetRegisterNonce(ctx context.Context) (string, error)
- func (cli *Client) GetUserInfo(ctx context.Context, userID id.UserID) (resp *RespUserInfo, err error)
- func (cli *Client) ListDevices(ctx context.Context, userID id.UserID) (resp *RespListDevices, err error)
- func (cli *Client) ResetPassword(ctx context.Context, req ReqResetPassword) error
- func (cli *Client) SharedSecretRegister(ctx context.Context, sharedSecret string, req ReqSharedSecretRegister) (*mautrix.RespRegister, error)
- func (cli *Client) UsernameAvailable(ctx context.Context, username string) (resp *mautrix.RespRegisterAvailable, err error)
- type DeviceInfo
- type ReqResetPassword
- type ReqSharedSecretRegister
- type RespListDevices
- type RespUserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
*mautrix.Client
}
Client is a wrapper for the mautrix.Client struct that includes methods for accessing the Synapse admin API.
https://matrix-org.github.io/synapse/latest/usage/administration/admin_api/index.html
func (*Client) BuildAdminURL ¶
func (*Client) GetRegisterNonce ¶
GetRegisterNonce gets a nonce that can be used for SharedSecretRegister.
This does not need to be called manually as SharedSecretRegister will automatically call this if no nonce is provided.
func (*Client) GetUserInfo ¶
func (cli *Client) GetUserInfo(ctx context.Context, userID id.UserID) (resp *RespUserInfo, err error)
GetUserInfo gets information about a specific user account.
https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#query-user-account
func (*Client) ListDevices ¶
func (cli *Client) ListDevices(ctx context.Context, userID id.UserID) (resp *RespListDevices, err error)
ListDevices gets information about all the devices of a specific user.
https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#list-all-devices
func (*Client) ResetPassword ¶
func (cli *Client) ResetPassword(ctx context.Context, req ReqResetPassword) error
ResetPassword changes the password of another user using
https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#reset-password
func (*Client) SharedSecretRegister ¶
func (cli *Client) SharedSecretRegister(ctx context.Context, sharedSecret string, req ReqSharedSecretRegister) (*mautrix.RespRegister, error)
SharedSecretRegister creates a new account using a shared secret.
https://matrix-org.github.io/synapse/latest/admin_api/register_api.html
func (*Client) UsernameAvailable ¶
func (cli *Client) UsernameAvailable(ctx context.Context, username string) (resp *mautrix.RespRegisterAvailable, err error)
UsernameAvailable checks if a username is valid and available for registration on the server using the admin API.
The response format is the same as mautrix.Client.RegisterAvailable, but it works even if registration is disabled on the server.
type DeviceInfo ¶
type DeviceInfo struct { mautrix.RespDeviceInfo LastSeenUserAgent string `json:"last_seen_user_agent"` }
type ReqResetPassword ¶
type ReqResetPassword struct { // The user whose password to reset. UserID id.UserID `json:"-"` // The new password for the user. Required. NewPassword string `json:"new_password"` // Whether all the user's existing devices should be logged out after the password change. LogoutDevices bool `json:"logout_devices"` }
ReqResetPassword is the request content for Client.ResetPassword.
type ReqSharedSecretRegister ¶
type ReqSharedSecretRegister struct { string `json:"username"` Password string `json:"password"` Displayname string `json:"displayname,omitempty"` // Officially allowed values are "support" or "bot". // // Currently, the only effect is that synapse skips consent requirements for those two user types, // other than that the user type does absolutely nothing. UserType string `json:"user_type,omitempty"` Admin bool `json:"admin"` // If true, the access_token and device_id fields in the response will be empty. InhibitLogin bool `json:"inhibit_login,omitempty"` Nonce string `json:"nonce"` SHA1Checksum string `json:"mac"` }Username
ReqSharedSecretRegister is the request content for Client.SharedSecretRegister.
func (*ReqSharedSecretRegister) Sign ¶
func (req *ReqSharedSecretRegister) Sign(secret string) string
type RespListDevices ¶
type RespListDevices struct { Devices []DeviceInfo `json:"devices"` Total int `json:"total"` }
type RespUserInfo ¶
type RespUserInfo struct { UserID id.UserID `json:"name"` DisplayName string `json:"displayname"` AvatarURL id.ContentURIString `json:"avatar_url"` Guest int `json:"is_guest"` Admin bool `json:"admin"` Deactivated bool `json:"deactivated"` Erased bool `json:"erased"` ShadowBanned bool `json:"shadow_banned"` CreationTS jsontime.Unix `json:"creation_ts"` AppserviceID string `json:"appservice_id"` UserType string `json:"user_type"` }