package clientapi import ( "net/http" "github.com/dariuszjaniak/warp/server/internal/httputil" "github.com/dariuszjaniak/warp/server/internal/syncapi" "github.com/dariuszjaniak/warp/server/internal/userapi" ) // handleSearch implements POST /_matrix/client/v3/search. func (c *ClientAPI) handleSearch(w http.ResponseWriter, r *http.Request, auth userapi.Authenticated) error { var body syncapi.SearchBody if err := httputil.DecodeJSON(w, r, &body); err != nil { return err } resp, err := c.sync.Search(r.Context(), syncapi.SearchRequest{ User: auth.UserID, NextBatch: r.URL.Query().Get("next_batch"), Body: body, }) if err != nil { return syncError(err) } httputil.WriteJSON(w, http.StatusOK, resp) return nil }