Documentation ¶
Index ¶
- type Client
- func (cli *Client) BlockRoom(ctx context.Context, roomID id.RoomID, req ReqBlockRoom) error
- func (cli *Client) BuildAdminURL(path ...any) string
- func (cli *Client) CreateOrModifyAccount(ctx context.Context, userID id.UserID, req ReqCreateOrModifyAccount) error
- func (cli *Client) DeactivateAccount(ctx context.Context, userID id.UserID, req ReqDeleteUser) error
- func (cli *Client) DeleteRoom(ctx context.Context, roomID id.RoomID, req ReqDeleteRoom) (RespDeleteRoom, error)
- func (cli *Client) DeleteUserRatelimit(ctx context.Context, userID id.UserID) (err error)
- func (cli *Client) GetRegisterNonce(ctx context.Context) (string, error)
- func (cli *Client) GetRoomBlockStatus(ctx context.Context, roomID id.RoomID) (RoomsBlockResponse, error)
- func (cli *Client) GetUserInfo(ctx context.Context, userID id.UserID) (resp *RespUserInfo, err error)
- func (cli *Client) GetUserRatelimit(ctx context.Context, userID id.UserID) (resp RespUserRatelimit, err error)
- func (cli *Client) JoinUserToRoom(ctx context.Context, roomID id.RoomID, req ReqJoinUserToRoom) error
- func (cli *Client) ListDevices(ctx context.Context, userID id.UserID) (resp *RespListDevices, err error)
- func (cli *Client) ListRooms(ctx context.Context, req ReqListRoom) (RespListRooms, error)
- func (cli *Client) MakeRoomAdmin(ctx context.Context, roomIDOrAlias string, req ReqMakeRoomAdmin) error
- func (cli *Client) ResetPassword(ctx context.Context, req ReqResetPassword) error
- func (cli *Client) RoomMembers(ctx context.Context, roomID id.RoomID) (RespRoomsMembers, error)
- func (cli *Client) RoomMessages(ctx context.Context, roomID id.RoomID, from, to string, dir mautrix.Direction, ...) (resp *RespRoomMessages, err error)
- func (cli *Client) SetUserRatelimit(ctx context.Context, userID id.UserID, req ReqSetRatelimit) 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 RatelimitOverride
- type ReqBlockRoom
- type ReqCreateOrModifyAccount
- type ReqDeleteRoom
- type ReqDeleteUser
- type ReqJoinUserToRoom
- type ReqListRoom
- type ReqMakeRoomAdmin
- type ReqResetPassword
- type ReqSetRatelimit
- type ReqSharedSecretRegister
- type RespDeleteRoom
- type RespListDevices
- type RespListRooms
- type RespRoomMessages
- type RespRoomsMembers
- type RespUserInfo
- type RespUserRatelimit
- type RoomInfo
- type RoomsBlockResponse
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) BlockRoom ¶
BlockRoom blocks or unblocks a room.
https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#block-room-api
func (*Client) BuildAdminURL ¶
func (*Client) CreateOrModifyAccount ¶
func (cli *Client) CreateOrModifyAccount(ctx context.Context, userID id.UserID, req ReqCreateOrModifyAccount) error
CreateOrModifyAccount creates or modifies an account on the server.
https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#create-or-modify-account
func (*Client) DeactivateAccount ¶
func (cli *Client) DeactivateAccount(ctx context.Context, userID id.UserID, req ReqDeleteUser) error
DeactivateAccount deactivates a specific local user account.
https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#deactivate-account
func (*Client) DeleteRoom ¶
func (cli *Client) DeleteRoom(ctx context.Context, roomID id.RoomID, req ReqDeleteRoom) (RespDeleteRoom, error)
DeleteRoom deletes a room from the server, optionally blocking it and/or purging all data from the database.
This calls the async version of the endpoint, which will return immediately and delete the room in the background.
https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#version-2-new-version
func (*Client) DeleteUserRatelimit ¶
DeleteUserRatelimit deletes the ratelimit override for the given user, returning them to the default ratelimits.
https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#delete-ratelimit
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) GetRoomBlockStatus ¶
func (cli *Client) GetRoomBlockStatus(ctx context.Context, roomID id.RoomID) (RoomsBlockResponse, error)
GetRoomBlockStatus gets whether a room is currently blocked.
https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#get-block-status
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) GetUserRatelimit ¶
func (cli *Client) GetUserRatelimit(ctx context.Context, userID id.UserID) (resp RespUserRatelimit, err error)
GetUserRatelimit gets the ratelimit override for the given user.
https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#get-status-of-ratelimit
func (*Client) JoinUserToRoom ¶
func (cli *Client) JoinUserToRoom(ctx context.Context, roomID id.RoomID, req ReqJoinUserToRoom) error
JoinUserToRoom makes a local user join the given room.
https://matrix-org.github.io/synapse/latest/admin_api/room_membership.html
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) ListRooms ¶
func (cli *Client) ListRooms(ctx context.Context, req ReqListRoom) (RespListRooms, error)
ListRooms returns a list of rooms on the server.
https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#list-room-api
func (*Client) MakeRoomAdmin ¶
func (cli *Client) MakeRoomAdmin(ctx context.Context, roomIDOrAlias string, req ReqMakeRoomAdmin) error
MakeRoomAdmin promotes a user to admin in a room. This requires that a local user has permission to promote users in the room.
https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#make-room-admin-api
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) RoomMembers ¶
RoomMembers gets the full list of members in a room.
https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#room-members-api
func (*Client) RoomMessages ¶
func (cli *Client) RoomMessages(ctx context.Context, roomID id.RoomID, from, to string, dir mautrix.Direction, filter *mautrix.FilterPart, limit int) (resp *RespRoomMessages, err error)
RoomMessages returns a list of messages in a room.
https://matrix-org.github.io/synapse/latest/admin_api/rooms.html#room-messages-api
func (*Client) SetUserRatelimit ¶
func (cli *Client) SetUserRatelimit(ctx context.Context, userID id.UserID, req ReqSetRatelimit) error
SetUserRatelimit overrides the message sending ratelimit for a specific user.
https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#set-ratelimit
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 RatelimitOverride ¶
type ReqBlockRoom ¶
type ReqBlockRoom struct {
Block bool `json:"block"`
}
type ReqCreateOrModifyAccount ¶
type ReqCreateOrModifyAccount struct { Password string `json:"password,omitempty"` LogoutDevices *bool `json:"logout_devices,omitempty"` Deactivated *bool `json:"deactivated,omitempty"` Admin *bool `json:"admin,omitempty"` Locked *bool `json:"locked,omitempty"` Displayname string `json:"displayname,omitempty"` AvatarURL id.ContentURIString `json:"avatar_url,omitempty"` UserType string `json:"user_type,omitempty"` }
type ReqDeleteRoom ¶
type ReqDeleteUser ¶
type ReqDeleteUser struct {
Erase bool `json:"erase"`
}
type ReqJoinUserToRoom ¶
type ReqListRoom ¶
type ReqListRoom struct { SearchTerm string OrderBy string Direction mautrix.Direction From int Limit int }
func (*ReqListRoom) BuildQuery ¶
func (req *ReqListRoom) BuildQuery() map[string]string
type ReqMakeRoomAdmin ¶
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 ReqSetRatelimit ¶
type ReqSetRatelimit = RatelimitOverride
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 RespDeleteRoom ¶
type RespDeleteRoom struct {
DeleteID string `json:"delete_id"`
}
type RespListDevices ¶
type RespListDevices struct { Devices []DeviceInfo `json:"devices"` Total int `json:"total"` }
type RespListRooms ¶
type RespRoomMessages ¶
type RespRoomMessages = mautrix.RespMessages
type RespRoomsMembers ¶
type RespUserInfo ¶
type RespUserInfo struct { UserID id.UserID `json:"name"` DisplayName string `json:"displayname"` AvatarURL id.ContentURIString `json:"avatar_url"` Guest bool `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"` }
type RespUserRatelimit ¶
type RespUserRatelimit = RatelimitOverride
type RoomInfo ¶
type RoomInfo struct { RoomID id.RoomID `json:"room_id"` Name string `json:"name"` CanonicalAlias id.RoomAlias `json:"canonical_alias"` JoinedMembers int `json:"joined_members"` JoinedLocalMembers int `json:"joined_local_members"` Version string `json:"version"` Creator id.UserID `json:"creator"` Encryption id.Algorithm `json:"encryption"` Federatable bool `json:"federatable"` Public bool `json:"public"` JoinRules event.JoinRule `json:"join_rules"` GuestAccess event.GuestAccess `json:"guest_access"` HistoryVisibility event.HistoryVisibility `json:"history_visibility"` StateEvents int `json:"state_events"` RoomType event.RoomType `json:"room_type"` }
type RoomsBlockResponse ¶
RoomsBlockResponse represents the response containing wether a room is blocked or not