Documentation
¶
Index ¶
- Constants
- Variables
- func CreateCommonSettings(inst *instance.Instance, settings *couchdb.JSONDoc) error
- func IsMatrixID(id string) bool
- func UpdateAvatar(inst *instance.Instance) (bool, error)
- func UpdateCommonSettings(inst *instance.Instance, settings *couchdb.JSONDoc) (bool, error)
- type UserSettingsPayload
- type UserSettingsRequest
Constants ¶
const DefaultTimezone = "Europe/Paris"
DefaultTimezone is used when no timezone is specified, as this parameter is required.
Variables ¶
var DoCommonHTTP = doCommonSettingsRequest
DoCommonHTTP is the indirection used to perform HTTP calls to the common settings API. Tests can override this variable to stub network calls.
var ErrCommonSettingsVersionMismatch = errors.New("common settings version mismatch")
ErrCommonSettingsVersionMismatch indicates that the remote common settings version differs from the local instance version and the update should not proceed.
var GetRemoteCommonSettings = getRemoteCommonSettings
Functions ¶
func CreateCommonSettings ¶
CreateCommonSettings creates user settings for an instance via the common settings API. The common settings version is increased on the instance, but it's the caller's responsibility to persist it.
func IsMatrixID ¶
IsMatrixID reports whether id has the `@localpart:server` shape. A stored value that fails the check is ignored in favour of the derived one.
func UpdateAvatar ¶
UpdateAvatar updates user settings for an instance via the common settings API when the avatar has been updated. The common settings version is increased on the instance, but it's the caller's responsibility to persist it when the bool returned is true (aka a common settings call has been made).
func UpdateCommonSettings ¶
UpdateCommonSettings updates user settings for an instance via the common settings API. The common settings version is increased on the instance, but it's the caller's responsibility to persist it when the bool returned is true (aka a common settings call has been made).
Types ¶
type UserSettingsPayload ¶
type UserSettingsPayload struct {
Language string `json:"language,omitempty"`
Timezone string `json:"timezone,omitempty"`
LastName string `json:"last_name,omitempty"`
FirstName string `json:"first_name,omitempty"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
MatrixID string `json:"matrix_id,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Avatar string `json:"avatar,omitempty"`
}
UserSettingsPayload represents the payload structure for user settings
type UserSettingsRequest ¶
type UserSettingsRequest struct {
Source string `json:"source"`
Nickname string `json:"nickname"`
RequestID string `json:"request_id"`
Timestamp int64 `json:"timestamp"`
Version int `json:"version"`
Payload UserSettingsPayload `json:"payload"`
}
UserSettingsRequest represents the complete request structure