Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add email on account create/modify, add possibility to modify pushers #207

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2299,3 +2299,16 @@ func NewClient(homeserverURL string, userID id.UserID, accessToken string) (*Cli
Store: NewMemorySyncStore(),
}, nil
}

// SetPushers modifies the user pushers.
//
// https://spec.matrix.org/latest/client-server-api/#post_matrixclientv3pushersset
func (cli *Client) SetPushers(ctx context.Context, req ReqSetPushers) error {
reqURL := cli.BuildClientURL("v3", "pushers", "set")
_, err := cli.MakeFullRequest(ctx, FullRequest{
Method: http.MethodPost,
URL: reqURL,
RequestJSON: &req,
})
return err
}
17 changes: 17 additions & 0 deletions requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,3 +454,20 @@ type ReqKeyBackupData struct {
IsVerified bool `json:"is_verified"`
SessionData json.RawMessage `json:"session_data"`
}

type PushData struct {
Format string `json:"format"`
URL string `json:"url"`
}

type ReqSetPushers struct {
AppDisplayName string `json:"app_display_name"`
AppID string `json:"app_id"`
Append bool `json:"append"`
Data PushData `json:"data"`
DeviceDisplayName string `json:"device_display_name"`
Kind string `json:"kind"`
Lang string `json:"lang"`
ProfileTag string `json:"profile_tag"`
PushKey string `json:"pushkey"`
}
7 changes: 7 additions & 0 deletions synapseadmin/userapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ func (cli *Client) DeactivateAccount(ctx context.Context, userID id.UserID, req
return err
}

type Threepid struct {
Medium string `json:"medium"`
Address string `json:"address"`
}

type ReqCreateOrModifyAccount struct {
Password string `json:"password,omitempty"`
LogoutDevices *bool `json:"logout_devices,omitempty"`
Expand All @@ -137,6 +142,8 @@ type ReqCreateOrModifyAccount struct {
Displayname string `json:"displayname,omitempty"`
AvatarURL id.ContentURIString `json:"avatar_url,omitempty"`
UserType string `json:"user_type,omitempty"`

Threepids []Threepid `json:"threepids,omitempty"`
}

// CreateOrModifyAccount creates or modifies an account on the server.
Expand Down