42 std::optional<std::string>
key;
61 immer::array<std::string>
keys;
103 std::optional<std::string>
end;
161 immer::map<std::string, EventList>
state;
167 immer::map<std::string, immer::map<std::string, GroupValue>>
groups;
220 , std::string _accessToken
222 Categories searchCategories , std::optional<std::string> nextBatch = std::nullopt
227 std::optional<std::string> nextBatch);
242 using namespace Kazv;
249 if (! jo.is_object()) { jo = json::object(); }
263 if (jo.contains(
"before_limit"s)) {
266 if (jo.contains(
"after_limit"s)) {
269 if (jo.contains(
"include_profile"s)) {
281 if (! jo.is_object()) { jo = json::object(); }
291 if (jo.contains(
"key"s)) {
292 result.
key = jo.at(
"key"s);
303 if (! jo.is_object()) { jo = json::object(); }
313 if (jo.contains(
"group_by"s)) {
314 result.
groupBy = jo.at(
"group_by"s);
325 if (! jo.is_object()) { jo = json::object(); }
347 if (jo.contains(
"search_term"s)) {
350 if (jo.contains(
"keys"s)) {
351 result.
keys = jo.at(
"keys"s);
353 if (jo.contains(
"filter"s)) {
354 result.
filter = jo.at(
"filter"s);
356 if (jo.contains(
"order_by"s)) {
357 result.
orderBy = jo.at(
"order_by"s);
359 if (jo.contains(
"event_context"s)) {
362 if (jo.contains(
"include_state"s)) {
365 if (jo.contains(
"groupings"s)) {
377 if (! jo.is_object()) { jo = json::object(); }
387 if (jo.contains(
"room_events"s)) {
399 if (! jo.is_object()) { jo = json::object(); }
411 if (jo.contains(
"displayname"s)) {
414 if (jo.contains(
"avatar_url"s)) {
426 if (! jo.is_object()) { jo = json::object(); }
444 if (jo.contains(
"start"s)) {
445 result.
start = jo.at(
"start"s);
447 if (jo.contains(
"end"s)) {
448 result.
end = jo.at(
"end"s);
450 if (jo.contains(
"profile_info"s)) {
453 if (jo.contains(
"events_before"s)) {
456 if (jo.contains(
"events_after"s)) {
468 if (! jo.is_object()) { jo = json::object(); }
482 if (jo.contains(
"rank"s)) {
483 result.
rank = jo.at(
"rank"s);
485 if (jo.contains(
"result"s)) {
486 result.
result = jo.at(
"result"s);
488 if (jo.contains(
"context"s)) {
489 result.
context = jo.at(
"context"s);
500 if (! jo.is_object()) { jo = json::object(); }
514 if (jo.contains(
"next_batch"s)) {
517 if (jo.contains(
"order"s)) {
518 result.
order = jo.at(
"order"s);
520 if (jo.contains(
"results"s)) {
521 result.
results = jo.at(
"results"s);
532 if (! jo.is_object()) { jo = json::object(); }
552 if (jo.contains(
"count"s)) {
553 result.
count = jo.at(
"count"s);
555 if (jo.contains(
"highlights"s)) {
558 if (jo.contains(
"results"s)) {
559 result.
results = jo.at(
"results"s);
561 if (jo.contains(
"state"s)) {
562 result.
state = jo.at(
"state"s);
564 if (jo.contains(
"groups"s)) {
565 result.
groups = jo.at(
"groups"s);
567 if (jo.contains(
"next_batch"s)) {
579 if (! jo.is_object()) { jo = json::object(); }
589 if (jo.contains(
"room_events"s)) {
Definition: search.hpp:187
bool success() const
Definition: search.cpp:77
ResultCategories searchCategories() const
Describes which categories to search in and their criteria.
Definition: search.cpp:88
JobResponse(Response r)
Definition: search.cpp:74
Perform a server-side search.
Definition: search.hpp:16
SearchJob withData(JsonWrap j) &&
Definition: search.cpp:60
static constexpr auto needsAuth()
Definition: search.hpp:202
static BaseJob::Query buildQuery(std::optional< std::string > nextBatch)
Definition: search.cpp:13
SearchJob(std::string serverUrl, std::string _accessToken, Categories searchCategories, std::optional< std::string > nextBatch=std::nullopt)
Perform a server-side search.
Definition: search.cpp:40
static BaseJob::Body buildBody(Categories searchCategories, std::optional< std::string > nextBatch)
Definition: search.cpp:22
Definition: basejob.hpp:91
Definition: basejob.hpp:77
::Kazv::Body Body
Definition: basejob.hpp:100
Definition: jsonwrap.hpp:23
Definition: location.hpp:10
Definition: location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:80
nlohmann::json json
Definition: jsonwrap.hpp:20
immer::flex_vector< Event > EventList
Definition: types.hpp:107
Definition: location.hpp:27
Definition: room_event_filter.hpp:13
Describes which categories to search in and their criteria.
Definition: search.hpp:81
std::optional< RoomEventsCriteria > roomEvents
Mapping of category name to search criteria.
Definition: search.hpp:83
Context for result, if requested.
Definition: search.hpp:99
EventList eventsBefore
Events just before the result.
Definition: search.hpp:111
immer::map< std::string, UserProfile > profileInfo
The historic profile information of the users that sent the events returned.
Definition: search.hpp:109
std::optional< std::string > start
Pagination token for the start of the chunk.
Definition: search.hpp:101
std::optional< std::string > end
Pagination token for the end of the chunk.
Definition: search.hpp:103
EventList eventsAfter
Events just after the result.
Definition: search.hpp:113
The results for a particular group value.
Definition: search.hpp:131
std::optional< int > order
Key that can be used to order different groups.
Definition: search.hpp:140
std::optional< std::string > nextBatch
Token that can be used to get the next batch of results in the group, by passing as the next_batch pa...
Definition: search.hpp:137
immer::array< std::string > results
Which results are in this group.
Definition: search.hpp:142
Configuration for group.
Definition: search.hpp:40
std::optional< std::string > key
Key that defines the group.
Definition: search.hpp:42
Requests that the server partitions the result set based on the provided list of keys.
Definition: search.hpp:49
immer::array< Group > groupBy
List of groups to request.
Definition: search.hpp:51
Configures whether any context for the events returned are included in the response.
Definition: search.hpp:23
std::optional< int > beforeLimit
How many events before the result are returned.
Definition: search.hpp:26
std::optional< int > afterLimit
How many events after the result are returned.
Definition: search.hpp:29
std::optional< bool > includeProfile
Requests that the server returns the historic profile information for the users that sent the events ...
Definition: search.hpp:34
Describes which categories to search in and their criteria.
Definition: search.hpp:178
std::optional< ResultRoomEvents > roomEvents
Mapping of category name to search criteria.
Definition: search.hpp:180
Mapping of category name to search criteria.
Definition: search.hpp:148
std::optional< std::string > nextBatch
Token that can be used to get the next batch of results, by passing as the next_batch parameter to th...
Definition: search.hpp:172
immer::map< std::string, immer::map< std::string, GroupValue > > groups
Any groups that were requested.
Definition: search.hpp:167
immer::array< Result > results
List of results in the requested order.
Definition: search.hpp:154
std::optional< int > count
An approximate count of the total number of results found.
Definition: search.hpp:150
immer::map< std::string, EventList > state
The current state for every room in the results.
Definition: search.hpp:161
immer::array< std::string > highlights
List of words which should be highlighted, useful for stemming which may change the query terms.
Definition: search.hpp:152
The result object.
Definition: search.hpp:119
JsonWrap result
The event that matched.
Definition: search.hpp:123
std::optional< double > rank
A number that describes how closely this result matches the search. Higher is closer.
Definition: search.hpp:121
std::optional< EventContext > context
Context for result, if requested.
Definition: search.hpp:125
Mapping of category name to search criteria.
Definition: search.hpp:57
std::optional< bool > includeState
Requests the server return the current state for each room returned.
Definition: search.hpp:72
std::string searchTerm
The string to search events for.
Definition: search.hpp:59
RoomEventFilter filter
This takes a filter.
Definition: search.hpp:63
std::optional< std::string > orderBy
The order in which to search for results.
Definition: search.hpp:66
std::optional< Groupings > groupings
Requests that the server partitions the result set based on the provided list of keys.
Definition: search.hpp:75
immer::array< std::string > keys
The keys to search. Defaults to all.
Definition: search.hpp:61
std::optional< IncludeEventContext > eventContext
Configures whether any context for the events returned are included in the response.
Definition: search.hpp:69
Performs a full text search across different categories.
Definition: search.hpp:89
std::optional< std::string > displayname
Performs a full text search across different categories.
Definition: search.hpp:91
std::optional< std::string > avatarUrl
Performs a full text search across different categories.
Definition: search.hpp:93
Definition: basejob.hpp:50
static void from_json(const json &jo, SearchJob::Categories &result)
Definition: search.hpp:384
static void to_json(json &jo, const SearchJob::Categories &pod)
Definition: search.hpp:375
static void to_json(json &jo, const SearchJob::EventContext &pod)
Definition: search.hpp:424
static void from_json(const json &jo, SearchJob::EventContext &result)
Definition: search.hpp:441
static void from_json(const json &jo, SearchJob::GroupValue &result)
Definition: search.hpp:511
static void to_json(json &jo, const SearchJob::GroupValue &pod)
Definition: search.hpp:498
static void from_json(const json &jo, SearchJob::Group &result)
Definition: search.hpp:288
static void to_json(json &jo, const SearchJob::Group &pod)
Definition: search.hpp:279
static void to_json(json &jo, const SearchJob::Groupings &pod)
Definition: search.hpp:301
static void from_json(const json &jo, SearchJob::Groupings &result)
Definition: search.hpp:310
static void to_json(json &jo, const SearchJob::IncludeEventContext &pod)
Definition: search.hpp:247
static void from_json(const json &jo, SearchJob::IncludeEventContext &result)
Definition: search.hpp:260
static void to_json(json &jo, const SearchJob::ResultCategories &pod)
Definition: search.hpp:577
static void from_json(const json &jo, SearchJob::ResultCategories &result)
Definition: search.hpp:586
static void to_json(json &jo, const SearchJob::ResultRoomEvents &pod)
Definition: search.hpp:530
static void from_json(const json &jo, SearchJob::ResultRoomEvents &result)
Definition: search.hpp:549
static void from_json(const json &jo, SearchJob::Result &result)
Definition: search.hpp:479
static void to_json(json &jo, const SearchJob::Result &pod)
Definition: search.hpp:466
static void from_json(const json &jo, SearchJob::RoomEventsCriteria &result)
Definition: search.hpp:344
static void to_json(json &jo, const SearchJob::RoomEventsCriteria &pod)
Definition: search.hpp:323
static void from_json(const json &jo, SearchJob::UserProfile &result)
Definition: search.hpp:408
static void to_json(json &jo, const SearchJob::UserProfile &pod)
Definition: search.hpp:397