mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
client: omit from parameter in /messages if empty
Some checks failed
Some checks failed
This commit is contained in:
parent
3d84843ec4
commit
50f4a2eec1
1 changed files with 5 additions and 3 deletions
|
|
@ -1836,11 +1836,10 @@ func (cli *Client) Hierarchy(ctx context.Context, roomID id.RoomID, req *ReqHier
|
|||
|
||||
// Messages returns a list of message and state events for a room. It uses
|
||||
// pagination query parameters to paginate history in the room.
|
||||
// See https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3roomsroomidmessages
|
||||
// See https://spec.matrix.org/v1.12/client-server-api/#get_matrixclientv3roomsroomidmessages
|
||||
func (cli *Client) Messages(ctx context.Context, roomID id.RoomID, from, to string, dir Direction, filter *FilterPart, limit int) (resp *RespMessages, err error) {
|
||||
query := map[string]string{
|
||||
"from": from,
|
||||
"dir": string(dir),
|
||||
"dir": string(dir),
|
||||
}
|
||||
if filter != nil {
|
||||
filterJSON, err := json.Marshal(filter)
|
||||
|
|
@ -1849,6 +1848,9 @@ func (cli *Client) Messages(ctx context.Context, roomID id.RoomID, from, to stri
|
|||
}
|
||||
query["filter"] = string(filterJSON)
|
||||
}
|
||||
if from != "" {
|
||||
query["from"] = from
|
||||
}
|
||||
if to != "" {
|
||||
query["to"] = to
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue