Add td_api::searchPublicStoriesByLocation.
This commit is contained in:
parent
dcd532d1c0
commit
3f99e0a69b
@ -8104,6 +8104,12 @@ searchPublicMessagesByTag tag:string offset:string limit:int32 = FoundMessages;
|
||||
//@limit The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit
|
||||
searchPublicStoriesByTag tag:string offset:string limit:int32 = FoundStories;
|
||||
|
||||
//@description Searches for public stories by the given address location. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit
|
||||
//@address Address of the location
|
||||
//@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
|
||||
//@limit The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit
|
||||
searchPublicStoriesByLocation address:locationAddress offset:string limit:int32 = FoundStories;
|
||||
|
||||
//@description Searches for public stories from the given venue. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit
|
||||
//@venue_provider Provider of the venue
|
||||
//@venue_id Identifier of the venue in the provider database
|
||||
|
@ -718,6 +718,30 @@ class SearchStoriesQuery final : public Td::ResultHandler {
|
||||
G()->net_query_creator().create(telegram_api::stories_searchPosts(flags, hashtag, nullptr, offset, limit)));
|
||||
}
|
||||
|
||||
void send(td_api::object_ptr<td_api::locationAddress> &&address, const string &offset, int32 limit) {
|
||||
int32 flags = telegram_api::stories_searchPosts::AREA_MASK;
|
||||
|
||||
int32 address_flags = 0;
|
||||
if (!address->state_.empty()) {
|
||||
address_flags |= telegram_api::geoPointAddress::STATE_MASK;
|
||||
}
|
||||
if (!address->city_.empty()) {
|
||||
address_flags |= telegram_api::geoPointAddress::CITY_MASK;
|
||||
}
|
||||
if (!address->street_.empty()) {
|
||||
address_flags |= telegram_api::geoPointAddress::STREET_MASK;
|
||||
}
|
||||
|
||||
auto area = telegram_api::make_object<telegram_api::mediaAreaGeoPoint>(
|
||||
telegram_api::mediaAreaGeoPoint::ADDRESS_MASK,
|
||||
telegram_api::make_object<telegram_api::mediaAreaCoordinates>(0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
|
||||
telegram_api::make_object<telegram_api::geoPoint>(0, 0.0, 0.0, 0, 0),
|
||||
telegram_api::make_object<telegram_api::geoPointAddress>(address_flags, address->country_code_, address->state_,
|
||||
address->city_, address->street_));
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::stories_searchPosts(flags, string(), std::move(area), offset, limit)));
|
||||
}
|
||||
|
||||
void send(const string &venue_provider, const string &venue_id, const string &offset, int32 limit) {
|
||||
int32 flags = telegram_api::stories_searchPosts::AREA_MASK;
|
||||
auto area = telegram_api::make_object<telegram_api::mediaAreaVenue>(
|
||||
@ -2629,6 +2653,18 @@ void StoryManager::search_hashtag_posts(string hashtag, string offset, int32 lim
|
||||
->send(PSTRING() << (is_cashtag ? '$' : '#') << hashtag, offset, limit);
|
||||
}
|
||||
|
||||
void StoryManager::search_location_posts(td_api::object_ptr<td_api::locationAddress> &&address, string offset,
|
||||
int32 limit, Promise<td_api::object_ptr<td_api::foundStories>> &&promise) {
|
||||
if (limit <= 0) {
|
||||
return promise.set_error(Status::Error(400, "Parameter limit must be positive"));
|
||||
}
|
||||
if (limit > MAX_SEARCH_STORIES) {
|
||||
limit = MAX_SEARCH_STORIES;
|
||||
}
|
||||
|
||||
td_->create_handler<SearchStoriesQuery>(std::move(promise))->send(std::move(address), offset, limit);
|
||||
}
|
||||
|
||||
void StoryManager::search_venue_posts(string venue_provider, string venue_id, string offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::foundStories>> &&promise) {
|
||||
if (limit <= 0) {
|
||||
|
@ -256,6 +256,9 @@ class StoryManager final : public Actor {
|
||||
void search_hashtag_posts(string hashtag, string offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::foundStories>> &&promise);
|
||||
|
||||
void search_location_posts(td_api::object_ptr<td_api::locationAddress> &&address, string offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::foundStories>> &&promise);
|
||||
|
||||
void search_venue_posts(string venue_provider, string venue_id, string offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::foundStories>> &&promise);
|
||||
|
||||
|
@ -5325,6 +5325,21 @@ void Td::on_request(uint64 id, td_api::searchPublicStoriesByTag &request) {
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::searchPublicStoriesByLocation &request) {
|
||||
CHECK_IS_USER();
|
||||
if (request.address_ == nullptr) {
|
||||
return send_error_raw(id, 400, "Address must be non-empty");
|
||||
}
|
||||
CLEAN_INPUT_STRING(request.address_->country_code_);
|
||||
CLEAN_INPUT_STRING(request.address_->state_);
|
||||
CLEAN_INPUT_STRING(request.address_->city_);
|
||||
CLEAN_INPUT_STRING(request.address_->street_);
|
||||
CLEAN_INPUT_STRING(request.offset_);
|
||||
CREATE_REQUEST_PROMISE();
|
||||
story_manager_->search_location_posts(std::move(request.address_), std::move(request.offset_), request.limit_,
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::searchPublicStoriesByVenue &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.venue_provider_);
|
||||
|
@ -802,6 +802,8 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, td_api::searchPublicStoriesByTag &request);
|
||||
|
||||
void on_request(uint64 id, td_api::searchPublicStoriesByLocation &request);
|
||||
|
||||
void on_request(uint64 id, td_api::searchPublicStoriesByVenue &request);
|
||||
|
||||
void on_request(uint64 id, td_api::getSearchedForTags &request);
|
||||
|
@ -3073,6 +3073,17 @@ class CliClient final : public Actor {
|
||||
string offset;
|
||||
get_args(args, tag, limit, offset);
|
||||
send_request(td_api::make_object<td_api::searchPublicStoriesByTag>(tag, offset, as_limit(limit)));
|
||||
} else if (op == "spsbl") {
|
||||
string country_code;
|
||||
string state;
|
||||
string city;
|
||||
string street;
|
||||
string venue_id;
|
||||
string limit;
|
||||
string offset;
|
||||
get_args(args, country_code, state, city, street, limit, offset);
|
||||
send_request(td_api::make_object<td_api::searchPublicStoriesByLocation>(
|
||||
td_api::make_object<td_api::locationAddress>(country_code, state, city, street), offset, as_limit(limit)));
|
||||
} else if (op == "spsbv") {
|
||||
string venue_provider;
|
||||
string venue_id;
|
||||
|
Loading…
Reference in New Issue
Block a user