mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-30 21:12:45 +00:00
Add user profile tests, refactor user API methods (#3030)
This adds tests for `/profile`. Also, as a first change in this regard, refactors the methods defined on the `UserInternalAPI` to not use structs as the request/response parameters.
This commit is contained in:
parent
4cb9cd7842
commit
c2db38d295
17 changed files with 391 additions and 258 deletions
|
@ -15,16 +15,11 @@
|
|||
package eventutil
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strconv"
|
||||
|
||||
"github.com/matrix-org/dendrite/syncapi/types"
|
||||
)
|
||||
|
||||
// ErrProfileNoExists is returned when trying to lookup a user's profile that
|
||||
// doesn't exist locally.
|
||||
var ErrProfileNoExists = errors.New("no known profile for given user ID")
|
||||
|
||||
// AccountData represents account data sent from the client API server to the
|
||||
// sync API server
|
||||
type AccountData struct {
|
||||
|
@ -56,20 +51,10 @@ type NotificationData struct {
|
|||
UnreadNotificationCount int `json:"unread_notification_count"`
|
||||
}
|
||||
|
||||
// ProfileResponse is a struct containing all known user profile data
|
||||
type ProfileResponse struct {
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
DisplayName string `json:"displayname"`
|
||||
}
|
||||
|
||||
// AvatarURL is a struct containing only the URL to a user's avatar
|
||||
type AvatarURL struct {
|
||||
AvatarURL string `json:"avatar_url"`
|
||||
}
|
||||
|
||||
// DisplayName is a struct containing only a user's display name
|
||||
type DisplayName struct {
|
||||
DisplayName string `json:"displayname"`
|
||||
// UserProfile is a struct containing all known user profile data
|
||||
type UserProfile struct {
|
||||
AvatarURL string `json:"avatar_url,omitempty"`
|
||||
DisplayName string `json:"displayname,omitempty"`
|
||||
}
|
||||
|
||||
// WeakBoolean is a type that will Unmarshal to true or false even if the encoded
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue