matrix

package
v0.0.0-...-f6c4056 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package matrix implements Matrix-specific operations and logic for managing push notification settings profiles for Matrix users.

Index

Constants

View Source
const ACCOUNT_DATA_TYPE = "bzh.abolivier.profiles.push"

ACCOUNT_DATA_TYPE is the type of the data that gets added to the user's account data.

Variables

View Source
var (
	// ErrProfileExists is returned when trying to create a profile with a name
	// that already has a profile attached to it.
	ErrProfileExists = errors.New("A profile already exists with this name, use another name or the -overwrite flag to overwrite it")
	// ErrProfileNotExists is returned when trying to delete a profile which
	// doesn't exist.
	ErrProfileNotExists = errors.New("No profile exists with this name")
)

Functions

func AddPushRule

func AddPushRule(cli *gomatrix.Client, rule types.PushRule) error

AddPushRule adds a rule to the user's notification settings. Returns an error if the addition failed.

func DeleteProfile

func DeleteProfile(cli *gomatrix.Client, name string) error

DeleteProfile deletes a profile from the user's account data. Returns ErrProfileNotExists if there's no profile with this name in the user's account data. Returns an error if there was an issue talking with the Matrix homeserver.

func DeletePushRule

func DeletePushRule(cli *gomatrix.Client, rule types.PushRule) error

DeletePushRule deletes a rule from the user's notification settings. Returns an error if the deletion failed.

func GetProfiles

func GetProfiles(cli *gomatrix.Client) (profiles map[string]types.PushRules, err error)

GetProfiles retrieves the list of profile for the user's account data. Returns an error if the retrieval failed.

func GetPushRules

func GetPushRules(cli *gomatrix.Client) (rules types.PushRules, err error)

GetPushRules retrieves the notifications settings for the user. Returns an error if the retrieval failed.

func SaveProfile

func SaveProfile(cli *gomatrix.Client, name string, profile types.PushRules, overwrite bool) error

SaveProfile saves a profile to the user's account data. Returns ErrProfileExists if a profile already exists for the provided name, unless overwrite is true, in which case it overwrites the profile the name is attached to. Returns an error if there was an issue talking with the Matrix homeserver.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL